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

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

Issue 8702009: Add device status reports to policy requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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_REPORTER_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_STATUS_REPORTER_H_
7 #pragma once
8
9 #include "base/time.h"
10 #include "chrome/browser/idle.h"
11
12 namespace enterprise_management {
13 class DeviceStatusReportRequest;
14 }
15
16 class PrefService;
17
18 namespace policy {
19
20 // Collects and reports the status of an enterprised-managed ChromeOS device.
21 class DeviceStatusReporter {
22 public:
23 explicit DeviceStatusReporter(PrefService* local_state);
24
25 void GetStatus(enterprise_management::DeviceStatusReportRequest* request);
26
27 protected:
28 // Check whether the user has been idle for a certain period of time.
29 void CheckIdleState();
30
31 // Callback which receives the results of the idle state check.
32 void IdleStateCallback(IdleState state);
33
34 private:
35 void AddActivePeriod(base::Time start, base::Time end);
36
37 // Since ListValue does not support int64 members, timestamps for active
38 // periods are stored as integer offsets from a reference time, which is
39 // a time_t value representing seconds since Jan 1, 1970 UTC.
40 // These methods convert to and from the offset representation.
41 int ToInternalTime(const base::Time& time);
42 base::Time FromInternalTime(int offset);
43
44 // How often to poll to see if the user is idle.
45 int poll_interval_seconds_;
46
47 PrefService* local_state_;
48
49 // The last time an idle state check was performed.
50 base::Time last_idle_check_;
51
52 // The idle state the last time it was checked.
53 IdleState last_idle_state_;
54
55 DISALLOW_COPY_AND_ASSIGN(DeviceStatusReporter);
56 };
57
58 } // namespace policy
59
60 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_REPORTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698