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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_invalidator.h

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 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 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 12
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/threading/thread_checker.h" 19 #include "base/threading/thread_checker.h"
20 #include "components/invalidation/public/invalidation.h" 20 #include "components/invalidation/public/invalidation.h"
21 #include "components/invalidation/public/invalidation_handler.h" 21 #include "components/invalidation/public/invalidation_handler.h"
22 #include "components/policy/core/common/cloud/cloud_policy_core.h" 22 #include "components/policy/core/common/cloud/cloud_policy_core.h"
23 #include "components/policy/core/common/cloud/cloud_policy_store.h" 23 #include "components/policy/core/common/cloud/cloud_policy_store.h"
24 #include "components/policy/core/common/cloud/enterprise_metrics.h"
24 #include "components/policy/proto/device_management_backend.pb.h" 25 #include "components/policy/proto/device_management_backend.pb.h"
25 #include "google/cacheinvalidation/include/types.h" 26 #include "google/cacheinvalidation/include/types.h"
26 27
27 namespace base { 28 namespace base {
28 class Clock; 29 class Clock;
29 class SequencedTaskRunner; 30 class SequencedTaskRunner;
30 } 31 }
31 32
32 namespace invalidation { 33 namespace invalidation {
33 class InvalidationService; 34 class InvalidationService;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 // Determines if the given policy is different from the policy passed in the 150 // Determines if the given policy is different from the policy passed in the
150 // previous call. 151 // previous call.
151 bool IsPolicyChanged(const enterprise_management::PolicyData* policy); 152 bool IsPolicyChanged(const enterprise_management::PolicyData* policy);
152 153
153 // Determine if an invalidation has expired. 154 // Determine if an invalidation has expired.
154 // |version| is the version of the invalidation, or zero for unknown. 155 // |version| is the version of the invalidation, or zero for unknown.
155 bool IsInvalidationExpired(int64_t version); 156 bool IsInvalidationExpired(int64_t version);
156 157
157 // Get the kMetricPolicyRefresh histogram metric which should be incremented 158 // Get the kMetricPolicyRefresh histogram metric which should be incremented
158 // when a policy is stored. 159 // when a policy is stored.
159 int GetPolicyRefreshMetric(bool policy_changed); 160 MetricPolicyRefresh GetPolicyRefreshMetric(bool policy_changed);
160 161
161 // Get the kMetricPolicyInvalidations histogram metric which should be 162 // Get the kMetricPolicyInvalidations histogram metric which should be
162 // incremented when an invalidation is received. 163 // incremented when an invalidation is received.
163 int GetInvalidationMetric(bool is_missing_payload, bool is_expired); 164 PolicyInvalidationType GetInvalidationMetric(bool is_missing_payload,
165 bool is_expired);
164 166
165 // Determine if invalidations have been enabled longer than the grace period. 167 // Determine if invalidations have been enabled longer than the grace period.
166 bool GetInvalidationsEnabled(); 168 bool GetInvalidationsEnabled();
167 169
168 // The state of the object. 170 // The state of the object.
169 enum State { 171 enum State {
170 UNINITIALIZED, 172 UNINITIALIZED,
171 STOPPED, 173 STOPPED,
172 STARTED, 174 STARTED,
173 SHUT_DOWN 175 SHUT_DOWN
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 243
242 // WeakPtrFactory used to create callbacks to this object. 244 // WeakPtrFactory used to create callbacks to this object.
243 base::WeakPtrFactory<CloudPolicyInvalidator> weak_factory_; 245 base::WeakPtrFactory<CloudPolicyInvalidator> weak_factory_;
244 246
245 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator); 247 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator);
246 }; 248 };
247 249
248 } // namespace policy 250 } // namespace policy
249 251
250 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ 252 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698