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

Side by Side Diff: chrome/browser/policy/policy_statistics_collector.h

Issue 109743002: Move policy code into components/policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: moar fixes Created 7 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_POLICY_POLICY_STATISTICS_COLLECTOR_H_
6 #define CHROME_BROWSER_POLICY_POLICY_STATISTICS_COLLECTOR_H_
7
8 #include "base/basictypes.h"
9 #include "base/cancelable_callback.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/time/time.h"
12 #include "components/policy/core/common/policy_details.h"
13 #include "components/policy/core/common/schema.h"
14
15 class PrefService;
16 class PrefRegistrySimple;
17
18 namespace base {
19 class TaskRunner;
20 }
21
22 namespace policy {
23
24 class PolicyService;
25
26 // Manages regular updates of policy usage UMA histograms.
27 class PolicyStatisticsCollector {
28 public:
29 // Policy usage statistics update rate, in milliseconds.
30 static const int kStatisticsUpdateRate;
31
32 // Neither |policy_service| nor |prefs| can be NULL and must stay valid
33 // throughout the lifetime of PolicyStatisticsCollector.
34 PolicyStatisticsCollector(const GetChromePolicyDetailsCallback& get_details,
35 const Schema& chrome_schema,
36 PolicyService* policy_service,
37 PrefService* prefs,
38 const scoped_refptr<base::TaskRunner>& task_runner);
39 virtual ~PolicyStatisticsCollector();
40
41 // Completes initialization and starts periodical statistic updates.
42 void Initialize();
43
44 static void RegisterPrefs(PrefRegistrySimple* registry);
45
46 protected:
47 // protected virtual for mocking.
48 virtual void RecordPolicyUse(int id);
49
50 private:
51 void CollectStatistics();
52 void ScheduleUpdate(base::TimeDelta delay);
53
54 GetChromePolicyDetailsCallback get_details_;
55 Schema chrome_schema_;
56 PolicyService* policy_service_;
57 PrefService* prefs_;
58
59 base::CancelableClosure update_callback_;
60
61 const scoped_refptr<base::TaskRunner> task_runner_;
62
63 DISALLOW_COPY_AND_ASSIGN(PolicyStatisticsCollector);
64 };
65
66 } // namespace policy
67
68 #endif // CHROME_BROWSER_POLICY_POLICY_STATISTICS_COLLECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/policy_service_stub.cc ('k') | chrome/browser/policy/policy_statistics_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698