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 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // static | 60 // static |
61 scoped_ptr<UserCloudPolicyManagerChromeOS> | 61 scoped_ptr<UserCloudPolicyManagerChromeOS> |
62 UserCloudPolicyManagerFactoryChromeOS::CreateForProfile( | 62 UserCloudPolicyManagerFactoryChromeOS::CreateForProfile( |
63 Profile* profile, | 63 Profile* profile, |
64 bool force_immediate_load) { | 64 bool force_immediate_load) { |
65 return GetInstance()->CreateManagerForProfile(profile, force_immediate_load); | 65 return GetInstance()->CreateManagerForProfile(profile, force_immediate_load); |
66 } | 66 } |
67 | 67 |
68 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() | 68 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() |
69 : ProfileKeyedBaseFactory("UserCloudPolicyManagerChromeOS", | 69 : BrowserContextKeyedBaseFactory( |
70 ProfileDependencyManager::GetInstance()) {} | 70 "UserCloudPolicyManagerChromeOS", |
| 71 BrowserContextDependencyManager::GetInstance()) {} |
71 | 72 |
72 UserCloudPolicyManagerFactoryChromeOS:: | 73 UserCloudPolicyManagerFactoryChromeOS:: |
73 ~UserCloudPolicyManagerFactoryChromeOS() {} | 74 ~UserCloudPolicyManagerFactoryChromeOS() {} |
74 | 75 |
75 UserCloudPolicyManagerChromeOS* | 76 UserCloudPolicyManagerChromeOS* |
76 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( | 77 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( |
77 Profile* profile) { | 78 Profile* profile) { |
78 // Get the manager for the original profile, since the PolicyService is | 79 // Get the manager for the original profile, since the PolicyService is |
79 // also shared between the incognito Profile and the original Profile. | 80 // also shared between the incognito Profile and the original Profile. |
80 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); | 81 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 manager->Connect(g_browser_process->local_state(), | 150 manager->Connect(g_browser_process->local_state(), |
150 device_management_service, | 151 device_management_service, |
151 g_browser_process->system_request_context(), | 152 g_browser_process->system_request_context(), |
152 affiliation); | 153 affiliation); |
153 | 154 |
154 DCHECK(managers_.find(profile) == managers_.end()); | 155 DCHECK(managers_.find(profile) == managers_.end()); |
155 managers_[profile] = manager.get(); | 156 managers_[profile] = manager.get(); |
156 return manager.Pass(); | 157 return manager.Pass(); |
157 } | 158 } |
158 | 159 |
159 void UserCloudPolicyManagerFactoryChromeOS::ProfileShutdown( | 160 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextShutdown( |
160 content::BrowserContext* context) { | 161 content::BrowserContext* context) { |
161 Profile* profile = static_cast<Profile*>(context); | 162 Profile* profile = static_cast<Profile*>(context); |
162 if (profile->IsOffTheRecord()) | 163 if (profile->IsOffTheRecord()) |
163 return; | 164 return; |
164 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); | 165 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); |
165 if (manager) | 166 if (manager) |
166 manager->Shutdown(); | 167 manager->Shutdown(); |
167 } | 168 } |
168 | 169 |
169 void UserCloudPolicyManagerFactoryChromeOS::ProfileDestroyed( | 170 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextDestroyed( |
170 content::BrowserContext* context) { | 171 content::BrowserContext* context) { |
171 Profile* profile = static_cast<Profile*>(context); | 172 Profile* profile = static_cast<Profile*>(context); |
172 managers_.erase(profile); | 173 managers_.erase(profile); |
173 ProfileKeyedBaseFactory::ProfileDestroyed(context); | 174 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); |
174 } | 175 } |
175 | 176 |
176 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( | 177 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( |
177 content::BrowserContext* context) {} | 178 content::BrowserContext* context) {} |
178 | 179 |
179 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 180 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
180 content::BrowserContext* context) {} | 181 content::BrowserContext* context) {} |
181 | 182 |
182 } // namespace policy | 183 } // namespace policy |
OLD | NEW |