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

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

Issue 8702009: Add device status reports to policy requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove some now-dead code. Created 9 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) 2011 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_DEVICE_STATUS_COLLECTOR_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_
7 #pragma once
8
9 #include "base/time.h"
10 #include "base/timer.h"
11 #include "chrome/browser/idle.h"
12
13 using base::Time;
14
15 namespace enterprise_management {
16 class DeviceStatusReportRequest;
17 }
18
19 class PrefService;
20
21 namespace policy {
22
23 // Collects and summarizes the status of an enterprised-managed ChromeOS device.
24 class DeviceStatusCollector {
25 public:
26 explicit DeviceStatusCollector(PrefService* local_state);
27 virtual ~DeviceStatusCollector();
28
29 void GetStatus(enterprise_management::DeviceStatusReportRequest* request);
30
31 static void RegisterPrefs(PrefService* local_state);
32
33 // How often, in seconds, to poll to see if the user is idle.
34 static const unsigned int kPollIntervalSeconds = 30;
35
36 protected:
37 // Check whether the user has been idle for a certain period of time.
38 virtual void CheckIdleState();
39
40 // Used instead of Time::Now(), to make testing possible.
41 virtual Time GetCurrentTime();
42
43 // Callback which receives the results of the idle state check.
44 void IdleStateCallback(IdleState state);
45
46 // The maximum number of active periods timestamps to be stored.
47 unsigned int max_stored_active_periods_;
48
49 private:
50 void AddActivePeriod(base::Time start, base::Time end);
51
52 // How often to poll to see if the user is idle.
53 int poll_interval_seconds_;
54
55 PrefService* local_state_;
56
57 // The last time an idle state check was performed.
58 Time last_idle_check_;
59
60 // The idle state the last time it was checked.
61 IdleState last_idle_state_;
62
63 base::RepeatingTimer<DeviceStatusCollector> timer_;
64
65 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector);
66 };
67
68 } // namespace policy
69
70 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/policy/device_management_service_unittest.cc ('k') | chrome/browser/policy/device_status_collector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698