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 |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/prefs/pref_change_registrar.h" | 12 #include "base/prefs/pref_change_registrar.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "chrome/browser/extensions/management_policy.h" | 14 #include "chrome/browser/extensions/management_policy.h" |
15 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" | 15 #include "chrome/browser/managed_mode/managed_mode_url_filter.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" | 17 #include "components/browser_context_keyed_service/browser_context_keyed_service
.h" |
17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
20 | 21 |
21 class Browser; | 22 class Browser; |
22 class GoogleServiceAuthError; | 23 class GoogleServiceAuthError; |
23 class ManagedModeURLFilter; | 24 class ManagedModeURLFilter; |
24 class ManagedModeSiteList; | 25 class ManagedModeSiteList; |
25 class ManagedUserRegistrationService; | 26 class ManagedUserRegistrationService; |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 115 |
115 // Initializes this profile for syncing, using the provided |token| to | 116 // Initializes this profile for syncing, using the provided |token| to |
116 // authenticate requests. | 117 // authenticate requests. |
117 void InitSync(const std::string& token); | 118 void InitSync(const std::string& token); |
118 | 119 |
119 // Convenience method that registers this managed user with | 120 // Convenience method that registers this managed user with |
120 // |registration_service| and initializes sync with the returned token. | 121 // |registration_service| and initializes sync with the returned token. |
121 // Note that |registration_service| should belong to the custodian's profile, | 122 // Note that |registration_service| should belong to the custodian's profile, |
122 // not this one. | 123 // not this one. |
123 void RegisterAndInitSync( | 124 void RegisterAndInitSync( |
124 ManagedUserRegistrationService* registration_service); | 125 ManagedUserRegistrationService* registration_service, |
| 126 const ProfileManager::CreateCallback& callback); |
125 | 127 |
126 // Returns a pseudo-email address for systems that expect well-formed email | 128 // Returns a pseudo-email address for systems that expect well-formed email |
127 // addresses (like Sync), even though we're not signed in. | 129 // addresses (like Sync), even though we're not signed in. |
128 static const char* GetManagedUserPseudoEmail(); | 130 static const char* GetManagedUserPseudoEmail(); |
129 | 131 |
130 void set_elevated_for_testing(bool skip) { | 132 void set_elevated_for_testing(bool skip) { |
131 elevated_for_testing_ = skip; | 133 elevated_for_testing_ = skip; |
132 } | 134 } |
133 | 135 |
134 // extensions::ManagementPolicy::Provider implementation: | 136 // extensions::ManagementPolicy::Provider implementation: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 // network requests), so they both keep a reference to it. | 171 // network requests), so they both keep a reference to it. |
170 // Clients should not keep references to the UI thread filter, however | 172 // Clients should not keep references to the UI thread filter, however |
171 // (the filter will live as long as the profile lives, and afterwards it | 173 // (the filter will live as long as the profile lives, and afterwards it |
172 // should not be used anymore either). | 174 // should not be used anymore either). |
173 scoped_refptr<ManagedModeURLFilter> ui_url_filter_; | 175 scoped_refptr<ManagedModeURLFilter> ui_url_filter_; |
174 scoped_refptr<ManagedModeURLFilter> io_url_filter_; | 176 scoped_refptr<ManagedModeURLFilter> io_url_filter_; |
175 | 177 |
176 DISALLOW_COPY_AND_ASSIGN(URLFilterContext); | 178 DISALLOW_COPY_AND_ASSIGN(URLFilterContext); |
177 }; | 179 }; |
178 | 180 |
179 void OnManagedUserRegistered(const GoogleServiceAuthError& auth_error, | 181 void OnManagedUserRegistered(const ProfileManager::CreateCallback& callback, |
| 182 const GoogleServiceAuthError& auth_error, |
180 const std::string& token); | 183 const std::string& token); |
181 | 184 |
182 // Internal implementation for ExtensionManagementPolicy::Delegate methods. | 185 // Internal implementation for ExtensionManagementPolicy::Delegate methods. |
183 // If |error| is not NULL, it will be filled with an error message if the | 186 // If |error| is not NULL, it will be filled with an error message if the |
184 // requested extension action (install, modify status, etc.) is not permitted. | 187 // requested extension action (install, modify status, etc.) is not permitted. |
185 bool ExtensionManagementPolicyImpl(const std::string& extension_id, | 188 bool ExtensionManagementPolicyImpl(const std::string& extension_id, |
186 string16* error) const; | 189 string16* error) const; |
187 | 190 |
188 // Returns a list of all installed and enabled site lists in the current | 191 // Returns a list of all installed and enabled site lists in the current |
189 // managed profile. | 192 // managed profile. |
(...skipping 19 matching lines...) Expand all Loading... |
209 content::NotificationRegistrar registrar_; | 212 content::NotificationRegistrar registrar_; |
210 PrefChangeRegistrar pref_change_registrar_; | 213 PrefChangeRegistrar pref_change_registrar_; |
211 | 214 |
212 // Sets a profile in elevated state for testing if set to true. | 215 // Sets a profile in elevated state for testing if set to true. |
213 bool elevated_for_testing_; | 216 bool elevated_for_testing_; |
214 | 217 |
215 URLFilterContext url_filter_context_; | 218 URLFilterContext url_filter_context_; |
216 }; | 219 }; |
217 | 220 |
218 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ | 221 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ |
OLD | NEW |