Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1902)

Unified Diff: chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h

Issue 19733003: Implement cloud policy invalidations using the invalidation service framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h
diff --git a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h
index c58580ab04c00017d569ba9f15218ae8840ae10f..6ad0fb9415957c2593430409bbd5cec65ef3afac 100644
--- a/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h
+++ b/chrome/browser/policy/cloud/cloud_policy_refresh_scheduler.h
@@ -36,12 +36,19 @@ class CloudPolicyRefreshScheduler
static const int64 kRefreshDelayMinMs;
static const int64 kRefreshDelayMaxMs;
+ // The minimum amount of delay that should occur before the first refresh in
+ // milliseconds. This delay is intended to allow the CloudPolicyInvalidator to
+ // receive policy invalidations before a policy is automatically fetched on
+ // sign-in. The delay is only enforced if policy invalidations are enabled.
+ static const int64 kFirstRefreshDelayMs;
+
// |client|, |store| and |prefs| pointers must stay valid throughout the
// lifetime of CloudPolicyRefreshScheduler.
CloudPolicyRefreshScheduler(
CloudPolicyClient* client,
CloudPolicyStore* store,
- const scoped_refptr<base::SequencedTaskRunner>& task_runner);
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ bool invalidations_enabled);
Joao da Silva 2013/07/23 20:44:47 As discussed offline, you can revert the changes t
Steve Condie 2013/07/24 01:42:04 Done.
virtual ~CloudPolicyRefreshScheduler();
base::Time last_refresh() const { return last_refresh_; }
@@ -54,6 +61,11 @@ class CloudPolicyRefreshScheduler
// and the request may not be immediately sent.
void RefreshSoon();
+ // Requests a policy refresh to be performed immediately due to a policy
+ // invalidation being received. Unlike RefreshSoon, throttling is not
+ // applied.
+ void RefreshForInvalidation();
+
// CloudPolicyClient::Observer:
virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE;
virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE;
@@ -109,6 +121,11 @@ class CloudPolicyRefreshScheduler
// Used to limit the rate at which refreshes are scheduled.
RateLimiter rate_limiter_;
+ // The time at which the first refresh can begin. This is used to introduce a
+ // small delay before a refresh can occur to allow policy invalidations to
+ // occur before automatically refreshing after login.
+ base::Time first_refresh_;
+
DISALLOW_COPY_AND_ASSIGN(CloudPolicyRefreshScheduler);
};

Powered by Google App Engine
This is Rietveld 408576698