| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
| 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 6 #define CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 enum ManualBehavior { | 36 enum ManualBehavior { |
| 37 MANUAL_NONE = 0, | 37 MANUAL_NONE = 0, |
| 38 MANUAL_ALLOW, | 38 MANUAL_ALLOW, |
| 39 MANUAL_BLOCK | 39 MANUAL_BLOCK |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 explicit ManagedUserService(Profile* profile); | 42 explicit ManagedUserService(Profile* profile); |
| 43 virtual ~ManagedUserService(); | 43 virtual ~ManagedUserService(); |
| 44 | 44 |
| 45 bool ProfileIsManaged() const; | 45 bool ProfileIsManaged() const; |
| 46 |
| 47 // Deprecated. Use IsElevatedForWebContents() instead. |
| 46 bool IsElevated() const; | 48 bool IsElevated() const; |
| 47 | 49 |
| 50 // Returns the elevation state for specific WebContents. |
| 51 bool IsElevatedForWebContents(const content::WebContents* web_contents) const; |
| 52 |
| 48 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 53 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
| 49 | 54 |
| 50 // Returns the URL filter for the IO thread, for filtering network requests | 55 // Returns the URL filter for the IO thread, for filtering network requests |
| 51 // (in ManagedModeResourceThrottle). | 56 // (in ManagedModeResourceThrottle). |
| 52 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); | 57 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); |
| 53 | 58 |
| 54 // Returns the URL filter for the UI thread, for filtering navigations and | 59 // Returns the URL filter for the UI thread, for filtering navigations and |
| 55 // classifying sites in the history view. | 60 // classifying sites in the history view. |
| 56 ManagedModeURLFilter* GetURLFilterForUIThread(); | 61 ManagedModeURLFilter* GetURLFilterForUIThread(); |
| 57 | 62 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 74 void SetManualBehaviorForHosts(const std::vector<std::string>& hostnames, | 79 void SetManualBehaviorForHosts(const std::vector<std::string>& hostnames, |
| 75 ManualBehavior behavior); | 80 ManualBehavior behavior); |
| 76 | 81 |
| 77 // Returns the manual behavior for the given URL. | 82 // Returns the manual behavior for the given URL. |
| 78 ManualBehavior GetManualBehaviorForURL(const GURL& url); | 83 ManualBehavior GetManualBehaviorForURL(const GURL& url); |
| 79 | 84 |
| 80 // Sets the manual behavior for the given URL. | 85 // Sets the manual behavior for the given URL. |
| 81 void SetManualBehaviorForURLs(const std::vector<GURL>& url, | 86 void SetManualBehaviorForURLs(const std::vector<GURL>& url, |
| 82 ManualBehavior behavior); | 87 ManualBehavior behavior); |
| 83 | 88 |
| 89 // Deprecated. Use the CanSkipPassphraseDialog() method which requires a |
| 90 // WebContents parameter instead. |
| 91 bool CanSkipPassphraseDialog(); |
| 92 |
| 84 // Checks if the passphrase dialog can be skipped (the profile is already in | 93 // Checks if the passphrase dialog can be skipped (the profile is already in |
| 85 // elevated state or the passphrase is empty). | 94 // elevated state for the given WebContents or the passphrase is empty). |
| 86 bool CanSkipPassphraseDialog(); | 95 bool CanSkipPassphraseDialog(const content::WebContents* web_contents) const; |
| 87 | 96 |
| 88 // Handles the request to authorize as the custodian of the managed user. | 97 // Handles the request to authorize as the custodian of the managed user. |
| 89 void RequestAuthorization(content::WebContents* web_contents, | 98 void RequestAuthorization(content::WebContents* web_contents, |
| 90 const PassphraseCheckedCallback& callback); | 99 const PassphraseCheckedCallback& callback); |
| 91 | 100 |
| 92 // Handles the request to authorize as the custodian of the managed user. | 101 // Handles the request to authorize as the custodian of the managed user. |
| 93 // Also determines the active web contents to be passed to the passphrase | 102 // Also determines the active web contents to be passed to the passphrase |
| 94 // dialog. | 103 // dialog. |
| 95 void RequestAuthorizationUsingActiveWebContents( | 104 void RequestAuthorizationUsingActiveWebContents( |
| 96 Browser* browser, | 105 Browser* browser, |
| 97 const PassphraseCheckedCallback& callback); | 106 const PassphraseCheckedCallback& callback); |
| 98 | 107 |
| 108 // Set the elevation state for the profile. |
| 99 void SetElevated(bool is_elevated); | 109 void SetElevated(bool is_elevated); |
| 100 | 110 |
| 101 // Add an elevation for a specific extension which allows the managed user to | 111 // Add an elevation for a specific extension which allows the managed user to |
| 102 // install/uninstall this specific extension. | 112 // install/uninstall this specific extension. |
| 103 void AddElevationForExtension(const std::string& extension_id); | 113 void AddElevationForExtension(const std::string& extension_id); |
| 104 | 114 |
| 105 // Remove the elevation for a specific extension. | 115 // Remove the elevation for a specific extension. |
| 106 void RemoveElevationForExtension(const std::string& extension_id); | 116 void RemoveElevationForExtension(const std::string& extension_id); |
| 107 | 117 |
| 108 // Initializes this object. This method does nothing if the profile is not | 118 // Initializes this object. This method does nothing if the profile is not |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 void UpdateSiteLists(); | 179 void UpdateSiteLists(); |
| 170 | 180 |
| 171 // Updates the manual overrides for hosts in the URL filters when the | 181 // Updates the manual overrides for hosts in the URL filters when the |
| 172 // corresponding preference is changed. | 182 // corresponding preference is changed. |
| 173 void UpdateManualHosts(); | 183 void UpdateManualHosts(); |
| 174 | 184 |
| 175 // Updates the manual overrides for URLs in the URL filters when the | 185 // Updates the manual overrides for URLs in the URL filters when the |
| 176 // corresponding preference is changed. | 186 // corresponding preference is changed. |
| 177 void UpdateManualURLs(); | 187 void UpdateManualURLs(); |
| 178 | 188 |
| 189 // Returns if the passphrase to authorize as the custodian is empty. |
| 190 bool IsPassphraseEmpty() const; |
| 191 |
| 179 // Owns us via the ProfileKeyedService mechanism. | 192 // Owns us via the ProfileKeyedService mechanism. |
| 180 Profile* profile_; | 193 Profile* profile_; |
| 181 | 194 |
| 182 // If ManagedUserService is in an elevated state, a custodian user has | 195 // If ManagedUserService is in an elevated state, a custodian user has |
| 183 // authorized making changes (to install additional content packs, for | 196 // authorized making changes (to install additional content packs, for |
| 184 // example). | 197 // example). |
| 185 bool is_elevated_; | 198 bool is_elevated_; |
| 186 | 199 |
| 187 content::NotificationRegistrar registrar_; | 200 content::NotificationRegistrar registrar_; |
| 188 PrefChangeRegistrar pref_change_registrar_; | 201 PrefChangeRegistrar pref_change_registrar_; |
| 189 | 202 |
| 190 // Stores the extension ids of the extensions which currently can be modified | 203 // Stores the extension ids of the extensions which currently can be modified |
| 191 // by the managed user. | 204 // by the managed user. |
| 192 std::set<std::string> elevated_for_extensions_; | 205 std::set<std::string> elevated_for_extensions_; |
| 193 | 206 |
| 194 URLFilterContext url_filter_context_; | 207 URLFilterContext url_filter_context_; |
| 195 }; | 208 }; |
| 196 | 209 |
| 197 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 210 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
| OLD | NEW |