OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_INVALIDATOR_H_ | 5 #ifndef CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ |
6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ | 6 #define CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
15 #include "chrome/browser/policy/cloud/cloud_policy_core.h" | 16 #include "chrome/browser/policy/cloud/cloud_policy_core.h" |
16 #include "chrome/browser/policy/cloud/cloud_policy_store.h" | 17 #include "chrome/browser/policy/cloud/cloud_policy_store.h" |
| 18 #include "google/cacheinvalidation/include/types.h" |
| 19 #include "sync/internal_api/public/base/invalidation.h" |
17 #include "sync/notifier/invalidation_handler.h" | 20 #include "sync/notifier/invalidation_handler.h" |
18 | 21 |
19 namespace base { | 22 namespace base { |
20 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
21 } | 24 } |
22 | 25 |
23 namespace invalidation { | 26 namespace invalidation { |
24 class InvalidationService; | 27 class InvalidationService; |
25 } | 28 } |
26 | 29 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // The version of the latest invalidation received. This is compared to | 161 // The version of the latest invalidation received. This is compared to |
159 // the invalidation version of policy stored to determine when the | 162 // the invalidation version of policy stored to determine when the |
160 // invalidated policy is up-to-date. | 163 // invalidated policy is up-to-date. |
161 int64 invalidation_version_; | 164 int64 invalidation_version_; |
162 | 165 |
163 // The number of invalidations with unknown version received. Since such | 166 // The number of invalidations with unknown version received. Since such |
164 // invalidations do not provide a version number, this count is used to set | 167 // invalidations do not provide a version number, this count is used to set |
165 // invalidation_version_ when such invalidations occur. | 168 // invalidation_version_ when such invalidations occur. |
166 int unknown_version_invalidation_count_; | 169 int unknown_version_invalidation_count_; |
167 | 170 |
168 // The acknowledgment handle for the current invalidation. | 171 // The most up to date invalidation. |
169 syncer::AckHandle ack_handle_; | 172 scoped_ptr<syncer::Invalidation> invalidation_; |
170 | 173 |
171 // WeakPtrFactory used to create callbacks to this object. | 174 // WeakPtrFactory used to create callbacks to this object. |
172 base::WeakPtrFactory<CloudPolicyInvalidator> weak_factory_; | 175 base::WeakPtrFactory<CloudPolicyInvalidator> weak_factory_; |
173 | 176 |
174 // The maximum random delay, in ms, between receiving an invalidation and | 177 // The maximum random delay, in ms, between receiving an invalidation and |
175 // fetching the new policy. | 178 // fetching the new policy. |
176 int max_fetch_delay_; | 179 int max_fetch_delay_; |
177 | 180 |
178 // The hash value of the current policy. This is used to determine if a new | 181 // The hash value of the current policy. This is used to determine if a new |
179 // policy is different from the current one. | 182 // policy is different from the current one. |
180 uint32 policy_hash_value_; | 183 uint32 policy_hash_value_; |
181 | 184 |
182 // A thread checker to make sure that callbacks are invoked on the correct | 185 // A thread checker to make sure that callbacks are invoked on the correct |
183 // thread. | 186 // thread. |
184 base::ThreadChecker thread_checker_; | 187 base::ThreadChecker thread_checker_; |
185 | 188 |
186 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator); | 189 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator); |
187 }; | 190 }; |
188 | 191 |
189 } // namespace policy | 192 } // namespace policy |
190 | 193 |
191 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ | 194 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ |
OLD | NEW |