| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 bool force_immediate_load, | 136 bool force_immediate_load, |
| 137 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, | 137 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, |
| 138 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, | 138 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, |
| 139 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { | 139 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) { |
| 140 DCHECK(!context->IsOffTheRecord()); | 140 DCHECK(!context->IsOffTheRecord()); |
| 141 | 141 |
| 142 // This should never be called if we're using a testing factory. | 142 // This should never be called if we're using a testing factory. |
| 143 // Instead, instances are instantiated via CreateServiceNow(). | 143 // Instead, instances are instantiated via CreateServiceNow(). |
| 144 DCHECK(!testing_factory_); | 144 DCHECK(!testing_factory_); |
| 145 | 145 |
| 146 std::unique_ptr<UserCloudPolicyStore> store(UserCloudPolicyStore::Create( | 146 std::unique_ptr<UserCloudPolicyStore> store( |
| 147 context->GetPath(), GetPolicyVerificationKey(), background_task_runner)); | 147 UserCloudPolicyStore::Create(context->GetPath(), background_task_runner)); |
| 148 if (force_immediate_load) | 148 if (force_immediate_load) |
| 149 store->LoadImmediately(); | 149 store->LoadImmediately(); |
| 150 | 150 |
| 151 const base::FilePath component_policy_cache_dir = | 151 const base::FilePath component_policy_cache_dir = |
| 152 context->GetPath().Append(kPolicy).Append(kComponentsDir); | 152 context->GetPath().Append(kPolicy).Append(kComponentsDir); |
| 153 | 153 |
| 154 std::unique_ptr<UserCloudPolicyManager> manager; | 154 std::unique_ptr<UserCloudPolicyManager> manager; |
| 155 manager.reset(new UserCloudPolicyManager( | 155 manager.reset(new UserCloudPolicyManager( |
| 156 std::move(store), component_policy_cache_dir, | 156 std::move(store), component_policy_cache_dir, |
| 157 std::unique_ptr<CloudExternalDataManager>(), | 157 std::unique_ptr<CloudExternalDataManager>(), |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 return testing_factory_ != NULL; | 208 return testing_factory_ != NULL; |
| 209 } | 209 } |
| 210 | 210 |
| 211 void UserCloudPolicyManagerFactory::CreateServiceNow( | 211 void UserCloudPolicyManagerFactory::CreateServiceNow( |
| 212 content::BrowserContext* context) { | 212 content::BrowserContext* context) { |
| 213 DCHECK(testing_factory_); | 213 DCHECK(testing_factory_); |
| 214 manager_wrappers_[context] = new ManagerWrapper(testing_factory_(context)); | 214 manager_wrappers_[context] = new ManagerWrapper(testing_factory_(context)); |
| 215 } | 215 } |
| 216 | 216 |
| 217 } // namespace policy | 217 } // namespace policy |
| OLD | NEW |