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 25 matching lines...) Expand all Loading... |
36 namespace content { | 36 namespace content { |
37 class NotificationDetails; | 37 class NotificationDetails; |
38 class NotificationSource; | 38 class NotificationSource; |
39 } | 39 } |
40 | 40 |
41 class PrefRegistrySimple; | 41 class PrefRegistrySimple; |
42 class PrefService; | 42 class PrefService; |
43 | 43 |
44 namespace policy { | 44 namespace policy { |
45 | 45 |
| 46 struct DeviceLocalAccount; |
| 47 |
46 // Collects and summarizes the status of an enterprised-managed ChromeOS device. | 48 // Collects and summarizes the status of an enterprised-managed ChromeOS device. |
47 class DeviceStatusCollector { | 49 class DeviceStatusCollector { |
48 public: | 50 public: |
49 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper | 51 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper |
50 // way to mock geolocation exists. | 52 // way to mock geolocation exists. |
51 typedef base::Callback<void( | 53 typedef base::Callback<void( |
52 const content::GeolocationProvider::LocationUpdateCallback& callback)> | 54 const content::GeolocationProvider::LocationUpdateCallback& callback)> |
53 LocationUpdateRequester; | 55 LocationUpdateRequester; |
54 | 56 |
55 using VolumeInfoFetcher = base::Callback< | 57 using VolumeInfoFetcher = base::Callback< |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 protected: | 94 protected: |
93 // Check whether the user has been idle for a certain period of time. | 95 // Check whether the user has been idle for a certain period of time. |
94 virtual void CheckIdleState(); | 96 virtual void CheckIdleState(); |
95 | 97 |
96 // Used instead of base::Time::Now(), to make testing possible. | 98 // Used instead of base::Time::Now(), to make testing possible. |
97 virtual base::Time GetCurrentTime(); | 99 virtual base::Time GetCurrentTime(); |
98 | 100 |
99 // Callback which receives the results of the idle state check. | 101 // Callback which receives the results of the idle state check. |
100 void IdleStateCallback(ui::IdleState state); | 102 void IdleStateCallback(ui::IdleState state); |
101 | 103 |
102 // Returns true if the currently active session is an auto-launched | 104 // Returns the DeviceLocalAccount associated with the currently active |
103 // kiosk session (this enables functionality such as network reporting). | 105 // kiosk session, if the session was auto-launched with zero delay |
| 106 // (this enables functionality such as network reporting). |
104 // Virtual to allow mocking. | 107 // Virtual to allow mocking. |
105 virtual bool IsAutoLaunchedKioskSession(); | 108 virtual scoped_ptr<DeviceLocalAccount> GetAutoLaunchedKioskSessionInfo(); |
106 | 109 |
107 // Samples the current CPU and RAM usage and updates our cache of samples. | 110 // Samples the current CPU and RAM usage and updates our cache of samples. |
108 void SampleResourceUsage(); | 111 void SampleResourceUsage(); |
109 | 112 |
110 // Returns the percentage of total CPU that each process uses. Virtual so it | 113 // Returns the percentage of total CPU that each process uses. Virtual so it |
111 // can be mocked. | 114 // can be mocked. |
112 virtual std::vector<double> GetPerProcessCPUUsage(); | 115 virtual std::vector<double> GetPerProcessCPUUsage(); |
113 | 116 |
| 117 // Gets the version of the passed app. Virtual to allow mocking. |
| 118 virtual std::string GetAppVersion(const std::string& app_id); |
| 119 |
114 // The number of days in the past to store device activity. | 120 // The number of days in the past to store device activity. |
115 // This is kept in case device status uploads fail for a number of days. | 121 // This is kept in case device status uploads fail for a number of days. |
116 unsigned int max_stored_past_activity_days_; | 122 unsigned int max_stored_past_activity_days_; |
117 | 123 |
118 // The number of days in the future to store device activity. | 124 // The number of days in the future to store device activity. |
119 // When changing the system time and/or timezones, it's possible to record | 125 // When changing the system time and/or timezones, it's possible to record |
120 // activity time that is slightly in the future. | 126 // activity time that is slightly in the future. |
121 unsigned int max_stored_future_activity_days_; | 127 unsigned int max_stored_future_activity_days_; |
122 | 128 |
123 private: | 129 private: |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 session_status_subscription_; | 261 session_status_subscription_; |
256 | 262 |
257 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; | 263 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; |
258 | 264 |
259 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); | 265 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); |
260 }; | 266 }; |
261 | 267 |
262 } // namespace policy | 268 } // namespace policy |
263 | 269 |
264 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 270 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
OLD | NEW |