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 #include "chrome/browser/policy/cloud/cloud_policy_invalidator.h" | 5 #include "chrome/browser/policy/cloud/cloud_policy_invalidator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/hash.h" | 8 #include "base/hash.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 clock_(clock.Pass()), | 43 clock_(clock.Pass()), |
44 invalidation_service_(NULL), | 44 invalidation_service_(NULL), |
45 invalidations_enabled_(false), | 45 invalidations_enabled_(false), |
46 invalidation_service_enabled_(false), | 46 invalidation_service_enabled_(false), |
47 is_registered_(false), | 47 is_registered_(false), |
48 invalid_(false), | 48 invalid_(false), |
49 invalidation_version_(0), | 49 invalidation_version_(0), |
50 unknown_version_invalidation_count_(0), | 50 unknown_version_invalidation_count_(0), |
51 highest_handled_invalidation_version_( | 51 highest_handled_invalidation_version_( |
52 highest_handled_invalidation_version), | 52 highest_handled_invalidation_version), |
53 weak_factory_(this), | |
54 max_fetch_delay_(kMaxFetchDelayDefault), | 53 max_fetch_delay_(kMaxFetchDelayDefault), |
55 policy_hash_value_(0) { | 54 policy_hash_value_(0), |
| 55 weak_factory_(this) { |
56 DCHECK(core); | 56 DCHECK(core); |
57 DCHECK(task_runner.get()); | 57 DCHECK(task_runner.get()); |
58 // |highest_handled_invalidation_version_| indicates the highest actual | 58 // |highest_handled_invalidation_version_| indicates the highest actual |
59 // invalidation version handled. Since actual invalidations can have only | 59 // invalidation version handled. Since actual invalidations can have only |
60 // positive versions, this member may be zero (no versioned invalidation | 60 // positive versions, this member may be zero (no versioned invalidation |
61 // handled yet) or positive. Negative values are not allowed: | 61 // handled yet) or positive. Negative values are not allowed: |
62 // | 62 // |
63 // Negative version numbers are used internally by CloudPolicyInvalidator to | 63 // Negative version numbers are used internally by CloudPolicyInvalidator to |
64 // keep track of unversioned invalidations. When such an invalidation is | 64 // keep track of unversioned invalidations. When such an invalidation is |
65 // handled, |highest_handled_invalidation_version_| remains unchanged and does | 65 // handled, |highest_handled_invalidation_version_| remains unchanged and does |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 bool CloudPolicyInvalidator::GetInvalidationsEnabled() { | 438 bool CloudPolicyInvalidator::GetInvalidationsEnabled() { |
439 if (!invalidations_enabled_) | 439 if (!invalidations_enabled_) |
440 return false; | 440 return false; |
441 // If invalidations have been enabled for less than the grace period, then | 441 // If invalidations have been enabled for less than the grace period, then |
442 // consider invalidations to be disabled for metrics reporting. | 442 // consider invalidations to be disabled for metrics reporting. |
443 base::TimeDelta elapsed = clock_->Now() - invalidations_enabled_time_; | 443 base::TimeDelta elapsed = clock_->Now() - invalidations_enabled_time_; |
444 return elapsed.InSeconds() >= kInvalidationGracePeriod; | 444 return elapsed.InSeconds() >= kInvalidationGracePeriod; |
445 } | 445 } |
446 | 446 |
447 } // namespace policy | 447 } // namespace policy |
OLD | NEW |