| 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_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 // is disabled, or because the active session is not a kiosk session). | 88 // is disabled, or because the active session is not a kiosk session). |
| 89 virtual bool GetDeviceSessionStatus( | 89 virtual bool GetDeviceSessionStatus( |
| 90 enterprise_management::SessionStatusReportRequest* status); | 90 enterprise_management::SessionStatusReportRequest* status); |
| 91 | 91 |
| 92 // Called after the status information has successfully been submitted to | 92 // Called after the status information has successfully been submitted to |
| 93 // the server. | 93 // the server. |
| 94 void OnSubmittedSuccessfully(); | 94 void OnSubmittedSuccessfully(); |
| 95 | 95 |
| 96 static void RegisterPrefs(PrefRegistrySimple* registry); | 96 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 97 | 97 |
| 98 // Returns the DeviceLocalAccount associated with the currently active |
| 99 // kiosk session, if the session was auto-launched with zero delay |
| 100 // (this enables functionality such as network reporting). |
| 101 // Virtual to allow mocking. |
| 102 virtual scoped_ptr<DeviceLocalAccount> GetAutoLaunchedKioskSessionInfo(); |
| 103 |
| 98 // How often, in seconds, to poll to see if the user is idle. | 104 // How often, in seconds, to poll to see if the user is idle. |
| 99 static const unsigned int kIdlePollIntervalSeconds = 30; | 105 static const unsigned int kIdlePollIntervalSeconds = 30; |
| 100 | 106 |
| 101 // The total number of hardware resource usage samples cached internally. | 107 // The total number of hardware resource usage samples cached internally. |
| 102 static const unsigned int kMaxResourceUsageSamples = 10; | 108 static const unsigned int kMaxResourceUsageSamples = 10; |
| 103 | 109 |
| 104 protected: | 110 protected: |
| 105 // Check whether the user has been idle for a certain period of time. | 111 // Check whether the user has been idle for a certain period of time. |
| 106 virtual void CheckIdleState(); | 112 virtual void CheckIdleState(); |
| 107 | 113 |
| 108 // Used instead of base::Time::Now(), to make testing possible. | 114 // Used instead of base::Time::Now(), to make testing possible. |
| 109 virtual base::Time GetCurrentTime(); | 115 virtual base::Time GetCurrentTime(); |
| 110 | 116 |
| 111 // Callback which receives the results of the idle state check. | 117 // Callback which receives the results of the idle state check. |
| 112 void IdleStateCallback(ui::IdleState state); | 118 void IdleStateCallback(ui::IdleState state); |
| 113 | 119 |
| 114 // Returns the DeviceLocalAccount associated with the currently active | |
| 115 // kiosk session, if the session was auto-launched with zero delay | |
| 116 // (this enables functionality such as network reporting). | |
| 117 // Virtual to allow mocking. | |
| 118 virtual scoped_ptr<DeviceLocalAccount> GetAutoLaunchedKioskSessionInfo(); | |
| 119 | |
| 120 // Gets the version of the passed app. Virtual to allow mocking. | 120 // Gets the version of the passed app. Virtual to allow mocking. |
| 121 virtual std::string GetAppVersion(const std::string& app_id); | 121 virtual std::string GetAppVersion(const std::string& app_id); |
| 122 | 122 |
| 123 // Samples the current hardware status to be sent up with the next device | 123 // Samples the current hardware status to be sent up with the next device |
| 124 // status update. | 124 // status update. |
| 125 void SampleHardwareStatus(); | 125 void SampleHardwareStatus(); |
| 126 | 126 |
| 127 // The number of days in the past to store device activity. | 127 // The number of days in the past to store device activity. |
| 128 // This is kept in case device status uploads fail for a number of days. | 128 // This is kept in case device status uploads fail for a number of days. |
| 129 unsigned int max_stored_past_activity_days_; | 129 unsigned int max_stored_past_activity_days_; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 session_status_subscription_; | 278 session_status_subscription_; |
| 279 | 279 |
| 280 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; | 280 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; |
| 281 | 281 |
| 282 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); | 282 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 } // namespace policy | 285 } // namespace policy |
| 286 | 286 |
| 287 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 287 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
| OLD | NEW |