Chromium Code Reviews| Index: chrome/browser/policy/configuration_policy_reader.h |
| diff --git a/chrome/browser/policy/configuration_policy_reader.h b/chrome/browser/policy/configuration_policy_reader.h |
| index 372ff286b7e2db12dc02b6ab6655f4182ff0d90e..4ddaca8fb7ecc316ffbdc6c7ef81ff940c661391 100644 |
| --- a/chrome/browser/policy/configuration_policy_reader.h |
| +++ b/chrome/browser/policy/configuration_policy_reader.h |
| @@ -6,6 +6,7 @@ |
| #define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_READER_H_ |
| #pragma once |
| +#include "base/observer_list.h" |
| #include "base/scoped_ptr.h" |
| #include "base/values.h" |
| #include "chrome/browser/policy/configuration_policy_provider.h" |
| @@ -21,6 +22,12 @@ class ConfigurationPolicyStatusKeeper; |
| // about:policy UI. |
| class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { |
| public: |
| + class Observer { |
| + public: |
| + virtual ~Observer() {} |
| + virtual void OnPolicyValuesChanged() = 0; |
| + }; |
| + |
| ConfigurationPolicyReader(ConfigurationPolicyProvider* provider, |
| PolicyStatusInfo::PolicyLevel policy_level); |
| virtual ~ConfigurationPolicyReader(); |
| @@ -29,21 +36,21 @@ class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { |
| virtual void OnUpdatePolicy(); |
| virtual void OnProviderGoingAway(); |
| + // Methods to handle Observers. |
| + void AddObserver(Observer* observer); |
| + void RemoveObserver(Observer* observer); |
| + |
| // Creates a ConfigurationPolicyReader that reads managed platform policy. |
| - static ConfigurationPolicyReader* |
| - CreateManagedPlatformPolicyReader(); |
| + static ConfigurationPolicyReader* CreateManagedPlatformPolicyReader(); |
| // Creates a ConfigurationPolicyReader that reads managed cloud policy. |
| - static ConfigurationPolicyReader* |
| - CreateManagedCloudPolicyReader(); |
| + static ConfigurationPolicyReader* CreateManagedCloudPolicyReader(); |
| // Creates a ConfigurationPolicyReader that reads recommended platform policy. |
| - static ConfigurationPolicyReader* |
| - CreateRecommendedPlatformPolicyReader(); |
| + static ConfigurationPolicyReader* CreateRecommendedPlatformPolicyReader(); |
| // Creates a ConfigurationPolicyReader that reads recommended cloud policy. |
| - static ConfigurationPolicyReader* |
| - CreateRecommendedCloudPolicyReader(); |
| + static ConfigurationPolicyReader* CreateRecommendedCloudPolicyReader(); |
| // Returns a pointer to a DictionaryValue object containing policy status |
| // information for the UI. Ownership of the return value is acquired by the |
| @@ -70,6 +77,8 @@ class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { |
| // Current policy status. |
| scoped_ptr<ConfigurationPolicyStatusKeeper> policy_keeper_; |
| + ObserverList<Observer, true> observers_; |
| + |
| ConfigurationPolicyObserverRegistrar registrar_; |
| DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyReader); |
| @@ -80,16 +89,23 @@ class ConfigurationPolicyReader : public ConfigurationPolicyProvider::Observer { |
| // about:policy UI can display. |
| class PolicyStatus { |
| public: |
| + typedef ConfigurationPolicyReader::Observer Observer; |
| PolicyStatus(ConfigurationPolicyReader* managed_platform, |
| ConfigurationPolicyReader* managed_cloud, |
| ConfigurationPolicyReader* recommended_platform, |
| ConfigurationPolicyReader* recommended_cloud); |
| ~PolicyStatus(); |
| + // Adds an observer to each one of the ConfigurationPolicyReaders. |
| + void AddObserver(Observer* observer) const; |
| + |
| + // Removes an observer to each one of the ConfigurationPolicyReaders. |
|
Mattias Nissler (ping if slow)
2011/09/02 11:16:09
s/to/from/
simo
2011/09/02 15:32:02
Done.
|
| + void RemoveObserver(Observer* observer) const; |
| + |
| // Returns a ListValue pointer containing the status information of all |
| // policies supported by the client. |any_policies_sent| is set to true if |
| // there are policies in the list that were sent by a provider, otherwise |
| - // it is set to false. This is for the about:policy UI to display. |
| + // it is set tof alse. This is for the about:policy UI to display. |
|
Mattias Nissler (ping if slow)
2011/09/02 11:16:09
tof alse? sounds like a nordic actor.
simo
2011/09/02 15:32:02
Done.
|
| ListValue* GetPolicyStatusList(bool* any_policies_sent) const; |
| // Returns a string16 containing the actual name of the policy corresponding |
| @@ -105,7 +121,7 @@ class PolicyStatus { |
| // |list| as it is returned by the different ConfigurationPolicyReader |
| // objects. Returns true if a policy was added and false otherwise. |
| bool AddPolicyFromReaders(ConfigurationPolicyType policy, |
| - ListValue* list) const; |
| + ListValue* list) const; |
| scoped_ptr<ConfigurationPolicyReader> managed_platform_; |
| scoped_ptr<ConfigurationPolicyReader> managed_cloud_; |