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 "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 Loading... |
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 Loading... |
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 |
OLD | NEW |