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

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

Issue 465433002: Separate UMA histograms for user and device policy invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comment. Created 6 years, 4 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 | Annotate | Revision Log
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 <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/compiler_specific.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
15 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
16 #include "components/invalidation/invalidation.h" 17 #include "components/invalidation/invalidation.h"
17 #include "components/invalidation/invalidation_handler.h" 18 #include "components/invalidation/invalidation_handler.h"
18 #include "components/policy/core/common/cloud/cloud_policy_core.h" 19 #include "components/policy/core/common/cloud/cloud_policy_core.h"
19 #include "components/policy/core/common/cloud/cloud_policy_store.h" 20 #include "components/policy/core/common/cloud/cloud_policy_store.h"
20 #include "google/cacheinvalidation/include/types.h" 21 #include "google/cacheinvalidation/include/types.h"
22 #include "policy/proto/device_management_backend.pb.h"
21 23
22 namespace base { 24 namespace base {
23 class Clock; 25 class Clock;
24 class SequencedTaskRunner; 26 class SequencedTaskRunner;
25 } 27 }
26 28
27 namespace invalidation { 29 namespace invalidation {
28 class InvalidationService; 30 class InvalidationService;
29 } 31 }
30 32
(...skipping 18 matching lines...) Expand all
49 static const int kInvalidationGracePeriod; 51 static const int kInvalidationGracePeriod;
50 52
51 // Time, in seconds, for which unknown version invalidations are ignored after 53 // Time, in seconds, for which unknown version invalidations are ignored after
52 // fetching a policy. 54 // fetching a policy.
53 static const int kUnknownVersionIgnorePeriod; 55 static const int kUnknownVersionIgnorePeriod;
54 56
55 // The max tolerated discrepancy, in seconds, between policy timestamps and 57 // The max tolerated discrepancy, in seconds, between policy timestamps and
56 // invalidation timestamps when determining if an invalidation is expired. 58 // invalidation timestamps when determining if an invalidation is expired.
57 static const int kMaxInvalidationTimeDelta; 59 static const int kMaxInvalidationTimeDelta;
58 60
61 // |type| indicates the policy type that this invalidator is responsible for.
59 // |core| is the cloud policy core which connects the various policy objects. 62 // |core| is the cloud policy core which connects the various policy objects.
60 // It must remain valid until Shutdown is called. 63 // It must remain valid until Shutdown is called.
61 // |task_runner| is used for scheduling delayed tasks. It must post tasks to 64 // |task_runner| is used for scheduling delayed tasks. It must post tasks to
62 // the main policy thread. 65 // the main policy thread.
63 // |clock| is used to get the current time. 66 // |clock| is used to get the current time.
64 CloudPolicyInvalidator( 67 CloudPolicyInvalidator(
68 enterprise_management::DeviceRegisterRequest::Type type,
65 CloudPolicyCore* core, 69 CloudPolicyCore* core,
66 const scoped_refptr<base::SequencedTaskRunner>& task_runner, 70 const scoped_refptr<base::SequencedTaskRunner>& task_runner,
67 scoped_ptr<base::Clock> clock); 71 scoped_ptr<base::Clock> clock);
68 virtual ~CloudPolicyInvalidator(); 72 virtual ~CloudPolicyInvalidator();
69 73
70 // Initializes the invalidator. No invalidations will be generated before this 74 // Initializes the invalidator. No invalidations will be generated before this
71 // method is called. This method must only be called once. 75 // method is called. This method must only be called once.
72 // |invalidation_service| is the invalidation service to use and must remain 76 // |invalidation_service| is the invalidation service to use and must remain
73 // valid until Shutdown is called. 77 // valid until Shutdown is called.
74 void Initialize(invalidation::InvalidationService* invalidation_service); 78 void Initialize(invalidation::InvalidationService* invalidation_service);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 153
150 // The state of the object. 154 // The state of the object.
151 enum State { 155 enum State {
152 UNINITIALIZED, 156 UNINITIALIZED,
153 STOPPED, 157 STOPPED,
154 STARTED, 158 STARTED,
155 SHUT_DOWN 159 SHUT_DOWN
156 }; 160 };
157 State state_; 161 State state_;
158 162
163 // The policy type this invalidator is responsible for.
164 const enterprise_management::DeviceRegisterRequest::Type type_;
165
159 // The cloud policy core. 166 // The cloud policy core.
160 CloudPolicyCore* core_; 167 CloudPolicyCore* core_;
161 168
162 // Schedules delayed tasks. 169 // Schedules delayed tasks.
163 const scoped_refptr<base::SequencedTaskRunner> task_runner_; 170 const scoped_refptr<base::SequencedTaskRunner> task_runner_;
164 171
165 // The clock. 172 // The clock.
166 scoped_ptr<base::Clock> clock_; 173 scoped_ptr<base::Clock> clock_;
167 174
168 // The invalidation service. 175 // The invalidation service.
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // A thread checker to make sure that callbacks are invoked on the correct 224 // A thread checker to make sure that callbacks are invoked on the correct
218 // thread. 225 // thread.
219 base::ThreadChecker thread_checker_; 226 base::ThreadChecker thread_checker_;
220 227
221 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator); 228 DISALLOW_COPY_AND_ASSIGN(CloudPolicyInvalidator);
222 }; 229 };
223 230
224 } // namespace policy 231 } // namespace policy
225 232
226 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_ 233 #endif // CHROME_BROWSER_POLICY_CLOUD_CLOUD_POLICY_INVALIDATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698