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::kDisableComponentCloudPolicy) || | 114 switches::kEnableComponentCloudPolicy) || |
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( |
(...skipping 15 matching lines...) Expand all Loading... |
140 } | 140 } |
141 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 141 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
142 } | 142 } |
143 | 143 |
144 void CloudPolicyManager::OnRefreshComplete(bool success) { | 144 void CloudPolicyManager::OnRefreshComplete(bool success) { |
145 waiting_for_policy_refresh_ = false; | 145 waiting_for_policy_refresh_ = false; |
146 CheckAndPublishPolicy(); | 146 CheckAndPublishPolicy(); |
147 } | 147 } |
148 | 148 |
149 } // namespace policy | 149 } // namespace policy |
OLD | NEW |