| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
| 6 #define CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 namespace content { | 30 namespace content { |
| 31 class NotificationDetails; | 31 class NotificationDetails; |
| 32 class NotificationSource; | 32 class NotificationSource; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace enterprise_management { | 35 namespace enterprise_management { |
| 36 class DeviceStatusReportRequest; | 36 class DeviceStatusReportRequest; |
| 37 } | 37 } |
| 38 | 38 |
| 39 class PrefService; | 39 class PrefService; |
| 40 class PrefServiceSimple; |
| 40 | 41 |
| 41 namespace policy { | 42 namespace policy { |
| 42 | 43 |
| 43 // Collects and summarizes the status of an enterprised-managed ChromeOS device. | 44 // Collects and summarizes the status of an enterprised-managed ChromeOS device. |
| 44 class DeviceStatusCollector : public CloudPolicyClient::StatusProvider, | 45 class DeviceStatusCollector : public CloudPolicyClient::StatusProvider, |
| 45 public content::NotificationObserver { | 46 public content::NotificationObserver { |
| 46 public: | 47 public: |
| 47 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper | 48 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper |
| 48 // way to mock geolocation exists. | 49 // way to mock geolocation exists. |
| 49 typedef void(*LocationUpdateRequester)( | 50 typedef void(*LocationUpdateRequester)( |
| 50 const content::GeolocationUpdateCallback& callback); | 51 const content::GeolocationUpdateCallback& callback); |
| 51 | 52 |
| 52 DeviceStatusCollector(PrefService* local_state, | 53 DeviceStatusCollector(PrefService* local_state, |
| 53 chromeos::system::StatisticsProvider* provider, | 54 chromeos::system::StatisticsProvider* provider, |
| 54 LocationUpdateRequester location_update_requester); | 55 LocationUpdateRequester location_update_requester); |
| 55 virtual ~DeviceStatusCollector(); | 56 virtual ~DeviceStatusCollector(); |
| 56 | 57 |
| 57 void GetStatus(enterprise_management::DeviceStatusReportRequest* request); | 58 void GetStatus(enterprise_management::DeviceStatusReportRequest* request); |
| 58 | 59 |
| 59 // CloudPolicyClient::StatusProvider: | 60 // CloudPolicyClient::StatusProvider: |
| 60 virtual bool GetDeviceStatus( | 61 virtual bool GetDeviceStatus( |
| 61 enterprise_management::DeviceStatusReportRequest* status) OVERRIDE; | 62 enterprise_management::DeviceStatusReportRequest* status) OVERRIDE; |
| 62 virtual bool GetSessionStatus( | 63 virtual bool GetSessionStatus( |
| 63 enterprise_management::SessionStatusReportRequest* status) OVERRIDE; | 64 enterprise_management::SessionStatusReportRequest* status) OVERRIDE; |
| 64 virtual void OnSubmittedSuccessfully() OVERRIDE; | 65 virtual void OnSubmittedSuccessfully() OVERRIDE; |
| 65 | 66 |
| 66 static void RegisterPrefs(PrefService* local_state); | 67 static void RegisterPrefs(PrefServiceSimple* local_state); |
| 67 | 68 |
| 68 // How often, in seconds, to poll to see if the user is idle. | 69 // How often, in seconds, to poll to see if the user is idle. |
| 69 static const unsigned int kIdlePollIntervalSeconds = 30; | 70 static const unsigned int kIdlePollIntervalSeconds = 30; |
| 70 | 71 |
| 71 protected: | 72 protected: |
| 72 // Check whether the user has been idle for a certain period of time. | 73 // Check whether the user has been idle for a certain period of time. |
| 73 virtual void CheckIdleState(); | 74 virtual void CheckIdleState(); |
| 74 | 75 |
| 75 // Used instead of base::Time::Now(), to make testing possible. | 76 // Used instead of base::Time::Now(), to make testing possible. |
| 76 virtual base::Time GetCurrentTime(); | 77 virtual base::Time GetCurrentTime(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 bool report_activity_times_; | 174 bool report_activity_times_; |
| 174 bool report_boot_mode_; | 175 bool report_boot_mode_; |
| 175 bool report_location_; | 176 bool report_location_; |
| 176 | 177 |
| 177 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); | 178 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); |
| 178 }; | 179 }; |
| 179 | 180 |
| 180 } // namespace policy | 181 } // namespace policy |
| 181 | 182 |
| 182 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 183 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
| OLD | NEW |