OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 5 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 8 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
9 #include "chrome/browser/policy/cloud/user_cloud_policy_store.h" | 9 #include "chrome/browser/policy/cloud/user_cloud_policy_store.h" |
| 10 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/profiles/profile_dependency_manager.h" | 11 #include "chrome/browser/profiles/profile_dependency_manager.h" |
11 | 12 |
12 namespace policy { | 13 namespace policy { |
13 | 14 |
14 // static | 15 // static |
15 UserCloudPolicyManagerFactory* UserCloudPolicyManagerFactory::GetInstance() { | 16 UserCloudPolicyManagerFactory* UserCloudPolicyManagerFactory::GetInstance() { |
16 return Singleton<UserCloudPolicyManagerFactory>::get(); | 17 return Singleton<UserCloudPolicyManagerFactory>::get(); |
17 } | 18 } |
18 | 19 |
19 // static | 20 // static |
(...skipping 26 matching lines...) Expand all Loading... |
46 Profile* profile, | 47 Profile* profile, |
47 bool force_immediate_load) { | 48 bool force_immediate_load) { |
48 scoped_ptr<policy::UserCloudPolicyStore> store( | 49 scoped_ptr<policy::UserCloudPolicyStore> store( |
49 policy::UserCloudPolicyStore::Create(profile)); | 50 policy::UserCloudPolicyStore::Create(profile)); |
50 if (force_immediate_load) | 51 if (force_immediate_load) |
51 store->LoadImmediately(); | 52 store->LoadImmediately(); |
52 return make_scoped_ptr( | 53 return make_scoped_ptr( |
53 new policy::UserCloudPolicyManager(profile, store.Pass())); | 54 new policy::UserCloudPolicyManager(profile, store.Pass())); |
54 } | 55 } |
55 | 56 |
56 void UserCloudPolicyManagerFactory::ProfileShutdown(Profile* profile) { | 57 void UserCloudPolicyManagerFactory::ProfileShutdown( |
57 UserCloudPolicyManager* manager = GetManagerForProfile(profile); | 58 content::BrowserContext* profile) { |
| 59 UserCloudPolicyManager* manager = |
| 60 GetManagerForProfile(static_cast<Profile*>(profile)); |
58 if (manager) | 61 if (manager) |
59 manager->Shutdown(); | 62 manager->Shutdown(); |
60 } | 63 } |
61 | 64 |
62 void UserCloudPolicyManagerFactory::SetEmptyTestingFactory(Profile* profile) {} | 65 void UserCloudPolicyManagerFactory::SetEmptyTestingFactory( |
| 66 content::BrowserContext* profile) { |
| 67 } |
63 | 68 |
64 void UserCloudPolicyManagerFactory::CreateServiceNow(Profile* profile) {} | 69 void UserCloudPolicyManagerFactory::CreateServiceNow( |
| 70 content::BrowserContext* profile) { |
| 71 } |
65 | 72 |
66 void UserCloudPolicyManagerFactory::Register(Profile* profile, | 73 void UserCloudPolicyManagerFactory::Register(Profile* profile, |
67 UserCloudPolicyManager* instance) { | 74 UserCloudPolicyManager* instance) { |
68 UserCloudPolicyManager*& entry = managers_[profile]; | 75 UserCloudPolicyManager*& entry = managers_[profile]; |
69 DCHECK(!entry); | 76 DCHECK(!entry); |
70 entry = instance; | 77 entry = instance; |
71 } | 78 } |
72 | 79 |
73 void UserCloudPolicyManagerFactory::Unregister( | 80 void UserCloudPolicyManagerFactory::Unregister( |
74 Profile* profile, | 81 Profile* profile, |
75 UserCloudPolicyManager* instance) { | 82 UserCloudPolicyManager* instance) { |
76 ManagerMap::iterator entry = managers_.find(profile); | 83 ManagerMap::iterator entry = managers_.find(profile); |
77 if (entry != managers_.end()) { | 84 if (entry != managers_.end()) { |
78 DCHECK_EQ(instance, entry->second); | 85 DCHECK_EQ(instance, entry->second); |
79 managers_.erase(entry); | 86 managers_.erase(entry); |
80 } else { | 87 } else { |
81 NOTREACHED(); | 88 NOTREACHED(); |
82 } | 89 } |
83 } | 90 } |
84 | 91 |
85 } // namespace policy | 92 } // namespace policy |
OLD | NEW |