| 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 26 matching lines...) Expand all Loading... |
| 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 | 46 |
| 47 // Deprecated. Use IsElevatedForWebContents() instead. | |
| 48 bool IsElevated() const; | |
| 49 | |
| 50 // Returns the elevation state for specific WebContents. | 47 // Returns the elevation state for specific WebContents. |
| 51 bool IsElevatedForWebContents(const content::WebContents* web_contents) const; | 48 bool IsElevatedForWebContents(const content::WebContents* web_contents) const; |
| 52 | 49 |
| 53 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 50 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
| 54 | 51 |
| 55 // Returns the URL filter for the IO thread, for filtering network requests | 52 // Returns the URL filter for the IO thread, for filtering network requests |
| 56 // (in ManagedModeResourceThrottle). | 53 // (in ManagedModeResourceThrottle). |
| 57 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); | 54 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); |
| 58 | 55 |
| 59 // Returns the URL filter for the UI thread, for filtering navigations and | 56 // Returns the URL filter for the UI thread, for filtering navigations and |
| (...skipping 23 matching lines...) Expand all Loading... |
| 83 ManualBehavior GetManualBehaviorForURL(const GURL& url); | 80 ManualBehavior GetManualBehaviorForURL(const GURL& url); |
| 84 | 81 |
| 85 // Sets the manual behavior for the given URL. | 82 // Sets the manual behavior for the given URL. |
| 86 void SetManualBehaviorForURLs(const std::vector<GURL>& url, | 83 void SetManualBehaviorForURLs(const std::vector<GURL>& url, |
| 87 ManualBehavior behavior); | 84 ManualBehavior behavior); |
| 88 | 85 |
| 89 // Returns all URLS on the given host that have exceptions. | 86 // Returns all URLS on the given host that have exceptions. |
| 90 void GetManualExceptionsForHost(const std::string& host, | 87 void GetManualExceptionsForHost(const std::string& host, |
| 91 std::vector<GURL>* urls); | 88 std::vector<GURL>* urls); |
| 92 | 89 |
| 93 // Deprecated. Use the CanSkipPassphraseDialog() method which requires a | |
| 94 // WebContents parameter instead. | |
| 95 bool CanSkipPassphraseDialog(); | |
| 96 | |
| 97 // Checks if the passphrase dialog can be skipped (the profile is already in | 90 // Checks if the passphrase dialog can be skipped (the profile is already in |
| 98 // elevated state for the given WebContents or the passphrase is empty). | 91 // elevated state for the given WebContents or the passphrase is empty). |
| 99 bool CanSkipPassphraseDialog(const content::WebContents* web_contents) const; | 92 bool CanSkipPassphraseDialog(const content::WebContents* web_contents) const; |
| 100 | 93 |
| 101 // Handles the request to authorize as the custodian of the managed user. | 94 // Handles the request to authorize as the custodian of the managed user. |
| 102 void RequestAuthorization(content::WebContents* web_contents, | 95 void RequestAuthorization(content::WebContents* web_contents, |
| 103 const PassphraseCheckedCallback& callback); | 96 const PassphraseCheckedCallback& callback); |
| 104 | 97 |
| 105 // Handles the request to authorize as the custodian of the managed user. | |
| 106 // Also determines the active web contents to be passed to the passphrase | |
| 107 // dialog. | |
| 108 void RequestAuthorizationUsingActiveWebContents( | |
| 109 Browser* browser, | |
| 110 const PassphraseCheckedCallback& callback); | |
| 111 | |
| 112 // Set the elevation state for the profile. | |
| 113 void SetElevated(bool is_elevated); | |
| 114 | |
| 115 // Add an elevation for a specific extension which allows the managed user to | 98 // Add an elevation for a specific extension which allows the managed user to |
| 116 // install/uninstall this specific extension. | 99 // install/uninstall this specific extension. |
| 117 void AddElevationForExtension(const std::string& extension_id); | 100 void AddElevationForExtension(const std::string& extension_id); |
| 118 | 101 |
| 119 // Remove the elevation for a specific extension. | 102 // Remove the elevation for a specific extension. |
| 120 void RemoveElevationForExtension(const std::string& extension_id); | 103 void RemoveElevationForExtension(const std::string& extension_id); |
| 121 | 104 |
| 122 // Initializes this object. This method does nothing if the profile is not | 105 // Initializes this object. This method does nothing if the profile is not |
| 123 // managed. | 106 // managed. |
| 124 void Init(); | 107 void Init(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // Updates the manual overrides for URLs in the URL filters when the | 172 // Updates the manual overrides for URLs in the URL filters when the |
| 190 // corresponding preference is changed. | 173 // corresponding preference is changed. |
| 191 void UpdateManualURLs(); | 174 void UpdateManualURLs(); |
| 192 | 175 |
| 193 // Returns if the passphrase to authorize as the custodian is empty. | 176 // Returns if the passphrase to authorize as the custodian is empty. |
| 194 bool IsPassphraseEmpty() const; | 177 bool IsPassphraseEmpty() const; |
| 195 | 178 |
| 196 // Owns us via the ProfileKeyedService mechanism. | 179 // Owns us via the ProfileKeyedService mechanism. |
| 197 Profile* profile_; | 180 Profile* profile_; |
| 198 | 181 |
| 199 // If ManagedUserService is in an elevated state, a custodian user has | |
| 200 // authorized making changes (to install additional content packs, for | |
| 201 // example). | |
| 202 bool is_elevated_; | |
| 203 | |
| 204 content::NotificationRegistrar registrar_; | 182 content::NotificationRegistrar registrar_; |
| 205 PrefChangeRegistrar pref_change_registrar_; | 183 PrefChangeRegistrar pref_change_registrar_; |
| 206 | 184 |
| 207 // Stores the extension ids of the extensions which currently can be modified | 185 // Stores the extension ids of the extensions which currently can be modified |
| 208 // by the managed user. | 186 // by the managed user. |
| 209 std::set<std::string> elevated_for_extensions_; | 187 std::set<std::string> elevated_for_extensions_; |
| 210 | 188 |
| 211 URLFilterContext url_filter_context_; | 189 URLFilterContext url_filter_context_; |
| 212 }; | 190 }; |
| 213 | 191 |
| 214 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 192 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
| OLD | NEW |