| 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/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/metrics/sparse_histogram.h" | 12 #include "base/metrics/sparse_histogram.h" |
| 13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" | 15 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" |
| 16 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 16 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 17 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 18 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h" | 18 #include "chrome/browser/policy/cloud/cloud_external_data_manager.h" |
| 19 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h" | 19 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h" |
| 20 #include "chrome/browser/policy/cloud/resource_cache.h" | 20 #include "chrome/browser/policy/cloud/resource_cache.h" |
| 21 #include "chrome/browser/policy/policy_bundle.h" | 21 #include "chrome/browser/policy/policy_bundle.h" |
| 22 #include "chrome/browser/policy/policy_domain_descriptor.h" | |
| 23 #include "components/policy/core/common/policy_pref_names.h" | 22 #include "components/policy/core/common/policy_pref_names.h" |
| 24 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 25 #include "net/url_request/url_request_context_getter.h" | 24 #include "net/url_request/url_request_context_getter.h" |
| 26 | 25 |
| 27 namespace em = enterprise_management; | 26 namespace em = enterprise_management; |
| 28 | 27 |
| 29 namespace policy { | 28 namespace policy { |
| 30 | 29 |
| 31 namespace { | 30 namespace { |
| 32 | 31 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return false; | 146 return false; |
| 148 if (domain == POLICY_DOMAIN_CHROME) | 147 if (domain == POLICY_DOMAIN_CHROME) |
| 149 return !wait_for_policy_fetch_; | 148 return !wait_for_policy_fetch_; |
| 150 if (ComponentCloudPolicyService::SupportsDomain(domain) && | 149 if (ComponentCloudPolicyService::SupportsDomain(domain) && |
| 151 component_policy_service_) { | 150 component_policy_service_) { |
| 152 return component_policy_service_->is_initialized(); | 151 return component_policy_service_->is_initialized(); |
| 153 } | 152 } |
| 154 return true; | 153 return true; |
| 155 } | 154 } |
| 156 | 155 |
| 157 void UserCloudPolicyManagerChromeOS::RegisterPolicyDomain( | 156 void UserCloudPolicyManagerChromeOS::OnSchemaRegistryUpdated( |
| 158 scoped_refptr<const PolicyDomainDescriptor> descriptor) { | 157 bool has_new_schemas) { |
| 159 if (ComponentCloudPolicyService::SupportsDomain(descriptor->domain()) && | 158 // Send the new map even if |has_new_schemas| is false, so that policies for |
| 160 component_policy_service_) { | 159 // components that have been removed can be dropped from the cache. |
| 161 component_policy_service_->RegisterPolicyDomain(descriptor); | 160 if (component_policy_service_) |
| 162 } | 161 component_policy_service_->OnSchemasUpdated(schema_map()); |
| 163 } | 162 } |
| 164 | 163 |
| 165 scoped_ptr<PolicyBundle> UserCloudPolicyManagerChromeOS::CreatePolicyBundle() { | 164 scoped_ptr<PolicyBundle> UserCloudPolicyManagerChromeOS::CreatePolicyBundle() { |
| 166 scoped_ptr<PolicyBundle> bundle = CloudPolicyManager::CreatePolicyBundle(); | 165 scoped_ptr<PolicyBundle> bundle = CloudPolicyManager::CreatePolicyBundle(); |
| 167 if (component_policy_service_) | 166 if (component_policy_service_) |
| 168 bundle->MergeFrom(component_policy_service_->policy()); | 167 bundle->MergeFrom(component_policy_service_->policy()); |
| 169 return bundle.Pass(); | 168 return bundle.Pass(); |
| 170 } | 169 } |
| 171 | 170 |
| 172 void UserCloudPolicyManagerChromeOS::OnInitializationCompleted( | 171 void UserCloudPolicyManagerChromeOS::OnInitializationCompleted( |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 // OnComponentCloudPolicyUpdated() once it's ready. | 348 // OnComponentCloudPolicyUpdated() once it's ready. |
| 350 return; | 349 return; |
| 351 } | 350 } |
| 352 | 351 |
| 353 core()->StartRefreshScheduler(); | 352 core()->StartRefreshScheduler(); |
| 354 core()->TrackRefreshDelayPref(local_state_, | 353 core()->TrackRefreshDelayPref(local_state_, |
| 355 policy_prefs::kUserPolicyRefreshRate); | 354 policy_prefs::kUserPolicyRefreshRate); |
| 356 } | 355 } |
| 357 | 356 |
| 358 } // namespace policy | 357 } // namespace policy |
| OLD | NEW |