| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/component_cloud_policy_service.h" | 5 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 io_task_runner_->DeleteSoon(FROM_HERE, | 262 io_task_runner_->DeleteSoon(FROM_HERE, |
| 263 external_policy_data_fetcher_backend_.release()); | 263 external_policy_data_fetcher_backend_.release()); |
| 264 backend_task_runner_->DeleteSoon(FROM_HERE, backend_.release()); | 264 backend_task_runner_->DeleteSoon(FROM_HERE, backend_.release()); |
| 265 } | 265 } |
| 266 | 266 |
| 267 // static | 267 // static |
| 268 bool ComponentCloudPolicyService::SupportsDomain(PolicyDomain domain) { | 268 bool ComponentCloudPolicyService::SupportsDomain(PolicyDomain domain) { |
| 269 return ComponentCloudPolicyStore::SupportsDomain(domain); | 269 return ComponentCloudPolicyStore::SupportsDomain(domain); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void ComponentCloudPolicyService::ClearCache() { |
| 273 DCHECK(CalledOnValidThread()); |
| 274 // Empty credentials will wipe the cache. |
| 275 backend_task_runner_->PostTask(FROM_HERE, |
| 276 base::Bind(&Backend::SetCredentials, |
| 277 base::Unretained(backend_.get()), |
| 278 std::string(), std::string())); |
| 279 } |
| 280 |
| 272 void ComponentCloudPolicyService::OnSchemaRegistryReady() { | 281 void ComponentCloudPolicyService::OnSchemaRegistryReady() { |
| 273 DCHECK(CalledOnValidThread()); | 282 DCHECK(CalledOnValidThread()); |
| 274 InitializeIfReady(); | 283 InitializeIfReady(); |
| 275 } | 284 } |
| 276 | 285 |
| 277 void ComponentCloudPolicyService::OnSchemaRegistryUpdated( | 286 void ComponentCloudPolicyService::OnSchemaRegistryUpdated( |
| 278 bool has_new_schemas) { | 287 bool has_new_schemas) { |
| 279 DCHECK(CalledOnValidThread()); | 288 DCHECK(CalledOnValidThread()); |
| 280 | 289 |
| 281 // Ignore schema updates until the backend is initialized. | 290 // Ignore schema updates until the backend is initialized. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 506 } |
| 498 | 507 |
| 499 void ComponentCloudPolicyService::OnPolicyUpdated( | 508 void ComponentCloudPolicyService::OnPolicyUpdated( |
| 500 scoped_ptr<PolicyBundle> policy) { | 509 scoped_ptr<PolicyBundle> policy) { |
| 501 DCHECK(CalledOnValidThread()); | 510 DCHECK(CalledOnValidThread()); |
| 502 policy_.Swap(policy.get()); | 511 policy_.Swap(policy.get()); |
| 503 delegate_->OnComponentCloudPolicyUpdated(); | 512 delegate_->OnComponentCloudPolicyUpdated(); |
| 504 } | 513 } |
| 505 | 514 |
| 506 } // namespace policy | 515 } // namespace policy |
| OLD | NEW |