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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 void GetBootMode( | 171 void GetBootMode( |
172 enterprise_management::DeviceStatusReportRequest* request); | 172 enterprise_management::DeviceStatusReportRequest* request); |
173 void GetLocation( | 173 void GetLocation( |
174 enterprise_management::DeviceStatusReportRequest* request); | 174 enterprise_management::DeviceStatusReportRequest* request); |
175 void GetNetworkInterfaces( | 175 void GetNetworkInterfaces( |
176 enterprise_management::DeviceStatusReportRequest* request); | 176 enterprise_management::DeviceStatusReportRequest* request); |
177 void GetUsers( | 177 void GetUsers( |
178 enterprise_management::DeviceStatusReportRequest* request); | 178 enterprise_management::DeviceStatusReportRequest* request); |
179 void GetHardwareStatus( | 179 void GetHardwareStatus( |
180 enterprise_management::DeviceStatusReportRequest* request); | 180 enterprise_management::DeviceStatusReportRequest* request); |
| 181 bool GetOsUpdateStatus( |
| 182 enterprise_management::DeviceStatusReportRequest* request); |
| 183 bool GetRunningKioskApp( |
| 184 enterprise_management::DeviceStatusReportRequest* request); |
181 | 185 |
182 // Update the cached values of the reporting settings. | 186 // Update the cached values of the reporting settings. |
183 void UpdateReportingSettings(); | 187 void UpdateReportingSettings(); |
184 | 188 |
185 void ScheduleGeolocationUpdateRequest(); | 189 void ScheduleGeolocationUpdateRequest(); |
186 | 190 |
187 // content::GeolocationUpdateCallback implementation. | 191 // content::GeolocationUpdateCallback implementation. |
188 void ReceiveGeolocationUpdate(const content::Geoposition&); | 192 void ReceiveGeolocationUpdate(const content::Geoposition&); |
189 | 193 |
190 // Callback invoked to update our cached disk information. | 194 // Callback invoked to update our cached disk information. |
191 void ReceiveVolumeInfo( | 195 void ReceiveVolumeInfo( |
192 const std::vector<enterprise_management::VolumeInfo>& info); | 196 const std::vector<enterprise_management::VolumeInfo>& info); |
193 | 197 |
194 // Callback invoked to update our cpu usage information. | 198 // Callback invoked to update our cpu usage information. |
195 void ReceiveCPUStatistics(const std::string& statistics); | 199 void ReceiveCPUStatistics(const std::string& statistics); |
196 | 200 |
197 // Callback invoked to update our CPU temp information. | 201 // Callback invoked to update our CPU temp information. |
198 void StoreCPUTempInfo( | 202 void StoreCPUTempInfo( |
199 const std::vector<enterprise_management::CPUTempInfo>& info); | 203 const std::vector<enterprise_management::CPUTempInfo>& info); |
200 | 204 |
201 // Helper routine to convert from Shill-provided signal strength (percent) | 205 // Helper routine to convert from Shill-provided signal strength (percent) |
202 // to dBm units expected by server. | 206 // to dBm units expected by server. |
203 int ConvertWifiSignalStrength(int signal_strength); | 207 int ConvertWifiSignalStrength(int signal_strength); |
204 | 208 |
205 PrefService* local_state_; | 209 PrefService* const local_state_; |
206 | 210 |
207 // The last time an idle state check was performed. | 211 // The last time an idle state check was performed. |
208 base::Time last_idle_check_; | 212 base::Time last_idle_check_; |
209 | 213 |
210 // The maximum key that went into the last report generated by | 214 // The maximum key that went into the last report generated by |
211 // GetDeviceStatus(), and the duration for it. This is used to trim the | 215 // GetDeviceStatus(), and the duration for it. This is used to trim the |
212 // stored data in OnSubmittedSuccessfully(). Trimming is delayed so | 216 // stored data in OnSubmittedSuccessfully(). Trimming is delayed so |
213 // unsuccessful uploads don't result in dropped data. | 217 // unsuccessful uploads don't result in dropped data. |
214 int64_t last_reported_day_; | 218 int64_t last_reported_day_ = 0; |
215 int duration_for_last_reported_day_; | 219 int duration_for_last_reported_day_ = 0; |
216 | 220 |
217 // Whether a geolocation update is currently in progress. | 221 // Whether a geolocation update is currently in progress. |
218 bool geolocation_update_in_progress_; | 222 bool geolocation_update_in_progress_ = false; |
219 | 223 |
220 base::RepeatingTimer idle_poll_timer_; | 224 base::RepeatingTimer idle_poll_timer_; |
221 base::RepeatingTimer hardware_status_sampling_timer_; | 225 base::RepeatingTimer hardware_status_sampling_timer_; |
222 base::OneShotTimer geolocation_update_timer_; | 226 base::OneShotTimer geolocation_update_timer_; |
223 | 227 |
224 std::string os_version_; | 228 std::string os_version_; |
225 std::string firmware_version_; | 229 std::string firmware_version_; |
226 | 230 |
227 content::Geoposition position_; | 231 content::Geoposition position_; |
228 | 232 |
(...skipping 18 matching lines...) Expand all Loading... |
247 | 251 |
248 // Callback invoked to fetch information about the mounted disk volumes. | 252 // Callback invoked to fetch information about the mounted disk volumes. |
249 VolumeInfoFetcher volume_info_fetcher_; | 253 VolumeInfoFetcher volume_info_fetcher_; |
250 | 254 |
251 // Callback invoked to fetch information about cpu usage. | 255 // Callback invoked to fetch information about cpu usage. |
252 CPUStatisticsFetcher cpu_statistics_fetcher_; | 256 CPUStatisticsFetcher cpu_statistics_fetcher_; |
253 | 257 |
254 // Callback invoked to fetch information about cpu temperature. | 258 // Callback invoked to fetch information about cpu temperature. |
255 CPUTempFetcher cpu_temp_fetcher_; | 259 CPUTempFetcher cpu_temp_fetcher_; |
256 | 260 |
257 chromeos::system::StatisticsProvider* statistics_provider_; | 261 chromeos::system::StatisticsProvider* const statistics_provider_; |
258 | 262 |
259 chromeos::CrosSettings* cros_settings_; | 263 chromeos::CrosSettings* const cros_settings_; |
260 | 264 |
261 // The most recent CPU readings. | 265 // The most recent CPU readings. |
262 uint64_t last_cpu_active_; | 266 uint64_t last_cpu_active_ = 0; |
263 uint64_t last_cpu_idle_; | 267 uint64_t last_cpu_idle_ = 0; |
264 | 268 |
265 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper | 269 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper |
266 // way to mock geolocation exists. | 270 // way to mock geolocation exists. |
267 LocationUpdateRequester location_update_requester_; | 271 LocationUpdateRequester location_update_requester_; |
268 | 272 |
269 std::unique_ptr<content::GeolocationProvider::Subscription> | 273 std::unique_ptr<content::GeolocationProvider::Subscription> |
270 geolocation_subscription_; | 274 geolocation_subscription_; |
271 | 275 |
272 // Cached values of the reporting settings from the device policy. | 276 // Cached values of the reporting settings from the device policy. |
273 bool report_version_info_; | 277 bool report_version_info_ = false; |
274 bool report_activity_times_; | 278 bool report_activity_times_ = false; |
275 bool report_boot_mode_; | 279 bool report_boot_mode_ = false; |
276 bool report_location_; | 280 bool report_location_ = false; |
277 bool report_network_interfaces_; | 281 bool report_network_interfaces_ = false; |
278 bool report_users_; | 282 bool report_users_ = false; |
279 bool report_hardware_status_; | 283 bool report_hardware_status_ = false; |
280 bool report_session_status_; | 284 bool report_session_status_ = false; |
| 285 bool report_os_update_status_ = false; |
| 286 bool report_running_kiosk_app_ = false; |
281 | 287 |
282 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 288 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
283 version_info_subscription_; | 289 version_info_subscription_; |
284 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 290 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
285 activity_times_subscription_; | 291 activity_times_subscription_; |
286 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 292 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
287 boot_mode_subscription_; | 293 boot_mode_subscription_; |
288 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 294 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
289 location_subscription_; | 295 location_subscription_; |
290 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 296 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
291 network_interfaces_subscription_; | 297 network_interfaces_subscription_; |
292 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 298 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
293 users_subscription_; | 299 users_subscription_; |
294 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 300 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
295 hardware_status_subscription_; | 301 hardware_status_subscription_; |
296 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> | 302 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
297 session_status_subscription_; | 303 session_status_subscription_; |
| 304 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 305 os_update_status_subscription_; |
| 306 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 307 running_kiosk_app_subscription_; |
298 | 308 |
299 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; | 309 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; |
300 | 310 |
301 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); | 311 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); |
302 }; | 312 }; |
303 | 313 |
304 } // namespace policy | 314 } // namespace policy |
305 | 315 |
306 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 316 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
OLD | NEW |