| 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/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
| 12 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" | 12 #include "chrome/browser/chromeos/policy/policy_oauth2_token_fetcher.h" |
| 13 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 13 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 14 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 15 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h" | 15 #include "chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h" |
| 16 #include "chrome/browser/policy/cloud/resource_cache.h" | 16 #include "chrome/browser/policy/cloud/resource_cache.h" |
| 17 #include "chrome/browser/policy/policy_bundle.h" | 17 #include "chrome/browser/policy/policy_bundle.h" |
| 18 #include "chrome/browser/policy/policy_domain_descriptor.h" |
| 18 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
| 19 #include "net/url_request/url_request_context_getter.h" | 20 #include "net/url_request/url_request_context_getter.h" |
| 20 | 21 |
| 21 namespace em = enterprise_management; | 22 namespace em = enterprise_management; |
| 22 | 23 |
| 23 namespace policy { | 24 namespace policy { |
| 24 | 25 |
| 25 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( | 26 UserCloudPolicyManagerChromeOS::UserCloudPolicyManagerChromeOS( |
| 26 scoped_ptr<CloudPolicyStore> store, | 27 scoped_ptr<CloudPolicyStore> store, |
| 27 scoped_ptr<ResourceCache> resource_cache, | 28 scoped_ptr<ResourceCache> resource_cache, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 if (domain == POLICY_DOMAIN_CHROME) | 96 if (domain == POLICY_DOMAIN_CHROME) |
| 96 return !wait_for_policy_fetch_; | 97 return !wait_for_policy_fetch_; |
| 97 if (ComponentCloudPolicyService::SupportsDomain(domain) && | 98 if (ComponentCloudPolicyService::SupportsDomain(domain) && |
| 98 component_policy_service_) { | 99 component_policy_service_) { |
| 99 return component_policy_service_->is_initialized(); | 100 return component_policy_service_->is_initialized(); |
| 100 } | 101 } |
| 101 return true; | 102 return true; |
| 102 } | 103 } |
| 103 | 104 |
| 104 void UserCloudPolicyManagerChromeOS::RegisterPolicyDomain( | 105 void UserCloudPolicyManagerChromeOS::RegisterPolicyDomain( |
| 105 PolicyDomain domain, | 106 scoped_refptr<const PolicyDomainDescriptor> descriptor) { |
| 106 const std::set<std::string>& component_ids) { | 107 if (ComponentCloudPolicyService::SupportsDomain(descriptor->domain()) && |
| 107 if (ComponentCloudPolicyService::SupportsDomain(domain) && | |
| 108 component_policy_service_) { | 108 component_policy_service_) { |
| 109 component_policy_service_->RegisterPolicyDomain(domain, component_ids); | 109 component_policy_service_->RegisterPolicyDomain(descriptor); |
| 110 } | 110 } |
| 111 } | 111 } |
| 112 | 112 |
| 113 scoped_ptr<PolicyBundle> UserCloudPolicyManagerChromeOS::CreatePolicyBundle() { | 113 scoped_ptr<PolicyBundle> UserCloudPolicyManagerChromeOS::CreatePolicyBundle() { |
| 114 scoped_ptr<PolicyBundle> bundle = CloudPolicyManager::CreatePolicyBundle(); | 114 scoped_ptr<PolicyBundle> bundle = CloudPolicyManager::CreatePolicyBundle(); |
| 115 if (component_policy_service_) | 115 if (component_policy_service_) |
| 116 bundle->MergeFrom(component_policy_service_->policy()); | 116 bundle->MergeFrom(component_policy_service_->policy()); |
| 117 return bundle.Pass(); | 117 return bundle.Pass(); |
| 118 } | 118 } |
| 119 | 119 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 // start the scheduler. The |component_policy_service_| will call back into | 269 // start the scheduler. The |component_policy_service_| will call back into |
| 270 // OnComponentCloudPolicyUpdated() once it's ready. | 270 // OnComponentCloudPolicyUpdated() once it's ready. |
| 271 return; | 271 return; |
| 272 } | 272 } |
| 273 | 273 |
| 274 core()->StartRefreshScheduler(); | 274 core()->StartRefreshScheduler(); |
| 275 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate); | 275 core()->TrackRefreshDelayPref(local_state_, prefs::kUserPolicyRefreshRate); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace policy | 278 } // namespace policy |
| OLD | NEW |