| 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   // Prevents the local store of activity periods from growing too large by | 
 |   65   // removing entries that are outside the reporting window. | 
 |   66   void PruneStoredActivityPeriods(base::Time base_time); | 
 |   67  | 
|   58   void AddActivePeriod(base::Time start, base::Time end); |   68   void AddActivePeriod(base::Time start, base::Time end); | 
|   59  |   69  | 
|   60   // Callbacks from chromeos::VersionLoader. |   70   // Callbacks from chromeos::VersionLoader. | 
|   61   void OnOSVersion(chromeos::VersionLoader::Handle handle, |   71   void OnOSVersion(chromeos::VersionLoader::Handle handle, | 
|   62                    std::string version); |   72                    std::string version); | 
|   63   void OnOSFirmware(chromeos::VersionLoader::Handle handle, |   73   void OnOSFirmware(chromeos::VersionLoader::Handle handle, | 
|   64                     std::string version); |   74                     std::string version); | 
|   65  |   75  | 
|   66   // Helpers for the various portions of the status. |   76   // Helpers for the various portions of the status. | 
|   67   void GetActivityTimes( |   77   void GetActivityTimes( | 
| (...skipping 13 matching lines...) Expand all  Loading... | 
|   81       const content::NotificationDetails& details) OVERRIDE; |   91       const content::NotificationDetails& details) OVERRIDE; | 
|   82  |   92  | 
|   83   // How often to poll to see if the user is idle. |   93   // How often to poll to see if the user is idle. | 
|   84   int poll_interval_seconds_; |   94   int poll_interval_seconds_; | 
|   85  |   95  | 
|   86   PrefService* local_state_; |   96   PrefService* local_state_; | 
|   87  |   97  | 
|   88   // The last time an idle state check was performed. |   98   // The last time an idle state check was performed. | 
|   89   base::Time last_idle_check_; |   99   base::Time last_idle_check_; | 
|   90  |  100  | 
|   91   // The idle state the last time it was checked. |  | 
|   92   IdleState last_idle_state_; |  | 
|   93  |  | 
|   94   base::RepeatingTimer<DeviceStatusCollector> timer_; |  101   base::RepeatingTimer<DeviceStatusCollector> timer_; | 
|   95  |  102  | 
|   96   chromeos::VersionLoader version_loader_; |  103   chromeos::VersionLoader version_loader_; | 
|   97   CancelableRequestConsumer consumer_; |  104   CancelableRequestConsumer consumer_; | 
|   98  |  105  | 
|   99   std::string os_version_; |  106   std::string os_version_; | 
|  100   std::string firmware_version_; |  107   std::string firmware_version_; | 
|  101  |  108  | 
|  102   chromeos::system::StatisticsProvider* statistics_provider_; |  109   chromeos::system::StatisticsProvider* statistics_provider_; | 
|  103  |  110  | 
|  104   chromeos::CrosSettings* cros_settings_; |  111   chromeos::CrosSettings* cros_settings_; | 
|  105  |  112  | 
|  106   // Cached values of the reporting settings from the device policy. |  113   // Cached values of the reporting settings from the device policy. | 
|  107   bool report_version_info_; |  114   bool report_version_info_; | 
|  108   bool report_activity_times_; |  115   bool report_activity_times_; | 
|  109   bool report_boot_mode_; |  116   bool report_boot_mode_; | 
|  110  |  117  | 
|  111   DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); |  118   DISALLOW_COPY_AND_ASSIGN(DeviceStatusCollector); | 
|  112 }; |  119 }; | 
|  113  |  120  | 
|  114 }  // namespace policy |  121 }  // namespace policy | 
|  115  |  122  | 
|  116 #endif  // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ |  123 #endif  // CHROME_BROWSER_POLICY_DEVICE_STATUS_COLLECTOR_H_ | 
| OLD | NEW |