Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/policy/core/common/configuration_policy_provider.h" | 5 #include "components/policy/core/common/configuration_policy_provider.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "components/policy/core/common/external_data_fetcher.h" | 8 #include "components/policy/core/common/external_data_fetcher.h" |
| 9 #include "components/policy/core/common/policy_map.h" | 9 #include "components/policy/core/common/policy_map.h" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool ConfigurationPolicyProvider::IsInitializationComplete( | 39 bool ConfigurationPolicyProvider::IsInitializationComplete( |
| 40 PolicyDomain domain) const { | 40 PolicyDomain domain) const { |
| 41 return true; | 41 return true; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void ConfigurationPolicyProvider::UpdatePolicy( | 44 void ConfigurationPolicyProvider::UpdatePolicy( |
| 45 scoped_ptr<PolicyBundle> bundle) { | 45 scoped_ptr<PolicyBundle> bundle) { |
| 46 if (bundle.get()) | 46 if (bundle.get()) { |
| 47 policy_bundle_.Swap(bundle.get()); | 47 policy_bundle_.Swap(bundle.get()); |
| 48 else | 48 SetSources(source()); |
|
Thiemo Nagel
2015/09/01 17:40:37
Not sure whether that makes any difference (can th
fhorschig
2015/09/04 06:53:54
The poorly named function SetSources sets the sour
| |
| 49 } else { | |
| 49 policy_bundle_.Clear(); | 50 policy_bundle_.Clear(); |
| 51 } | |
| 50 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, | 52 FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer, |
| 51 observer_list_, | 53 observer_list_, |
| 52 OnUpdatePolicy(this)); | 54 OnUpdatePolicy(this)); |
| 53 } | 55 } |
| 54 | 56 |
| 57 void ConfigurationPolicyProvider::SetSources(PolicySource source) { | |
| 58 for (PolicyBundle::iterator it = policy_bundle_.begin(); | |
| 59 it != policy_bundle_.end(); ++it) { | |
| 60 it->second->SetSources(source); | |
| 61 } | |
| 62 } | |
| 63 | |
| 55 SchemaRegistry* ConfigurationPolicyProvider::schema_registry() const { | 64 SchemaRegistry* ConfigurationPolicyProvider::schema_registry() const { |
| 56 return schema_registry_; | 65 return schema_registry_; |
| 57 } | 66 } |
| 58 | 67 |
| 59 const scoped_refptr<SchemaMap>& | 68 const scoped_refptr<SchemaMap>& |
| 60 ConfigurationPolicyProvider::schema_map() const { | 69 ConfigurationPolicyProvider::schema_map() const { |
| 61 return schema_registry_->schema_map(); | 70 return schema_registry_->schema_map(); |
| 62 } | 71 } |
| 63 | 72 |
| 64 void ConfigurationPolicyProvider::AddObserver(Observer* observer) { | 73 void ConfigurationPolicyProvider::AddObserver(Observer* observer) { |
| 65 observer_list_.AddObserver(observer); | 74 observer_list_.AddObserver(observer); |
| 66 } | 75 } |
| 67 | 76 |
| 68 void ConfigurationPolicyProvider::RemoveObserver(Observer* observer) { | 77 void ConfigurationPolicyProvider::RemoveObserver(Observer* observer) { |
| 69 observer_list_.RemoveObserver(observer); | 78 observer_list_.RemoveObserver(observer); |
| 70 } | 79 } |
| 71 | 80 |
| 72 void ConfigurationPolicyProvider::OnSchemaRegistryUpdated( | 81 void ConfigurationPolicyProvider::OnSchemaRegistryUpdated( |
| 73 bool has_new_schemas) {} | 82 bool has_new_schemas) {} |
| 74 | 83 |
| 75 void ConfigurationPolicyProvider::OnSchemaRegistryReady() {} | 84 void ConfigurationPolicyProvider::OnSchemaRegistryReady() {} |
| 76 | 85 |
| 77 } // namespace policy | 86 } // namespace policy |
| OLD | NEW |