| Index: chrome/browser/policy/cloud/cloud_policy_invalidator.h
|
| diff --git a/chrome/browser/policy/cloud/cloud_policy_invalidator.h b/chrome/browser/policy/cloud/cloud_policy_invalidator.h
|
| index 5192277eedaaa530403c5599a54e23f81f1b0e91..c9d99d198d914481f60921ca020ab8d74283ae7f 100644
|
| --- a/chrome/browser/policy/cloud/cloud_policy_invalidator.h
|
| +++ b/chrome/browser/policy/cloud/cloud_policy_invalidator.h
|
| @@ -20,6 +20,7 @@
|
| #include "sync/notifier/invalidation_handler.h"
|
|
|
| namespace base {
|
| +class Clock;
|
| class SequencedTaskRunner;
|
| }
|
|
|
| @@ -43,13 +44,19 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
|
| static const int kMaxFetchDelayMin;
|
| static const int kMaxFetchDelayMax;
|
|
|
| + // The grace period, in seconds, to allow for invalidations to be received
|
| + // once the invalidation service starts up.
|
| + static const int kInvalidationGracePeriod;
|
| +
|
| // |core| is the cloud policy core which connects the various policy objects.
|
| // It must remain valid until Shutdown is called.
|
| // |task_runner| is used for scheduling delayed tasks. It must post tasks to
|
| // the main policy thread.
|
| + // |clock| is used to get the current time.
|
| CloudPolicyInvalidator(
|
| CloudPolicyCore* core,
|
| - const scoped_refptr<base::SequencedTaskRunner>& task_runner);
|
| + const scoped_refptr<base::SequencedTaskRunner>& task_runner,
|
| + scoped_ptr<base::Clock> clock);
|
| virtual ~CloudPolicyInvalidator();
|
|
|
| // Initializes the invalidator. No invalidations will be generated before this
|
| @@ -92,7 +99,7 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
|
| void UpdateRegistration(const enterprise_management::PolicyData* policy);
|
|
|
| // Registers the given object with the invalidation service.
|
| - void Register(int64 timestamp, const invalidation::ObjectId& object_id);
|
| + void Register(const invalidation::ObjectId& object_id);
|
|
|
| // Unregisters the current object with the invalidation service.
|
| void Unregister();
|
| @@ -121,6 +128,9 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
|
| // when a policy is stored.
|
| int GetPolicyRefreshMetric(bool policy_changed);
|
|
|
| + // Determine if invalidations have been enabled longer than the grace period.
|
| + bool GetInvalidationsEnabled();
|
| +
|
| // The state of the object.
|
| enum State {
|
| UNINITIALIZED,
|
| @@ -136,6 +146,9 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
|
| // Schedules delayed tasks.
|
| const scoped_refptr<base::SequencedTaskRunner> task_runner_;
|
|
|
| + // The clock.
|
| + scoped_ptr<base::Clock> clock_;
|
| +
|
| // The invalidation service.
|
| invalidation::InvalidationService* invalidation_service_;
|
|
|
| @@ -144,12 +157,14 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
|
| // has registered for a policy object.
|
| bool invalidations_enabled_;
|
|
|
| + // The time that invalidations became enabled.
|
| + base::Time invalidations_enabled_time_;
|
| +
|
| // Whether the invalidation service is currently enabled.
|
| bool invalidation_service_enabled_;
|
|
|
| - // The timestamp of the PolicyData at which this object registered for policy
|
| - // invalidations. Set to zero if the object has not registered yet.
|
| - int64 registered_timestamp_;
|
| + // Whether this object has registered for policy invalidations.
|
| + bool is_registered_;
|
|
|
| // The object id representing the policy in the invalidation service.
|
| invalidation::ObjectId object_id_;
|
|
|