Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: chrome/browser/managed_mode/managed_user_service.h

Issue 18337013: Update ManagedUserService tests to create the service using ManagedUserServiceFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bauerb@... Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_user_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 public content::NotificationObserver { 44 public content::NotificationObserver {
45 public: 45 public:
46 typedef std::vector<string16> CategoryList; 46 typedef std::vector<string16> CategoryList;
47 47
48 enum ManualBehavior { 48 enum ManualBehavior {
49 MANUAL_NONE = 0, 49 MANUAL_NONE = 0,
50 MANUAL_ALLOW, 50 MANUAL_ALLOW,
51 MANUAL_BLOCK 51 MANUAL_BLOCK
52 }; 52 };
53 53
54 explicit ManagedUserService(Profile* profile);
55 virtual ~ManagedUserService(); 54 virtual ~ManagedUserService();
56 55
57 // ProfileKeyedService override: 56 // ProfileKeyedService override:
58 virtual void Shutdown() OVERRIDE; 57 virtual void Shutdown() OVERRIDE;
59 58
60 bool ProfileIsManaged() const; 59 bool ProfileIsManaged() const;
61 60
62 // Checks whether the given profile is managed without constructing a 61 // Checks whether the given profile is managed without constructing a
63 // ManagedUserService (which could lead to cyclic dependencies). 62 // ManagedUserService (which could lead to cyclic dependencies).
64 static bool ProfileIsManaged(Profile* profile); 63 static bool ProfileIsManaged(Profile* profile);
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // ProfileSyncServiceObserver implementation: 150 // ProfileSyncServiceObserver implementation:
152 virtual void OnStateChanged() OVERRIDE; 151 virtual void OnStateChanged() OVERRIDE;
153 152
154 // content::NotificationObserver implementation: 153 // content::NotificationObserver implementation:
155 virtual void Observe(int type, 154 virtual void Observe(int type,
156 const content::NotificationSource& source, 155 const content::NotificationSource& source,
157 const content::NotificationDetails& details) OVERRIDE; 156 const content::NotificationDetails& details) OVERRIDE;
158 157
159 private: 158 private:
160 friend class ManagedUserServiceExtensionTest; 159 friend class ManagedUserServiceExtensionTest;
160 friend class ManagedUserServiceFactory;
161 161
162 // A bridge from ManagedMode (which lives on the UI thread) to the 162 // A bridge from ManagedMode (which lives on the UI thread) to the
163 // ManagedModeURLFilters, one of which lives on the IO thread. This class 163 // ManagedModeURLFilters, one of which lives on the IO thread. This class
164 // mediates access to them and makes sure they are kept in sync. 164 // mediates access to them and makes sure they are kept in sync.
165 class URLFilterContext { 165 class URLFilterContext {
166 public: 166 public:
167 URLFilterContext(); 167 URLFilterContext();
168 ~URLFilterContext(); 168 ~URLFilterContext();
169 169
170 ManagedModeURLFilter* ui_url_filter() const; 170 ManagedModeURLFilter* ui_url_filter() const;
(...skipping 11 matching lines...) Expand all
182 // network requests), so they both keep a reference to it. 182 // network requests), so they both keep a reference to it.
183 // Clients should not keep references to the UI thread filter, however 183 // Clients should not keep references to the UI thread filter, however
184 // (the filter will live as long as the profile lives, and afterwards it 184 // (the filter will live as long as the profile lives, and afterwards it
185 // should not be used anymore either). 185 // should not be used anymore either).
186 scoped_refptr<ManagedModeURLFilter> ui_url_filter_; 186 scoped_refptr<ManagedModeURLFilter> ui_url_filter_;
187 scoped_refptr<ManagedModeURLFilter> io_url_filter_; 187 scoped_refptr<ManagedModeURLFilter> io_url_filter_;
188 188
189 DISALLOW_COPY_AND_ASSIGN(URLFilterContext); 189 DISALLOW_COPY_AND_ASSIGN(URLFilterContext);
190 }; 190 };
191 191
192 // Use |ManagedUserServiceFactory::GetForProfile(..)| to get
193 // an instance of this service.
194 explicit ManagedUserService(Profile* profile);
195
192 void OnCustodianProfileDownloaded(const string16& full_name); 196 void OnCustodianProfileDownloaded(const string16& full_name);
193 197
194 void OnManagedUserRegistered(const ProfileManager::CreateCallback& callback, 198 void OnManagedUserRegistered(const ProfileManager::CreateCallback& callback,
195 Profile* custodian_profile, 199 Profile* custodian_profile,
196 const GoogleServiceAuthError& auth_error, 200 const GoogleServiceAuthError& auth_error,
197 const std::string& token); 201 const std::string& token);
198 202
199 void SetupSync(); 203 void SetupSync();
200 204
201 // Internal implementation for ExtensionManagementPolicy::Delegate methods. 205 // Internal implementation for ExtensionManagementPolicy::Delegate methods.
(...skipping 27 matching lines...) Expand all
229 233
230 content::NotificationRegistrar registrar_; 234 content::NotificationRegistrar registrar_;
231 PrefChangeRegistrar pref_change_registrar_; 235 PrefChangeRegistrar pref_change_registrar_;
232 236
233 // True iff we're waiting for the Sync service to be initialized. 237 // True iff we're waiting for the Sync service to be initialized.
234 bool waiting_for_sync_initialization_; 238 bool waiting_for_sync_initialization_;
235 239
236 // Sets a profile in elevated state for testing if set to true. 240 // Sets a profile in elevated state for testing if set to true.
237 bool elevated_for_testing_; 241 bool elevated_for_testing_;
238 242
243 // True only when |Shutdown()| method has been called.
244 bool did_shutdown_;
245
239 URLFilterContext url_filter_context_; 246 URLFilterContext url_filter_context_;
240 }; 247 };
241 248
242 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_ 249 #endif // CHROME_BROWSER_MANAGED_MODE_MANAGED_USER_SERVICE_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/managed_mode/managed_user_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698