Chromium Code Reviews| 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 // Publish policy (even though it hasn't changed) in order to signal load | 83 // Publish policy (even though it hasn't changed) in order to signal load |
| 84 // complete on the ConfigurationPolicyProvider interface. Technically, this | 84 // complete on the ConfigurationPolicyProvider interface. Technically, this |
| 85 // is only required on the first load, but doesn't hurt in any case. | 85 // is only required on the first load, but doesn't hurt in any case. |
| 86 CheckAndPublishPolicy(); | 86 CheckAndPublishPolicy(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void CloudPolicyManager::OnComponentCloudPolicyUpdated() { | 89 void CloudPolicyManager::OnComponentCloudPolicyUpdated() { |
| 90 CheckAndPublishPolicy(); | 90 CheckAndPublishPolicy(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 PolicySource CloudPolicyManager::source() const { | |
|
Thiemo Nagel
2015/09/01 17:40:36
Remove.
fhorschig
2015/09/04 06:53:54
Done.
| |
| 94 return POLICY_SOURCE_CLOUD; | |
| 95 } | |
| 96 | |
| 93 void CloudPolicyManager::CheckAndPublishPolicy() { | 97 void CloudPolicyManager::CheckAndPublishPolicy() { |
| 94 if (IsInitializationComplete(POLICY_DOMAIN_CHROME) && | 98 if (IsInitializationComplete(POLICY_DOMAIN_CHROME) && |
| 95 !waiting_for_policy_refresh_) { | 99 !waiting_for_policy_refresh_) { |
| 96 scoped_ptr<PolicyBundle> bundle(new PolicyBundle); | 100 scoped_ptr<PolicyBundle> bundle(new PolicyBundle); |
| 97 GetChromePolicy( | 101 GetChromePolicy( |
| 98 &bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))); | 102 &bundle->Get(PolicyNamespace(POLICY_DOMAIN_CHROME, std::string()))); |
| 99 if (component_policy_service_) | 103 if (component_policy_service_) |
| 100 bundle->MergeFrom(component_policy_service_->policy()); | 104 bundle->MergeFrom(component_policy_service_->policy()); |
| 101 UpdatePolicy(bundle.Pass()); | 105 UpdatePolicy(bundle.Pass()); |
| 102 } | 106 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 } | 154 } |
| 151 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 155 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 152 } | 156 } |
| 153 | 157 |
| 154 void CloudPolicyManager::OnRefreshComplete(bool success) { | 158 void CloudPolicyManager::OnRefreshComplete(bool success) { |
| 155 waiting_for_policy_refresh_ = false; | 159 waiting_for_policy_refresh_ = false; |
| 156 CheckAndPublishPolicy(); | 160 CheckAndPublishPolicy(); |
| 157 } | 161 } |
| 158 | 162 |
| 159 } // namespace policy | 163 } // namespace policy |
| OLD | NEW |