Jason Hu | a06a229e | 2024-05-04 01:40:06 | [diff] [blame] | 1 | // Copyright 2024 The Chromium Authors |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Radu Nitescu | e47d571 | 2024-07-12 10:29:02 | [diff] [blame] | 5 | #ifndef COMPONENTS_LENS_LENS_OVERLAY_PERMISSION_UTILS_H_ |
| 6 | #define COMPONENTS_LENS_LENS_OVERLAY_PERMISSION_UTILS_H_ |
Jason Hu | a06a229e | 2024-05-04 01:40:06 | [diff] [blame] | 7 | |
| 8 | class PrefService; |
| 9 | |
| 10 | namespace syncer { |
| 11 | class SyncService; |
| 12 | } // namespace syncer |
| 13 | |
Mohamad Ahmadi | eb5d122 | 2024-05-06 17:12:43 | [diff] [blame] | 14 | namespace user_prefs { |
| 15 | class PrefRegistrySyncable; |
| 16 | } // namespace user_prefs |
| 17 | |
Jason Hu | a06a229e | 2024-05-04 01:40:06 | [diff] [blame] | 18 | namespace lens { |
Mohamad Ahmadi | eb5d122 | 2024-05-06 17:12:43 | [diff] [blame] | 19 | namespace prefs { |
| 20 | |
Justin Donnelly | d470434 | 2024-05-28 20:32:26 | [diff] [blame] | 21 | // The possible values for the Lens Overlay enterprise policy. The value is an |
| 22 | // integer rather than a boolean to allow for additional states to be added in |
| 23 | // the future. |
| 24 | enum class LensOverlaySettingsPolicyValue { |
| 25 | kEnabled = 0, |
| 26 | kDisabled = 1, |
| 27 | }; |
| 28 | |
| 29 | // An integer setting indicating whether the Lens Overlay feature is enabled or |
| 30 | // disabled by the 'LensOverlaySettings' enterprise policy. |
| 31 | inline constexpr char kLensOverlaySettings[] = |
| 32 | "lens.policy.lens_overlay_settings"; |
| 33 | |
Duncan Mercer | 24c4edf | 2024-11-08 23:07:39 | [diff] [blame] | 34 | // The possible values for the GenAI Lens Overlay enterprise policy. Currently, |
| 35 | // 0 and 1 are treated the same, since no server-side logging is done for the |
| 36 | // Lens Overlay. If this changes in the future, and the server needs to |
| 37 | // log, this policy will control whether logging is allowed for a request. |
| 38 | enum class GenAiLensOverlaySettingsPolicyValue { |
| 39 | kAllowed = 0, |
| 40 | kAllowedWithoutLogging = 1, |
| 41 | kDisabled = 2, |
| 42 | }; |
| 43 | |
| 44 | // An integer setting indicating whether the Lens Overlay feature is enabled or |
| 45 | // disabled by the 'GenAiLensOverlaySettings' enterprise policy. This policy |
Duncan Mercer | 98b9fc68 | 2024-11-26 21:46:11 | [diff] [blame] | 46 | // will deprecate the old kLensOverlaySettings policy above in the lens overlay |
| 47 | // is classified as GenAI. |
Duncan Mercer | 24c4edf | 2024-11-08 23:07:39 | [diff] [blame] | 48 | inline constexpr char kGenAiLensOverlaySettings[] = |
| 49 | "lens.policy.gen_ai_lens_overlay_settings"; |
| 50 | |
Mohamad Ahmadi | eb5d122 | 2024-05-06 17:12:43 | [diff] [blame] | 51 | // A boolean indicating whether the whether the user has permitted sharing page |
| 52 | // screenshot with the Lens Overlay server. |
| 53 | inline constexpr char kLensSharingPageScreenshotEnabled[] = |
| 54 | "lens.sharing_page_screenshot.enabled"; |
| 55 | |
Nihar Majmudar | 1200821 | 2024-10-09 16:53:53 | [diff] [blame] | 56 | // A boolean indicating whether the whether the user has permitted sharing page |
| 57 | // content with the Lens Overlay server. Used for the contextual searchbox. |
| 58 | inline constexpr char kLensSharingPageContentEnabled[] = |
| 59 | "lens.sharing_page_content.enabled"; |
| 60 | |
Mohamad Ahmadi | eb5d122 | 2024-05-06 17:12:43 | [diff] [blame] | 61 | // Registers the prefs used by the Lens Overlay. |
| 62 | void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 63 | |
| 64 | } // namespace prefs |
| 65 | |
| 66 | // Returns true if the user, i.e., the local, current profile, is permitted to |
| 67 | // share the the page screenshot with the Lens Overlay server. |
| 68 | bool CanSharePageScreenshotWithLensOverlay(PrefService* pref_service); |
Jason Hu | a06a229e | 2024-05-04 01:40:06 | [diff] [blame] | 69 | |
| 70 | // Returns true if the user, i.e., the local, current profile, is permitted to |
Nihar Majmudar | 1200821 | 2024-10-09 16:53:53 | [diff] [blame] | 71 | // share the the page context with the Lens Overlay server. |
| 72 | bool CanSharePageContentWithLensOverlay(PrefService* pref_service); |
| 73 | |
| 74 | // Returns true if the user, i.e., the local, current profile, is permitted to |
| 75 | // share the the page URL with the the Lens Overlay server. This can be through |
| 76 | // MSBB or accepting the CSB permission bubble, which informs the user about |
| 77 | // sharing the page URL. |
Jason Hu | a06a229e | 2024-05-04 01:40:06 | [diff] [blame] | 78 | bool CanSharePageURLWithLensOverlay(PrefService* pref_service); |
| 79 | |
| 80 | // Returns true if the user, i.e., the local, current profile, is permitted to |
| 81 | // share the information about the page title with the the Lens Overlay server. |
Nihar Majmudar | 1200821 | 2024-10-09 16:53:53 | [diff] [blame] | 82 | // This can be through history sync or accepting the CSB permission bubble, |
| 83 | // which informs the user about sharing the page title. |
| 84 | bool CanSharePageTitleWithLensOverlay(syncer::SyncService* sync_service, |
| 85 | PrefService* pref_service); |
Jason Hu | a06a229e | 2024-05-04 01:40:06 | [diff] [blame] | 86 | |
| 87 | } // namespace lens |
| 88 | |
Radu Nitescu | e47d571 | 2024-07-12 10:29:02 | [diff] [blame] | 89 | #endif // COMPONENTS_LENS_LENS_OVERLAY_PERMISSION_UTILS_H_ |