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/cloud_policy_manager.h" | 5 #include "chrome/browser/policy/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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 void CloudPolicyManager::CreateComponentCloudPolicyService( | 104 void CloudPolicyManager::CreateComponentCloudPolicyService( |
105 const base::FilePath& policy_cache_path, | 105 const base::FilePath& policy_cache_path, |
106 const scoped_refptr<net::URLRequestContextGetter>& request_context) { | 106 const scoped_refptr<net::URLRequestContextGetter>& request_context) { |
107 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 107 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
108 // Init() must have been called. | 108 // Init() must have been called. |
109 DCHECK(schema_registry()); | 109 DCHECK(schema_registry()); |
110 // Called at most once. | 110 // Called at most once. |
111 DCHECK(!component_policy_service_); | 111 DCHECK(!component_policy_service_); |
112 | 112 |
113 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 113 if (CommandLine::ForCurrentProcess()->HasSwitch( |
114 switches::kEnableComponentCloudPolicy) || | 114 switches::kDisableComponentCloudPolicy) || |
115 policy_cache_path.empty()) { | 115 policy_cache_path.empty()) { |
116 return; | 116 return; |
117 } | 117 } |
118 | 118 |
119 // TODO(joaodasilva): Move the |file_task_runner_| to the blocking pool. | 119 // TODO(joaodasilva): Move the |file_task_runner_| to the blocking pool. |
120 // Currently it's not possible because the ComponentCloudPolicyStore is | 120 // Currently it's not possible because the ComponentCloudPolicyStore is |
121 // NonThreadSafe and doesn't support getting calls from different threads. | 121 // NonThreadSafe and doesn't support getting calls from different threads. |
122 scoped_ptr<ResourceCache> resource_cache( | 122 scoped_ptr<ResourceCache> resource_cache( |
123 new ResourceCache(policy_cache_path, file_task_runner_)); | 123 new ResourceCache(policy_cache_path, file_task_runner_)); |
124 component_policy_service_.reset(new ComponentCloudPolicyService( | 124 component_policy_service_.reset(new ComponentCloudPolicyService( |
125 this, | 125 this, |
126 schema_registry(), | 126 schema_registry(), |
127 core(), | 127 core(), |
128 resource_cache.Pass(), | 128 resource_cache.Pass(), |
129 request_context, | 129 request_context, |
130 file_task_runner_, | 130 file_task_runner_, |
131 io_task_runner_)); | 131 io_task_runner_)); |
132 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 132 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
133 } | 133 } |
134 | 134 |
135 void CloudPolicyManager::OnRefreshComplete(bool success) { | 135 void CloudPolicyManager::OnRefreshComplete(bool success) { |
136 waiting_for_policy_refresh_ = false; | 136 waiting_for_policy_refresh_ = false; |
137 CheckAndPublishPolicy(); | 137 CheckAndPublishPolicy(); |
138 } | 138 } |
139 | 139 |
140 } // namespace policy | 140 } // namespace policy |
OLD | NEW |