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 27 matching lines...) Expand all Loading... |
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 bool IsElevated() const; | 46 bool IsElevated() const; |
47 | 47 |
| 48 // Returns the elevation state for specific WebContents. |
| 49 bool IsElevatedForWebContents(const content::WebContents* web_contents) const; |
| 50 |
48 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 51 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
49 | 52 |
50 // Returns the URL filter for the IO thread, for filtering network requests | 53 // Returns the URL filter for the IO thread, for filtering network requests |
51 // (in ManagedModeResourceThrottle). | 54 // (in ManagedModeResourceThrottle). |
52 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); | 55 scoped_refptr<const ManagedModeURLFilter> GetURLFilterForIOThread(); |
53 | 56 |
54 // Returns the URL filter for the UI thread, for filtering navigations and | 57 // Returns the URL filter for the UI thread, for filtering navigations and |
55 // classifying sites in the history view. | 58 // classifying sites in the history view. |
56 ManagedModeURLFilter* GetURLFilterForUIThread(); | 59 ManagedModeURLFilter* GetURLFilterForUIThread(); |
57 | 60 |
(...skipping 20 matching lines...) Expand all Loading... |
78 ManualBehavior GetManualBehaviorForURL(const GURL& url); | 81 ManualBehavior GetManualBehaviorForURL(const GURL& url); |
79 | 82 |
80 // Sets the manual behavior for the given URL. | 83 // Sets the manual behavior for the given URL. |
81 void SetManualBehaviorForURLs(const std::vector<GURL>& url, | 84 void SetManualBehaviorForURLs(const std::vector<GURL>& url, |
82 ManualBehavior behavior); | 85 ManualBehavior behavior); |
83 | 86 |
84 // Checks if the passphrase dialog can be skipped (the profile is already in | 87 // Checks if the passphrase dialog can be skipped (the profile is already in |
85 // elevated state or the passphrase is empty). | 88 // elevated state or the passphrase is empty). |
86 bool CanSkipPassphraseDialog(); | 89 bool CanSkipPassphraseDialog(); |
87 | 90 |
| 91 // Checks if the passphrase dialog can be skipped (the profile is already in |
| 92 // elevated state for the given WebContents or the passphrase is empty). |
| 93 bool CanSkipPassphraseDialog(const content::WebContents* web_contents) const; |
| 94 |
| 95 // Returns if the passphrase to authorize as the custodian is empty. |
| 96 bool IsPassphraseEmpty() const; |
| 97 |
88 // Handles the request to authorize as the custodian of the managed user. | 98 // Handles the request to authorize as the custodian of the managed user. |
89 void RequestAuthorization(content::WebContents* web_contents, | 99 void RequestAuthorization(content::WebContents* web_contents, |
90 const PassphraseCheckedCallback& callback); | 100 const PassphraseCheckedCallback& callback); |
91 | 101 |
92 // Handles the request to authorize as the custodian of the managed user. | 102 // 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 | 103 // Also determines the active web contents to be passed to the passphrase |
94 // dialog. | 104 // dialog. |
95 void RequestAuthorizationUsingActiveWebContents( | 105 void RequestAuthorizationUsingActiveWebContents( |
96 Browser* browser, | 106 Browser* browser, |
97 const PassphraseCheckedCallback& callback); | 107 const PassphraseCheckedCallback& callback); |
98 | 108 |
| 109 // Set the elevation state for the profile. |
99 void SetElevated(bool is_elevated); | 110 void SetElevated(bool is_elevated); |
100 | 111 |
101 // Add an elevation for a specific extension which allows the managed user to | 112 // Add an elevation for a specific extension which allows the managed user to |
102 // install/uninstall this specific extension. | 113 // install/uninstall this specific extension. |
103 void AddElevationForExtension(const std::string& extension_id); | 114 void AddElevationForExtension(const std::string& extension_id); |
104 | 115 |
105 // Remove the elevation for a specific extension. | 116 // Remove the elevation for a specific extension. |
106 void RemoveElevationForExtension(const std::string& extension_id); | 117 void RemoveElevationForExtension(const std::string& extension_id); |
107 | 118 |
108 // Initializes this object. This method does nothing if the profile is not | 119 // 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_; | 199 PrefChangeRegistrar pref_change_registrar_; |
189 | 200 |
190 // Stores the extension ids of the extensions which currently can be modified | 201 // Stores the extension ids of the extensions which currently can be modified |
191 // by the managed user. | 202 // by the managed user. |
192 std::set<std::string> elevated_for_extensions_; | 203 std::set<std::string> elevated_for_extensions_; |
193 | 204 |
194 URLFilterContext url_filter_context_; | 205 URLFilterContext url_filter_context_; |
195 }; | 206 }; |
196 | 207 |
197 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 208 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
OLD | NEW |