| Index: chrome/browser/policy/device_status_reporter.h
|
| diff --git a/chrome/browser/policy/device_status_reporter.h b/chrome/browser/policy/device_status_reporter.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ee9a093334e5f5ab402b39afff58f6f0eb4f3c08
|
| --- /dev/null
|
| +++ b/chrome/browser/policy/device_status_reporter.h
|
| @@ -0,0 +1,60 @@
|
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_POLICY_DEVICE_STATUS_REPORTER_H_
|
| +#define CHROME_BROWSER_POLICY_DEVICE_STATUS_REPORTER_H_
|
| +#pragma once
|
| +
|
| +#include "base/time.h"
|
| +#include "chrome/browser/idle.h"
|
| +
|
| +namespace enterprise_management {
|
| +class DeviceStatusReportRequest;
|
| +}
|
| +
|
| +class PrefService;
|
| +
|
| +namespace policy {
|
| +
|
| +// Collects and reports the status of an enterprised-managed ChromeOS device.
|
| +class DeviceStatusReporter {
|
| + public:
|
| + explicit DeviceStatusReporter(PrefService* local_state);
|
| +
|
| + void GetStatus(enterprise_management::DeviceStatusReportRequest* request);
|
| +
|
| + protected:
|
| + // Check whether the user has been idle for a certain period of time.
|
| + void CheckIdleState();
|
| +
|
| + // Callback which receives the results of the idle state check.
|
| + void IdleStateCallback(IdleState state);
|
| +
|
| + private:
|
| + void AddActivePeriod(base::Time start, base::Time end);
|
| +
|
| + // Since ListValue does not support int64 members, timestamps for active
|
| + // periods are stored as integer offsets from a reference time, which is
|
| + // a time_t value representing seconds since Jan 1, 1970 UTC.
|
| + // These methods convert to and from the offset representation.
|
| + int ToInternalTime(const base::Time& time);
|
| + base::Time FromInternalTime(int offset);
|
| +
|
| + // How often to poll to see if the user is idle.
|
| + int poll_interval_seconds_;
|
| +
|
| + PrefService* local_state_;
|
| +
|
| + // The last time an idle state check was performed.
|
| + base::Time last_idle_check_;
|
| +
|
| + // The idle state the last time it was checked.
|
| + IdleState last_idle_state_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(DeviceStatusReporter);
|
| +};
|
| +
|
| +} // namespace policy
|
| +
|
| +#endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_REPORTER_H_
|
|
|