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 <utility> |
| 8 |
7 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/macros.h" | 11 #include "base/macros.h" |
10 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
11 #include "base/thread_task_runner_handle.h" | 13 #include "base/thread_task_runner_handle.h" |
12 #include "chrome/browser/policy/schema_registry_service.h" | 14 #include "chrome/browser/policy/schema_registry_service.h" |
13 #include "chrome/browser/policy/schema_registry_service_factory.h" | 15 #include "chrome/browser/policy/schema_registry_service_factory.h" |
14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 16 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
15 #include "components/keyed_service/core/keyed_service.h" | 17 #include "components/keyed_service/core/keyed_service.h" |
16 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 18 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 GetPolicyVerificationKey(), | 148 GetPolicyVerificationKey(), |
147 background_task_runner)); | 149 background_task_runner)); |
148 if (force_immediate_load) | 150 if (force_immediate_load) |
149 store->LoadImmediately(); | 151 store->LoadImmediately(); |
150 | 152 |
151 const base::FilePath component_policy_cache_dir = | 153 const base::FilePath component_policy_cache_dir = |
152 context->GetPath().Append(kPolicy).Append(kComponentsDir); | 154 context->GetPath().Append(kPolicy).Append(kComponentsDir); |
153 | 155 |
154 scoped_ptr<UserCloudPolicyManager> manager; | 156 scoped_ptr<UserCloudPolicyManager> manager; |
155 manager.reset(new UserCloudPolicyManager( | 157 manager.reset(new UserCloudPolicyManager( |
156 store.Pass(), | 158 std::move(store), component_policy_cache_dir, |
157 component_policy_cache_dir, | |
158 scoped_ptr<CloudExternalDataManager>(), | 159 scoped_ptr<CloudExternalDataManager>(), |
159 base::ThreadTaskRunnerHandle::Get(), | 160 base::ThreadTaskRunnerHandle::Get(), file_task_runner, io_task_runner)); |
160 file_task_runner, | |
161 io_task_runner)); | |
162 manager->Init( | 161 manager->Init( |
163 SchemaRegistryServiceFactory::GetForContext(context)->registry()); | 162 SchemaRegistryServiceFactory::GetForContext(context)->registry()); |
164 manager_wrappers_[context] = new ManagerWrapper(manager.get()); | 163 manager_wrappers_[context] = new ManagerWrapper(manager.get()); |
165 return manager.Pass(); | 164 return manager; |
166 } | 165 } |
167 | 166 |
168 UserCloudPolicyManager* | 167 UserCloudPolicyManager* |
169 UserCloudPolicyManagerFactory::RegisterManagerForOffTheRecordBrowserContext( | 168 UserCloudPolicyManagerFactory::RegisterManagerForOffTheRecordBrowserContext( |
170 content::BrowserContext* original_context, | 169 content::BrowserContext* original_context, |
171 content::BrowserContext* off_the_record_context) { | 170 content::BrowserContext* off_the_record_context) { |
172 // Register the UserCloudPolicyManager of the original context for the | 171 // Register the UserCloudPolicyManager of the original context for the |
173 // respective incognito context. See also GetManagerForBrowserContext. | 172 // respective incognito context. See also GetManagerForBrowserContext. |
174 UserCloudPolicyManager* manager = | 173 UserCloudPolicyManager* manager = |
175 GetManagerForBrowserContext(original_context); | 174 GetManagerForBrowserContext(original_context); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return testing_factory_ != NULL; | 210 return testing_factory_ != NULL; |
212 } | 211 } |
213 | 212 |
214 void UserCloudPolicyManagerFactory::CreateServiceNow( | 213 void UserCloudPolicyManagerFactory::CreateServiceNow( |
215 content::BrowserContext* context) { | 214 content::BrowserContext* context) { |
216 DCHECK(testing_factory_); | 215 DCHECK(testing_factory_); |
217 manager_wrappers_[context] = new ManagerWrapper(testing_factory_(context)); | 216 manager_wrappers_[context] = new ManagerWrapper(testing_factory_(context)); |
218 } | 217 } |
219 | 218 |
220 } // namespace policy | 219 } // namespace policy |
OLD | NEW |