| 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("UserCloudPolicyManagerChromeOS", |
| 70 ProfileDependencyManager::GetInstance()) {} | 70 BrowserContextDependencyManager::GetInstance()) {} |
| 71 | 71 |
| 72 UserCloudPolicyManagerFactoryChromeOS:: | 72 UserCloudPolicyManagerFactoryChromeOS:: |
| 73 ~UserCloudPolicyManagerFactoryChromeOS() {} | 73 ~UserCloudPolicyManagerFactoryChromeOS() {} |
| 74 | 74 |
| 75 UserCloudPolicyManagerChromeOS* | 75 UserCloudPolicyManagerChromeOS* |
| 76 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( | 76 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( |
| 77 Profile* profile) { | 77 Profile* profile) { |
| 78 // Get the manager for the original profile, since the PolicyService is | 78 // Get the manager for the original profile, since the PolicyService is |
| 79 // also shared between the incognito Profile and the original Profile. | 79 // also shared between the incognito Profile and the original Profile. |
| 80 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); | 80 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(), | 149 manager->Connect(g_browser_process->local_state(), |
| 150 device_management_service, | 150 device_management_service, |
| 151 g_browser_process->system_request_context(), | 151 g_browser_process->system_request_context(), |
| 152 affiliation); | 152 affiliation); |
| 153 | 153 |
| 154 DCHECK(managers_.find(profile) == managers_.end()); | 154 DCHECK(managers_.find(profile) == managers_.end()); |
| 155 managers_[profile] = manager.get(); | 155 managers_[profile] = manager.get(); |
| 156 return manager.Pass(); | 156 return manager.Pass(); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void UserCloudPolicyManagerFactoryChromeOS::ProfileShutdown( | 159 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextShutdown( |
| 160 content::BrowserContext* context) { | 160 content::BrowserContext* context) { |
| 161 Profile* profile = static_cast<Profile*>(context); | 161 Profile* profile = static_cast<Profile*>(context); |
| 162 if (profile->IsOffTheRecord()) | 162 if (profile->IsOffTheRecord()) |
| 163 return; | 163 return; |
| 164 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); | 164 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); |
| 165 if (manager) | 165 if (manager) |
| 166 manager->Shutdown(); | 166 manager->Shutdown(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void UserCloudPolicyManagerFactoryChromeOS::ProfileDestroyed( | 169 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextDestroyed( |
| 170 content::BrowserContext* context) { | 170 content::BrowserContext* context) { |
| 171 Profile* profile = static_cast<Profile*>(context); | 171 Profile* profile = static_cast<Profile*>(context); |
| 172 managers_.erase(profile); | 172 managers_.erase(profile); |
| 173 ProfileKeyedBaseFactory::ProfileDestroyed(context); | 173 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( | 176 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( |
| 177 content::BrowserContext* context) {} | 177 content::BrowserContext* context) {} |
| 178 | 178 |
| 179 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 179 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
| 180 content::BrowserContext* context) {} | 180 content::BrowserContext* context) {} |
| 181 | 181 |
| 182 } // namespace policy | 182 } // namespace policy |
| OLD | NEW |