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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_CLOUD_CLOUD_POLICY_REFRESH_SCHEDULER_H_ 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_REFRESH_SCHEDULER_H_
6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_REFRESH_SCHEDULER_H_ 6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_REFRESH_SCHEDULER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/cancelable_callback.h" 9 #include "base/cancelable_callback.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 18 matching lines...) Expand all
29 public: 29 public:
30 // Refresh constants. 30 // Refresh constants.
31 static const int64 kDefaultRefreshDelayMs; 31 static const int64 kDefaultRefreshDelayMs;
32 static const int64 kUnmanagedRefreshDelayMs; 32 static const int64 kUnmanagedRefreshDelayMs;
33 static const int64 kInitialErrorRetryDelayMs; 33 static const int64 kInitialErrorRetryDelayMs;
34 34
35 // Refresh delay bounds. 35 // Refresh delay bounds.
36 static const int64 kRefreshDelayMinMs; 36 static const int64 kRefreshDelayMinMs;
37 static const int64 kRefreshDelayMaxMs; 37 static const int64 kRefreshDelayMaxMs;
38 38
39 // The minimum amount of delay that should occur before the first refresh in
40 // milliseconds. This delay is intended to allow the CloudPolicyInvalidator to
41 // receive policy invalidations before a policy is automatically fetched on
42 // sign-in. The delay is only enforced if policy invalidations are enabled.
43 static const int64 kFirstRefreshDelayMs;
44
39 // |client|, |store| and |prefs| pointers must stay valid throughout the 45 // |client|, |store| and |prefs| pointers must stay valid throughout the
40 // lifetime of CloudPolicyRefreshScheduler. 46 // lifetime of CloudPolicyRefreshScheduler.
41 CloudPolicyRefreshScheduler( 47 CloudPolicyRefreshScheduler(
42 CloudPolicyClient* client, 48 CloudPolicyClient* client,
43 CloudPolicyStore* store, 49 CloudPolicyStore* store,
44 const scoped_refptr<base::SequencedTaskRunner>& task_runner); 50 const scoped_refptr<base::SequencedTaskRunner>& task_runner,
51 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.
45 virtual ~CloudPolicyRefreshScheduler(); 52 virtual ~CloudPolicyRefreshScheduler();
46 53
47 base::Time last_refresh() const { return last_refresh_; } 54 base::Time last_refresh() const { return last_refresh_; }
48 int64 refresh_delay() const { return refresh_delay_ms_; } 55 int64 refresh_delay() const { return refresh_delay_ms_; }
49 56
50 // Sets the refresh delay to |refresh_delay| (subject to min/max clamping). 57 // Sets the refresh delay to |refresh_delay| (subject to min/max clamping).
51 void SetRefreshDelay(int64 refresh_delay); 58 void SetRefreshDelay(int64 refresh_delay);
52 59
53 // Requests a policy refresh to be performed soon. This may apply throttling, 60 // Requests a policy refresh to be performed soon. This may apply throttling,
54 // and the request may not be immediately sent. 61 // and the request may not be immediately sent.
55 void RefreshSoon(); 62 void RefreshSoon();
56 63
64 // Requests a policy refresh to be performed immediately due to a policy
65 // invalidation being received. Unlike RefreshSoon, throttling is not
66 // applied.
67 void RefreshForInvalidation();
68
57 // CloudPolicyClient::Observer: 69 // CloudPolicyClient::Observer:
58 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE; 70 virtual void OnPolicyFetched(CloudPolicyClient* client) OVERRIDE;
59 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE; 71 virtual void OnRegistrationStateChanged(CloudPolicyClient* client) OVERRIDE;
60 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE; 72 virtual void OnClientError(CloudPolicyClient* client) OVERRIDE;
61 73
62 // CloudPolicyStore::Observer: 74 // CloudPolicyStore::Observer:
63 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE; 75 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE;
64 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE; 76 virtual void OnStoreError(CloudPolicyStore* store) OVERRIDE;
65 77
66 // net::NetworkChangeNotifier::IPAddressObserver: 78 // net::NetworkChangeNotifier::IPAddressObserver:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 114
103 // Error retry delay in milliseconds. 115 // Error retry delay in milliseconds.
104 int64 error_retry_delay_ms_; 116 int64 error_retry_delay_ms_;
105 117
106 // The refresh delay. 118 // The refresh delay.
107 int64 refresh_delay_ms_; 119 int64 refresh_delay_ms_;
108 120
109 // Used to limit the rate at which refreshes are scheduled. 121 // Used to limit the rate at which refreshes are scheduled.
110 RateLimiter rate_limiter_; 122 RateLimiter rate_limiter_;
111 123
124 // The time at which the first refresh can begin. This is used to introduce a
125 // small delay before a refresh can occur to allow policy invalidations to
126 // occur before automatically refreshing after login.
127 base::Time first_refresh_;
128
112 DISALLOW_COPY_AND_ASSIGN(CloudPolicyRefreshScheduler); 129 DISALLOW_COPY_AND_ASSIGN(CloudPolicyRefreshScheduler);
113 }; 130 };
114 131
115 } // namespace policy 132 } // namespace policy
116 133
117 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_REFRESH_SCHEDULER_H_ 134 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_REFRESH_SCHEDULER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698