| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | 11 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 14 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chromeos/login/user.h" | 17 #include "chrome/browser/chromeos/login/user.h" |
| 18 #include "chrome/browser/chromeos/login/user_manager.h" | 18 #include "chrome/browser/chromeos/login/user_manager.h" |
| 19 #include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h" | 19 #include "chrome/browser/chromeos/policy/user_cloud_external_data_manager.h" |
| 20 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 21 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" | 21 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
| 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 23 #include "chrome/browser/policy/browser_policy_connector.h" | 23 #include "chrome/browser/policy/browser_policy_connector.h" |
| 24 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h" | 24 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h" |
| 25 #include "chrome/browser/policy/cloud/device_management_service.h" | 25 #include "chrome/browser/policy/cloud/device_management_service.h" |
| 26 #include "chrome/browser/policy/cloud/resource_cache.h" | 26 #include "chrome/browser/policy/cloud/resource_cache.h" |
| 27 #include "chrome/browser/policy/schema_registry_service.h" |
| 28 #include "chrome/browser/policy/schema_registry_service_factory.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 29 #include "chromeos/chromeos_paths.h" | 31 #include "chromeos/chromeos_paths.h" |
| 30 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
| 31 #include "chromeos/dbus/dbus_thread_manager.h" | 33 #include "chromeos/dbus/dbus_thread_manager.h" |
| 32 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 34 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
| 33 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 34 #include "net/url_request/url_request_context_getter.h" | 36 #include "net/url_request/url_request_context_getter.h" |
| 35 #include "policy/policy_constants.h" | 37 #include "policy/policy_constants.h" |
| 36 | 38 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 Profile* profile, | 82 Profile* profile, |
| 81 bool force_immediate_load, | 83 bool force_immediate_load, |
| 82 scoped_refptr<base::SequencedTaskRunner> background_task_runner) { | 84 scoped_refptr<base::SequencedTaskRunner> background_task_runner) { |
| 83 return GetInstance()->CreateManagerForProfile( | 85 return GetInstance()->CreateManagerForProfile( |
| 84 profile, force_immediate_load, background_task_runner); | 86 profile, force_immediate_load, background_task_runner); |
| 85 } | 87 } |
| 86 | 88 |
| 87 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() | 89 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() |
| 88 : BrowserContextKeyedBaseFactory( | 90 : BrowserContextKeyedBaseFactory( |
| 89 "UserCloudPolicyManagerChromeOS", | 91 "UserCloudPolicyManagerChromeOS", |
| 90 BrowserContextDependencyManager::GetInstance()) {} | 92 BrowserContextDependencyManager::GetInstance()) { |
| 93 DependsOn(SchemaRegistryServiceFactory::GetInstance()); |
| 94 } |
| 91 | 95 |
| 92 UserCloudPolicyManagerFactoryChromeOS:: | 96 UserCloudPolicyManagerFactoryChromeOS:: |
| 93 ~UserCloudPolicyManagerFactoryChromeOS() {} | 97 ~UserCloudPolicyManagerFactoryChromeOS() {} |
| 94 | 98 |
| 95 UserCloudPolicyManagerChromeOS* | 99 UserCloudPolicyManagerChromeOS* |
| 96 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( | 100 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( |
| 97 Profile* profile) { | 101 Profile* profile) { |
| 98 // Get the manager for the original profile, since the PolicyService is | 102 // Get the manager for the original profile, since the PolicyService is |
| 99 // also shared between the incognito Profile and the original Profile. | 103 // also shared between the incognito Profile and the original Profile. |
| 100 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); | 104 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 } | 190 } |
| 187 | 191 |
| 188 scoped_ptr<UserCloudPolicyManagerChromeOS> manager( | 192 scoped_ptr<UserCloudPolicyManagerChromeOS> manager( |
| 189 new UserCloudPolicyManagerChromeOS( | 193 new UserCloudPolicyManagerChromeOS( |
| 190 store.PassAs<CloudPolicyStore>(), | 194 store.PassAs<CloudPolicyStore>(), |
| 191 external_data_manager.Pass(), | 195 external_data_manager.Pass(), |
| 192 base::MessageLoopProxy::current(), | 196 base::MessageLoopProxy::current(), |
| 193 resource_cache.Pass(), | 197 resource_cache.Pass(), |
| 194 wait_for_initial_policy, | 198 wait_for_initial_policy, |
| 195 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds))); | 199 base::TimeDelta::FromSeconds(kInitialPolicyFetchTimeoutSeconds))); |
| 196 manager->Init(); | 200 manager->Init(SchemaRegistryServiceFactory::GetForContext(profile)); |
| 197 manager->Connect(g_browser_process->local_state(), | 201 manager->Connect(g_browser_process->local_state(), |
| 198 device_management_service, | 202 device_management_service, |
| 199 g_browser_process->system_request_context(), | 203 g_browser_process->system_request_context(), |
| 200 affiliation); | 204 affiliation); |
| 201 | 205 |
| 202 DCHECK(managers_.find(profile) == managers_.end()); | 206 DCHECK(managers_.find(profile) == managers_.end()); |
| 203 managers_[profile] = manager.get(); | 207 managers_[profile] = manager.get(); |
| 204 return manager.Pass(); | 208 return manager.Pass(); |
| 205 } | 209 } |
| 206 | 210 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 221 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); | 225 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); |
| 222 } | 226 } |
| 223 | 227 |
| 224 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( | 228 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( |
| 225 content::BrowserContext* context) {} | 229 content::BrowserContext* context) {} |
| 226 | 230 |
| 227 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 231 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
| 228 content::BrowserContext* context) {} | 232 content::BrowserContext* context) {} |
| 229 | 233 |
| 230 } // namespace policy | 234 } // namespace policy |
| OLD | NEW |