| 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> |
| 11 #include <memory> |
| 11 #include <string> | 12 #include <string> |
| 12 #include <vector> | 13 #include <vector> |
| 13 | 14 |
| 14 #include "base/callback_forward.h" | 15 #include "base/callback_forward.h" |
| 15 #include "base/callback_list.h" | 16 #include "base/callback_list.h" |
| 16 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 17 #include "base/macros.h" | 18 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | |
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "base/task/cancelable_task_tracker.h" | 21 #include "base/task/cancelable_task_tracker.h" |
| 22 #include "base/time/time.h" | 22 #include "base/time/time.h" |
| 23 #include "base/timer/timer.h" | 23 #include "base/timer/timer.h" |
| 24 #include "chrome/browser/chromeos/settings/cros_settings.h" | 24 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 25 #include "chromeos/system/version_loader.h" | 25 #include "chromeos/system/version_loader.h" |
| 26 #include "content/public/browser/geolocation_provider.h" | 26 #include "content/public/browser/geolocation_provider.h" |
| 27 #include "content/public/common/geoposition.h" | 27 #include "content/public/common/geoposition.h" |
| 28 #include "policy/proto/device_management_backend.pb.h" | 28 #include "policy/proto/device_management_backend.pb.h" |
| 29 #include "ui/base/idle/idle.h" | 29 #include "ui/base/idle/idle.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Called after the status information has successfully been submitted to | 101 // Called after the status information has successfully been submitted to |
| 102 // the server. | 102 // the server. |
| 103 void OnSubmittedSuccessfully(); | 103 void OnSubmittedSuccessfully(); |
| 104 | 104 |
| 105 static void RegisterPrefs(PrefRegistrySimple* registry); | 105 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 106 | 106 |
| 107 // Returns the DeviceLocalAccount associated with the currently active | 107 // Returns the DeviceLocalAccount associated with the currently active |
| 108 // kiosk session, if the session was auto-launched with zero delay | 108 // kiosk session, if the session was auto-launched with zero delay |
| 109 // (this enables functionality such as network reporting). | 109 // (this enables functionality such as network reporting). |
| 110 // Virtual to allow mocking. | 110 // Virtual to allow mocking. |
| 111 virtual scoped_ptr<DeviceLocalAccount> GetAutoLaunchedKioskSessionInfo(); | 111 virtual std::unique_ptr<DeviceLocalAccount> GetAutoLaunchedKioskSessionInfo(); |
| 112 | 112 |
| 113 // How often, in seconds, to poll to see if the user is idle. | 113 // How often, in seconds, to poll to see if the user is idle. |
| 114 static const unsigned int kIdlePollIntervalSeconds = 30; | 114 static const unsigned int kIdlePollIntervalSeconds = 30; |
| 115 | 115 |
| 116 // The total number of hardware resource usage samples cached internally. | 116 // The total number of hardware resource usage samples cached internally. |
| 117 static const unsigned int kMaxResourceUsageSamples = 10; | 117 static const unsigned int kMaxResourceUsageSamples = 10; |
| 118 | 118 |
| 119 protected: | 119 protected: |
| 120 // Check whether the user has been idle for a certain period of time. | 120 // Check whether the user has been idle for a certain period of time. |
| 121 virtual void CheckIdleState(); | 121 virtual void CheckIdleState(); |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 chromeos::CrosSettings* cros_settings_; | 259 chromeos::CrosSettings* cros_settings_; |
| 260 | 260 |
| 261 // The most recent CPU readings. | 261 // The most recent CPU readings. |
| 262 uint64_t last_cpu_active_; | 262 uint64_t last_cpu_active_; |
| 263 uint64_t last_cpu_idle_; | 263 uint64_t last_cpu_idle_; |
| 264 | 264 |
| 265 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper | 265 // TODO(bartfab): Remove this once crbug.com/125931 is addressed and a proper |
| 266 // way to mock geolocation exists. | 266 // way to mock geolocation exists. |
| 267 LocationUpdateRequester location_update_requester_; | 267 LocationUpdateRequester location_update_requester_; |
| 268 | 268 |
| 269 scoped_ptr<content::GeolocationProvider::Subscription> | 269 std::unique_ptr<content::GeolocationProvider::Subscription> |
| 270 geolocation_subscription_; | 270 geolocation_subscription_; |
| 271 | 271 |
| 272 // Cached values of the reporting settings from the device policy. | 272 // Cached values of the reporting settings from the device policy. |
| 273 bool report_version_info_; | 273 bool report_version_info_; |
| 274 bool report_activity_times_; | 274 bool report_activity_times_; |
| 275 bool report_boot_mode_; | 275 bool report_boot_mode_; |
| 276 bool report_location_; | 276 bool report_location_; |
| 277 bool report_network_interfaces_; | 277 bool report_network_interfaces_; |
| 278 bool report_users_; | 278 bool report_users_; |
| 279 bool report_hardware_status_; | 279 bool report_hardware_status_; |
| 280 bool report_session_status_; | 280 bool report_session_status_; |
| 281 | 281 |
| 282 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 282 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 283 version_info_subscription_; | 283 version_info_subscription_; |
| 284 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 284 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 285 activity_times_subscription_; | 285 activity_times_subscription_; |
| 286 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 286 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 287 boot_mode_subscription_; | 287 boot_mode_subscription_; |
| 288 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 288 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 289 location_subscription_; | 289 location_subscription_; |
| 290 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 290 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 291 network_interfaces_subscription_; | 291 network_interfaces_subscription_; |
| 292 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 292 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 293 users_subscription_; | 293 users_subscription_; |
| 294 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 294 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 295 hardware_status_subscription_; | 295 hardware_status_subscription_; |
| 296 scoped_ptr<chromeos::CrosSettings::ObserverSubscription> | 296 std::unique_ptr<chromeos::CrosSettings::ObserverSubscription> |
| 297 session_status_subscription_; | 297 session_status_subscription_; |
| 298 | 298 |
| 299 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; | 299 base::WeakPtrFactory<DeviceStatusCollector> weak_factory_; |
| 300 | 300 |
| 301 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); | 301 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); |
| 302 }; | 302 }; |
| 303 | 303 |
| 304 } // namespace policy | 304 } // namespace policy |
| 305 | 305 |
| 306 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 306 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
| OLD | NEW |