Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 6 #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 13 #include "base/values.h" | 14 #include "base/values.h" |
| 14 #include "chrome/browser/policy/configuration_policy_store_interface.h" | 15 #include "chrome/browser/policy/configuration_policy_store_interface.h" |
| 16 // configuration_policy_type.h is generated. See policy_templates.json for | |
| 17 // policy definitions. | |
|
Mattias Nissler (ping if slow)
2011/02/02 12:27:55
I'm no fan of repeating that comment over and over
Jakob Kummerow
2011/02/03 14:36:52
Done.
| |
| 18 #include "policy/configuration_policy_type.h" | |
| 15 | 19 |
| 16 namespace policy { | 20 namespace policy { |
| 17 | 21 |
| 22 typedef std::map<ConfigurationPolicyType, Value*> PolicyMapType; | |
|
Mattias Nissler (ping if slow)
2011/02/02 12:27:55
That should really be a typedef inside Configurati
Jakob Kummerow
2011/02/03 14:36:52
Done. As you wish.
| |
| 23 | |
| 18 // A mostly-abstract super class for platform-specific policy providers. | 24 // A mostly-abstract super class for platform-specific policy providers. |
| 19 // Platform-specific policy providers (Windows Group Policy, gconf, | 25 // Platform-specific policy providers (Windows Group Policy, gconf, |
| 20 // etc.) should implement a subclass of this class. | 26 // etc.) should implement a subclass of this class. |
| 21 class ConfigurationPolicyProvider { | 27 class ConfigurationPolicyProvider { |
| 22 public: | 28 public: |
| 23 class Observer { | 29 class Observer { |
| 24 public: | 30 public: |
| 25 virtual ~Observer() {} | 31 virtual ~Observer() {} |
| 26 virtual void OnUpdatePolicy() = 0; | 32 virtual void OnUpdatePolicy() = 0; |
| 27 virtual void OnProviderGoingAway() = 0; | 33 virtual void OnProviderGoingAway() = 0; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 55 // Check whether this provider has completed initialization. This is used to | 61 // Check whether this provider has completed initialization. This is used to |
| 56 // detect whether initialization is done in case providers implementations | 62 // detect whether initialization is done in case providers implementations |
| 57 // need to do asynchronous operations for initialization. | 63 // need to do asynchronous operations for initialization. |
| 58 virtual bool IsInitializationComplete() const; | 64 virtual bool IsInitializationComplete() const; |
| 59 | 65 |
| 60 protected: | 66 protected: |
| 61 // Decodes the value tree and writes the configuration to the given |store|. | 67 // Decodes the value tree and writes the configuration to the given |store|. |
| 62 void DecodePolicyValueTree(const DictionaryValue* policies, | 68 void DecodePolicyValueTree(const DictionaryValue* policies, |
| 63 ConfigurationPolicyStoreInterface* store); | 69 ConfigurationPolicyStoreInterface* store); |
| 64 | 70 |
| 71 // Writes the configuration found in the already-decoded map |policies| to | |
| 72 // the given |store|. | |
| 73 void ApplyPolicyMap(const PolicyMapType* policies, | |
|
Mattias Nissler (ping if slow)
2011/02/02 12:27:55
Can we name that similar to DecodePolicyValueTree?
Jakob Kummerow
2011/02/03 14:36:52
Done.
| |
| 74 ConfigurationPolicyStoreInterface* store); | |
| 75 | |
| 65 const PolicyDefinitionList* policy_definition_list() const { | 76 const PolicyDefinitionList* policy_definition_list() const { |
| 66 return policy_definition_list_; | 77 return policy_definition_list_; |
| 67 } | 78 } |
| 68 | 79 |
| 69 private: | 80 private: |
| 70 friend class ConfigurationPolicyObserverRegistrar; | 81 friend class ConfigurationPolicyObserverRegistrar; |
| 71 | 82 |
| 72 virtual void AddObserver(ConfigurationPolicyProvider::Observer* observer) = 0; | 83 virtual void AddObserver(ConfigurationPolicyProvider::Observer* observer) = 0; |
| 73 virtual void RemoveObserver( | 84 virtual void RemoveObserver( |
| 74 ConfigurationPolicyProvider::Observer* observer) = 0; | 85 ConfigurationPolicyProvider::Observer* observer) = 0; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 101 private: | 112 private: |
| 102 ConfigurationPolicyProvider* provider_; | 113 ConfigurationPolicyProvider* provider_; |
| 103 ConfigurationPolicyProvider::Observer* observer_; | 114 ConfigurationPolicyProvider::Observer* observer_; |
| 104 | 115 |
| 105 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyObserverRegistrar); | 116 DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyObserverRegistrar); |
| 106 }; | 117 }; |
| 107 | 118 |
| 108 } // namespace policy | 119 } // namespace policy |
| 109 | 120 |
| 110 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ | 121 #endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_H_ |
| OLD | NEW |