| Index: chrome/browser/policy/device_status_collector.h
|
| diff --git a/chrome/browser/policy/device_status_collector.h b/chrome/browser/policy/device_status_collector.h
|
| index 4afffcb09a12ae3b33f9fd7ac157e2aa46c3ca29..254a3186b76ecfff903c84d8838cf2019f893bc6 100644
|
| --- a/chrome/browser/policy/device_status_collector.h
|
| +++ b/chrome/browser/policy/device_status_collector.h
|
| @@ -6,11 +6,19 @@
|
| #define CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_
|
| #pragma once
|
|
|
| +#include <string>
|
| +
|
| +#include "base/basictypes.h"
|
| +#include "base/compiler_specific.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/time.h"
|
| #include "base/timer.h"
|
| +#include "chrome/browser/cancelable_request.h"
|
| #include "chrome/browser/chromeos/version_loader.h"
|
| #include "chrome/browser/idle.h"
|
| +#include "content/public/browser/geolocation.h"
|
| #include "content/public/browser/notification_observer.h"
|
| +#include "content/public/common/geoposition.h"
|
|
|
| namespace chromeos {
|
| class CrosSettings;
|
| @@ -19,6 +27,11 @@ class StatisticsProvider;
|
| }
|
| }
|
|
|
| +namespace content {
|
| +class NotificationDetails;
|
| +class NotificationSource;
|
| +}
|
| +
|
| namespace enterprise_management {
|
| class DeviceStatusReportRequest;
|
| }
|
| @@ -30,8 +43,14 @@ namespace policy {
|
| // Collects and summarizes the status of an enterprised-managed ChromeOS device.
|
| class DeviceStatusCollector : public content::NotificationObserver {
|
| public:
|
| + // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper
|
| + // way to mock geolocation exists.
|
| + typedef void(*LocationUpdateRequester)(
|
| + const content::GeolocationUpdateCallback& callback);
|
| +
|
| DeviceStatusCollector(PrefService* local_state,
|
| - chromeos::system::StatisticsProvider* provider);
|
| + chromeos::system::StatisticsProvider* provider,
|
| + LocationUpdateRequester location_update_requester);
|
| virtual ~DeviceStatusCollector();
|
|
|
| void GetStatus(enterprise_management::DeviceStatusReportRequest* request);
|
| @@ -39,7 +58,7 @@ class DeviceStatusCollector : public content::NotificationObserver {
|
| static void RegisterPrefs(PrefService* local_state);
|
|
|
| // How often, in seconds, to poll to see if the user is idle.
|
| - static const unsigned int kPollIntervalSeconds = 30;
|
| + static const unsigned int kIdlePollIntervalSeconds = 30;
|
|
|
| protected:
|
| // Check whether the user has been idle for a certain period of time.
|
| @@ -80,6 +99,8 @@ class DeviceStatusCollector : public content::NotificationObserver {
|
| enterprise_management::DeviceStatusReportRequest* request);
|
| void GetBootMode(
|
| enterprise_management::DeviceStatusReportRequest* request);
|
| + void GetLocation(
|
| + enterprise_management::DeviceStatusReportRequest* request);
|
|
|
| // Update the cached values of the reporting settings.
|
| void UpdateReportingSettings();
|
| @@ -90,6 +111,11 @@ class DeviceStatusCollector : public content::NotificationObserver {
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) OVERRIDE;
|
|
|
| + void ScheduleGeolocationUpdateRequest();
|
| +
|
| + // content::GeolocationUpdateCallback implementation.
|
| + void ReceiveGeolocationUpdate(const content::Geoposition&);
|
| +
|
| // How often to poll to see if the user is idle.
|
| int poll_interval_seconds_;
|
|
|
| @@ -98,7 +124,11 @@ class DeviceStatusCollector : public content::NotificationObserver {
|
| // The last time an idle state check was performed.
|
| base::Time last_idle_check_;
|
|
|
| - base::RepeatingTimer<DeviceStatusCollector> timer_;
|
| + // Whether a geolocation update is currently in progress.
|
| + bool geolocation_update_in_progress_;
|
| +
|
| + base::RepeatingTimer<DeviceStatusCollector> idle_poll_timer_;
|
| + base::OneShotTimer<DeviceStatusCollector> geolocation_update_timer_;
|
|
|
| chromeos::VersionLoader version_loader_;
|
| CancelableRequestConsumer consumer_;
|
| @@ -106,14 +136,23 @@ class DeviceStatusCollector : public content::NotificationObserver {
|
| std::string os_version_;
|
| std::string firmware_version_;
|
|
|
| + content::Geoposition position_;
|
| +
|
| chromeos::system::StatisticsProvider* statistics_provider_;
|
|
|
| chromeos::CrosSettings* cros_settings_;
|
|
|
| + base::WeakPtrFactory<DeviceStatusCollector> weak_factory_;
|
| +
|
| + // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper
|
| + // way to mock geolocation exists.
|
| + LocationUpdateRequester location_update_requester_;
|
| +
|
| // Cached values of the reporting settings from the device policy.
|
| bool report_version_info_;
|
| bool report_activity_times_;
|
| bool report_boot_mode_;
|
| + bool report_location_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector);
|
| };
|
|
|