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

Side by Side Diff: components/policy/core/common/cloud/cloud_policy_manager.cc

Issue 250383004: Enable fetching cloud policy for extensions by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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 | Annotate | Revision Log
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 "components/policy/core/common/cloud/cloud_policy_manager.h" 5 #include "components/policy/core/common/cloud/cloud_policy_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 107
108 void CloudPolicyManager::CreateComponentCloudPolicyService( 108 void CloudPolicyManager::CreateComponentCloudPolicyService(
109 const base::FilePath& policy_cache_path, 109 const base::FilePath& policy_cache_path,
110 const scoped_refptr<net::URLRequestContextGetter>& request_context) { 110 const scoped_refptr<net::URLRequestContextGetter>& request_context) {
111 #if !defined(OS_ANDROID) && !defined(OS_IOS) 111 #if !defined(OS_ANDROID) && !defined(OS_IOS)
112 // Init() must have been called. 112 // Init() must have been called.
113 DCHECK(schema_registry()); 113 DCHECK(schema_registry());
114 // Called at most once. 114 // Called at most once.
115 DCHECK(!component_policy_service_); 115 DCHECK(!component_policy_service_);
116 116
117 if (!CommandLine::ForCurrentProcess()->HasSwitch( 117 if (CommandLine::ForCurrentProcess()->HasSwitch(
118 switches::kEnableComponentCloudPolicy) || 118 switches::kDisableComponentCloudPolicy) ||
119 policy_cache_path.empty()) { 119 policy_cache_path.empty()) {
120 return; 120 return;
121 } 121 }
122 122
123 // TODO(joaodasilva): Move the |file_task_runner_| to the blocking pool. 123 // TODO(joaodasilva): Move the |file_task_runner_| to the blocking pool.
124 // Currently it's not possible because the ComponentCloudPolicyStore is 124 // Currently it's not possible because the ComponentCloudPolicyStore is
125 // NonThreadSafe and doesn't support getting calls from different threads. 125 // NonThreadSafe and doesn't support getting calls from different threads.
126 scoped_ptr<ResourceCache> resource_cache( 126 scoped_ptr<ResourceCache> resource_cache(
127 new ResourceCache(policy_cache_path, file_task_runner_)); 127 new ResourceCache(policy_cache_path, file_task_runner_));
128 component_policy_service_.reset(new ComponentCloudPolicyService( 128 component_policy_service_.reset(new ComponentCloudPolicyService(
(...skipping 15 matching lines...) Expand all
144 } 144 }
145 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) 145 #endif // !defined(OS_ANDROID) && !defined(OS_IOS)
146 } 146 }
147 147
148 void CloudPolicyManager::OnRefreshComplete(bool success) { 148 void CloudPolicyManager::OnRefreshComplete(bool success) {
149 waiting_for_policy_refresh_ = false; 149 waiting_for_policy_refresh_ = false;
150 CheckAndPublishPolicy(); 150 CheckAndPublishPolicy();
151 } 151 }
152 152
153 } // namespace policy 153 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/component_cloud_policy_browsertest.cc ('k') | components/policy/core/common/policy_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698