| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/policy/device_status_collector.h" | 5 #include "chrome/browser/policy/device_status_collector.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 10 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
| 12 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 12 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 13 #include "chrome/common/chrome_version_info.h" |
| 13 | 14 |
| 14 using base::Time; | 15 using base::Time; |
| 15 using base::TimeDelta; | 16 using base::TimeDelta; |
| 16 using chromeos::VersionLoader; | 17 using chromeos::VersionLoader; |
| 17 | 18 |
| 18 namespace em = enterprise_management; | 19 namespace em = enterprise_management; |
| 19 | 20 |
| 20 namespace { | 21 namespace { |
| 21 // How many seconds of inactivity triggers the idle state. | 22 // How many seconds of inactivity triggers the idle state. |
| 22 const unsigned int kIdleStateThresholdSeconds = 300; | 23 const unsigned int kIdleStateThresholdSeconds = 300; |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 NOTREACHED(); | 148 NOTREACHED(); |
| 148 break; | 149 break; |
| 149 } | 150 } |
| 150 time_period = request->add_active_time(); | 151 time_period = request->add_active_time(); |
| 151 time_period->set_start_timestamp(start); | 152 time_period->set_start_timestamp(start); |
| 152 time_period->set_end_timestamp(end); | 153 time_period->set_end_timestamp(end); |
| 153 } | 154 } |
| 154 ListPrefUpdate update(local_state_, kPrefDeviceActivePeriods); | 155 ListPrefUpdate update(local_state_, kPrefDeviceActivePeriods); |
| 155 update.Get()->Clear(); | 156 update.Get()->Clear(); |
| 156 | 157 |
| 158 chrome::VersionInfo version_info; |
| 159 request->set_browser_version(version_info.Version()); |
| 157 request->set_os_version(os_version_); | 160 request->set_os_version(os_version_); |
| 158 request->set_firmware_version(firmware_version_); | 161 request->set_firmware_version(firmware_version_); |
| 159 } | 162 } |
| 160 | 163 |
| 161 void DeviceStatusCollector::OnOSVersion(VersionLoader::Handle handle, | 164 void DeviceStatusCollector::OnOSVersion(VersionLoader::Handle handle, |
| 162 std::string version) { | 165 std::string version) { |
| 163 os_version_ = version; | 166 os_version_ = version; |
| 164 } | 167 } |
| 165 | 168 |
| 166 void DeviceStatusCollector::OnOSFirmware(VersionLoader::Handle handle, | 169 void DeviceStatusCollector::OnOSFirmware(VersionLoader::Handle handle, |
| 167 std::string version) { | 170 std::string version) { |
| 168 firmware_version_ = version; | 171 firmware_version_ = version; |
| 169 } | 172 } |
| 170 | 173 |
| 171 } // namespace policy | 174 } // namespace policy |
| OLD | NEW |