Chromium Code Reviews| 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; |
| 96 | |
| 97 // Returns if the passphrase to authorize as the custodian is empty. | |
| 98 bool IsPassphraseEmpty() const; | |
|
Bernhard Bauer
2013/03/21 15:52:58
Where do we need this method?
Adrian Kuegel
2013/03/21 16:30:04
In CanSkipPassphraseDialog. But I guess we can mak
| |
| 87 | 99 |
| 88 // Handles the request to authorize as the custodian of the managed user. | 100 // Handles the request to authorize as the custodian of the managed user. |
| 89 void RequestAuthorization(content::WebContents* web_contents, | 101 void RequestAuthorization(content::WebContents* web_contents, |
| 90 const PassphraseCheckedCallback& callback); | 102 const PassphraseCheckedCallback& callback); |
| 91 | 103 |
| 92 // Handles the request to authorize as the custodian of the managed user. | 104 // 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 | 105 // Also determines the active web contents to be passed to the passphrase |
| 94 // dialog. | 106 // dialog. |
| 95 void RequestAuthorizationUsingActiveWebContents( | 107 void RequestAuthorizationUsingActiveWebContents( |
| 96 Browser* browser, | 108 Browser* browser, |
| 97 const PassphraseCheckedCallback& callback); | 109 const PassphraseCheckedCallback& callback); |
| 98 | 110 |
| 111 // Set the elevation state for the profile. | |
| 99 void SetElevated(bool is_elevated); | 112 void SetElevated(bool is_elevated); |
| 100 | 113 |
| 101 // Add an elevation for a specific extension which allows the managed user to | 114 // Add an elevation for a specific extension which allows the managed user to |
| 102 // install/uninstall this specific extension. | 115 // install/uninstall this specific extension. |
| 103 void AddElevationForExtension(const std::string& extension_id); | 116 void AddElevationForExtension(const std::string& extension_id); |
| 104 | 117 |
| 105 // Remove the elevation for a specific extension. | 118 // Remove the elevation for a specific extension. |
| 106 void RemoveElevationForExtension(const std::string& extension_id); | 119 void RemoveElevationForExtension(const std::string& extension_id); |
| 107 | 120 |
| 108 // Initializes this object. This method does nothing if the profile is not | 121 // Initializes this object. This method does nothing if the profile is not |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |