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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/timer.h" | 10 #include "base/timer.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 protected: | 44 protected: |
45 // Check whether the user has been idle for a certain period of time. | 45 // Check whether the user has been idle for a certain period of time. |
46 virtual void CheckIdleState(); | 46 virtual void CheckIdleState(); |
47 | 47 |
48 // Used instead of base::Time::Now(), to make testing possible. | 48 // Used instead of base::Time::Now(), to make testing possible. |
49 virtual base::Time GetCurrentTime(); | 49 virtual base::Time GetCurrentTime(); |
50 | 50 |
51 // Callback which receives the results of the idle state check. | 51 // Callback which receives the results of the idle state check. |
52 void IdleStateCallback(IdleState state); | 52 void IdleStateCallback(IdleState state); |
53 | 53 |
54 // The maximum number of active periods timestamps to be stored. | 54 // The number of days in the past to store device activity. |
55 unsigned int max_stored_active_periods_; | 55 // This is kept in case device status uploads fail for a number of days. |
56 unsigned int max_stored_past_activity_days_; | |
57 | |
58 // The number of days in the future to store device activity. | |
59 // When changing the system time and/or timezones, it's possible to record | |
60 // activity time that is slightly in the future. | |
61 unsigned int max_stored_future_activity_days_; | |
56 | 62 |
57 private: | 63 private: |
64 // Cleans up the locally stored activity periods if there are too many. | |
Mattias Nissler (ping if slow)
2012/02/15 14:56:21
s/if there are too many/that fall outside of the a
Patrick Dubroy
2012/02/15 15:37:25
Done.
| |
65 void PruneStoredActivityPeriods(base::Time base_time); | |
66 | |
58 void AddActivePeriod(base::Time start, base::Time end); | 67 void AddActivePeriod(base::Time start, base::Time end); |
59 | 68 |
60 // Callbacks from chromeos::VersionLoader. | 69 // Callbacks from chromeos::VersionLoader. |
61 void OnOSVersion(chromeos::VersionLoader::Handle handle, | 70 void OnOSVersion(chromeos::VersionLoader::Handle handle, |
62 std::string version); | 71 std::string version); |
63 void OnOSFirmware(chromeos::VersionLoader::Handle handle, | 72 void OnOSFirmware(chromeos::VersionLoader::Handle handle, |
64 std::string version); | 73 std::string version); |
65 | 74 |
66 // Helpers for the various portions of the status. | 75 // Helpers for the various portions of the status. |
67 void GetActivityTimes( | 76 void GetActivityTimes( |
(...skipping 13 matching lines...) Expand all Loading... | |
81 const content::NotificationDetails& details) OVERRIDE; | 90 const content::NotificationDetails& details) OVERRIDE; |
82 | 91 |
83 // How often to poll to see if the user is idle. | 92 // How often to poll to see if the user is idle. |
84 int poll_interval_seconds_; | 93 int poll_interval_seconds_; |
85 | 94 |
86 PrefService* local_state_; | 95 PrefService* local_state_; |
87 | 96 |
88 // The last time an idle state check was performed. | 97 // The last time an idle state check was performed. |
89 base::Time last_idle_check_; | 98 base::Time last_idle_check_; |
90 | 99 |
91 // The idle state the last time it was checked. | |
92 IdleState last_idle_state_; | |
93 | |
94 base::RepeatingTimer<DeviceStatusCollector> timer_; | 100 base::RepeatingTimer<DeviceStatusCollector> timer_; |
95 | 101 |
96 chromeos::VersionLoader version_loader_; | 102 chromeos::VersionLoader version_loader_; |
97 CancelableRequestConsumer consumer_; | 103 CancelableRequestConsumer consumer_; |
98 | 104 |
99 std::string os_version_; | 105 std::string os_version_; |
100 std::string firmware_version_; | 106 std::string firmware_version_; |
101 | 107 |
102 chromeos::system::StatisticsProvider* statistics_provider_; | 108 chromeos::system::StatisticsProvider* statistics_provider_; |
103 | 109 |
104 chromeos::CrosSettings* cros_settings_; | 110 chromeos::CrosSettings* cros_settings_; |
105 | 111 |
106 // Cached values of the reporting settings from the device policy. | 112 // Cached values of the reporting settings from the device policy. |
107 bool report_version_info_; | 113 bool report_version_info_; |
108 bool report_activity_times_; | 114 bool report_activity_times_; |
109 bool report_boot_mode_; | 115 bool report_boot_mode_; |
110 | 116 |
111 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); | 117 DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); |
112 }; | 118 }; |
113 | 119 |
114 } // namespace policy | 120 } // namespace policy |
115 | 121 |
116 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 122 #endif // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ |
OLD | NEW |