Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(289)

Side by Side Diff: chrome/browser/policy/cloud/user_cloud_policy_manager_factory.cc

Issue 2813423002: Revert of Don't set a default value for the NTPContentSuggestionsEnabled policy if ChromeHome is enabled (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/policy/core/common/cloud/user_cloud_policy_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ptr_util.h"
13 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
14 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
15 #include "chrome/browser/policy/schema_registry_service.h" 14 #include "chrome/browser/policy/schema_registry_service.h"
16 #include "chrome/browser/policy/schema_registry_service_factory.h" 15 #include "chrome/browser/policy/schema_registry_service_factory.h"
17 #include "components/keyed_service/content/browser_context_dependency_manager.h" 16 #include "components/keyed_service/content/browser_context_dependency_manager.h"
18 #include "components/keyed_service/core/keyed_service.h" 17 #include "components/keyed_service/core/keyed_service.h"
19 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" 18 #include "components/policy/core/common/cloud/cloud_external_data_manager.h"
20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 19 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
21 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" 20 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h"
22 #include "components/policy/core/common/cloud/user_cloud_policy_store.h" 21 #include "components/policy/core/common/cloud/user_cloud_policy_store.h"
23 #include "content/public/browser/browser_context.h" 22 #include "content/public/browser/browser_context.h"
24 23
25 #if defined(OS_ANDROID)
26 #include "chrome/browser/android/chrome_feature_list.h"
27 #endif
28
29 namespace policy { 24 namespace policy {
30 25
31 namespace { 26 namespace {
32 27
33 // Directory inside the profile directory where policy-related resources are 28 // Directory inside the profile directory where policy-related resources are
34 // stored. 29 // stored.
35 const base::FilePath::CharType kPolicy[] = FILE_PATH_LITERAL("Policy"); 30 const base::FilePath::CharType kPolicy[] = FILE_PATH_LITERAL("Policy");
36 31
37 // Directory under kPolicy, in the user's profile dir, where policy for 32 // Directory under kPolicy, in the user's profile dir, where policy for
38 // components is cached. 33 // components is cached.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 DCHECK(!testing_factory_); 144 DCHECK(!testing_factory_);
150 145
151 std::unique_ptr<UserCloudPolicyStore> store( 146 std::unique_ptr<UserCloudPolicyStore> store(
152 UserCloudPolicyStore::Create(context->GetPath(), background_task_runner)); 147 UserCloudPolicyStore::Create(context->GetPath(), background_task_runner));
153 if (force_immediate_load) 148 if (force_immediate_load)
154 store->LoadImmediately(); 149 store->LoadImmediately();
155 150
156 const base::FilePath component_policy_cache_dir = 151 const base::FilePath component_policy_cache_dir =
157 context->GetPath().Append(kPolicy).Append(kComponentsDir); 152 context->GetPath().Append(kPolicy).Append(kComponentsDir);
158 153
159 auto manager = base::MakeUnique<UserCloudPolicyManager>( 154 std::unique_ptr<UserCloudPolicyManager> manager;
155 manager.reset(new UserCloudPolicyManager(
160 std::move(store), component_policy_cache_dir, 156 std::move(store), component_policy_cache_dir,
161 std::unique_ptr<CloudExternalDataManager>(), 157 std::unique_ptr<CloudExternalDataManager>(),
162 base::ThreadTaskRunnerHandle::Get(), file_task_runner, io_task_runner); 158 base::ThreadTaskRunnerHandle::Get(), file_task_runner, io_task_runner));
163
164 #if defined(OS_ANDROID)
165 // TODO(treib): Remove this again. crbug.com/708191
166 if (base::FeatureList::IsEnabled(chrome::android::kChromeHomeFeature))
167 manager->SetChromeHomeEnabled();
168 #endif
169 manager->Init( 159 manager->Init(
170 SchemaRegistryServiceFactory::GetForContext(context)->registry()); 160 SchemaRegistryServiceFactory::GetForContext(context)->registry());
171 manager_wrappers_[context] = new ManagerWrapper(manager.get()); 161 manager_wrappers_[context] = new ManagerWrapper(manager.get());
172 return manager; 162 return manager;
173 } 163 }
174 164
175 UserCloudPolicyManager* 165 UserCloudPolicyManager*
176 UserCloudPolicyManagerFactory::RegisterManagerForOffTheRecordBrowserContext( 166 UserCloudPolicyManagerFactory::RegisterManagerForOffTheRecordBrowserContext(
177 content::BrowserContext* original_context, 167 content::BrowserContext* original_context,
178 content::BrowserContext* off_the_record_context) { 168 content::BrowserContext* off_the_record_context) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 return testing_factory_ != NULL; 208 return testing_factory_ != NULL;
219 } 209 }
220 210
221 void UserCloudPolicyManagerFactory::CreateServiceNow( 211 void UserCloudPolicyManagerFactory::CreateServiceNow(
222 content::BrowserContext* context) { 212 content::BrowserContext* context) {
223 DCHECK(testing_factory_); 213 DCHECK(testing_factory_);
224 manager_wrappers_[context] = new ManagerWrapper(testing_factory_(context)); 214 manager_wrappers_[context] = new ManagerWrapper(testing_factory_(context));
225 } 215 }
226 216
227 } // namespace policy 217 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | components/policy/core/common/cloud/user_cloud_policy_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698