| Index: chrome/browser/policy/cloud/cloud_policy_core.h
|
| diff --git a/chrome/browser/policy/cloud/cloud_policy_core.h b/chrome/browser/policy/cloud/cloud_policy_core.h
|
| index 96135dc23036a7299680895e9a99466862b5733d..6158ee464a251490bac9f019faea6188c9937ac1 100644
|
| --- a/chrome/browser/policy/cloud/cloud_policy_core.h
|
| +++ b/chrome/browser/policy/cloud/cloud_policy_core.h
|
| @@ -9,6 +9,7 @@
|
|
|
| #include "base/basictypes.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/observer_list.h"
|
| #include "base/prefs/pref_member.h"
|
| #include "chrome/browser/policy/cloud/cloud_policy_constants.h"
|
|
|
| @@ -29,6 +30,21 @@ class CloudPolicyStore;
|
| // CloudPolicyRefreshScheduler which triggers periodic refreshes.
|
| class CloudPolicyCore {
|
| public:
|
| + // Callbacks for policy core events.
|
| + class Observer {
|
| + public:
|
| + virtual ~Observer();
|
| +
|
| + // Called after the core is connected.
|
| + virtual void OnCoreConnected(CloudPolicyCore* core) = 0;
|
| +
|
| + // Called after the refresh scheduler is started.
|
| + virtual void OnRefreshSchedulerStarted(CloudPolicyCore* core) = 0;
|
| +
|
| + // Called before the core is disconnected.
|
| + virtual void OnCoreDisconnecting(CloudPolicyCore* core) = 0;
|
| + };
|
| +
|
| CloudPolicyCore(const PolicyNamespaceKey& policy_ns_key,
|
| CloudPolicyStore* store);
|
| ~CloudPolicyCore();
|
| @@ -67,6 +83,12 @@ class CloudPolicyCore {
|
| void TrackRefreshDelayPref(PrefService* pref_service,
|
| const std::string& refresh_pref_name);
|
|
|
| + // Registers an observer to be notified of policy core events.
|
| + void AddObserver(Observer* observer);
|
| +
|
| + // Removes the specified observer.
|
| + void RemoveObserver(Observer* observer);
|
| +
|
| private:
|
| // Updates the refresh scheduler on refresh delay changes.
|
| void UpdateRefreshDelayFromPref();
|
| @@ -77,6 +99,7 @@ class CloudPolicyCore {
|
| scoped_ptr<CloudPolicyService> service_;
|
| scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_;
|
| scoped_ptr<IntegerPrefMember> refresh_delay_;
|
| + ObserverList<Observer, true> observers_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CloudPolicyCore);
|
| };
|
|
|