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

Side by Side Diff: chrome/browser/policy/user_cloud_policy_manager_factory.cc

Issue 11415094: Split UserCloudPolicyManager implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebae Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/policy/user_cloud_policy_manager_factory.h"
6
7 #include "base/logging.h"
8 #include "chrome/browser/policy/user_cloud_policy_manager.h"
9 #include "chrome/browser/profiles/profile_dependency_manager.h"
10
11 namespace policy {
12
13 // static
14 UserCloudPolicyManagerFactory* UserCloudPolicyManagerFactory::GetInstance() {
15 return Singleton<UserCloudPolicyManagerFactory>::get();
16 }
17
18 // static
19 UserCloudPolicyManager* UserCloudPolicyManagerFactory::GetForProfile(
20 Profile* profile) {
21 return GetInstance()->GetManagerForProfile(profile);
22 }
23
24 UserCloudPolicyManagerFactory::UserCloudPolicyManagerFactory()
25 : ProfileKeyedBaseFactory("UserCloudPolicyManager",
26 ProfileDependencyManager::GetInstance()) {}
27
28 UserCloudPolicyManagerFactory::~UserCloudPolicyManagerFactory() {}
29
30 UserCloudPolicyManager* UserCloudPolicyManagerFactory::GetManagerForProfile(
31 Profile* profile) {
32 ManagerMap::const_iterator it = managers_.find(profile);
33 return it != managers_.end() ? it->second : NULL;
34 }
35
36 void UserCloudPolicyManagerFactory::ProfileShutdown(Profile* profile) {
37 UserCloudPolicyManager* manager = GetManagerForProfile(profile);
38 if (manager)
39 manager->Shutdown();
40 }
41
42 void UserCloudPolicyManagerFactory::SetEmptyTestingFactory(Profile* profile) {}
43
44 void UserCloudPolicyManagerFactory::CreateServiceNow(Profile* profile) {}
45
46 void UserCloudPolicyManagerFactory::Register(Profile* profile,
47 UserCloudPolicyManager* instance) {
48 UserCloudPolicyManager*& entry = managers_[profile];
49 DCHECK(!entry);
50 entry = instance;
51 }
52
53 void UserCloudPolicyManagerFactory::Unregister(
54 Profile* profile,
55 UserCloudPolicyManager* instance) {
56 ManagerMap::iterator entry = managers_.find(profile);
57 if (entry != managers_.end()) {
58 DCHECK_EQ(instance, entry->second);
59 managers_.erase(entry);
60 } else {
61 NOTREACHED();
62 }
63 }
64
65 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698