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 #include "chrome/browser/chromeos/policy/device_status_collector.h" | 5 #include "chrome/browser/chromeos/policy/device_status_collector.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 void DeviceStatusCollector::UpdateReportingSettings() { | 178 void DeviceStatusCollector::UpdateReportingSettings() { |
179 // Attempt to fetch the current value of the reporting settings. | 179 // Attempt to fetch the current value of the reporting settings. |
180 // If trusted values are not available, register this function to be called | 180 // If trusted values are not available, register this function to be called |
181 // back when they are available. | 181 // back when they are available. |
182 if (chromeos::CrosSettingsProvider::TRUSTED != | 182 if (chromeos::CrosSettingsProvider::TRUSTED != |
183 cros_settings_->PrepareTrustedValues( | 183 cros_settings_->PrepareTrustedValues( |
184 base::Bind(&DeviceStatusCollector::UpdateReportingSettings, | 184 base::Bind(&DeviceStatusCollector::UpdateReportingSettings, |
185 weak_factory_.GetWeakPtr()))) { | 185 weak_factory_.GetWeakPtr()))) { |
186 return; | 186 return; |
187 } | 187 } |
188 cros_settings_->GetBoolean( | 188 if (!cros_settings_->GetBoolean( |
189 chromeos::kReportDeviceVersionInfo, &report_version_info_); | 189 chromeos::kReportDeviceVersionInfo, &report_version_info_)) { |
190 cros_settings_->GetBoolean( | 190 report_version_info_ = true; |
191 chromeos::kReportDeviceActivityTimes, &report_activity_times_); | 191 } |
192 cros_settings_->GetBoolean( | 192 if (!cros_settings_->GetBoolean( |
193 chromeos::kReportDeviceBootMode, &report_boot_mode_); | 193 chromeos::kReportDeviceActivityTimes, &report_activity_times_)) { |
194 cros_settings_->GetBoolean( | 194 report_activity_times_ = true; |
195 chromeos::kReportDeviceLocation, &report_location_); | 195 } |
196 cros_settings_->GetBoolean( | 196 if (!cros_settings_->GetBoolean( |
197 chromeos::kReportDeviceNetworkInterfaces, &report_network_interfaces_); | 197 chromeos::kReportDeviceBootMode, &report_boot_mode_)) { |
198 cros_settings_->GetBoolean( | 198 report_boot_mode_ = true; |
199 chromeos::kReportDeviceUsers, &report_users_); | 199 } |
| 200 if (!cros_settings_->GetBoolean( |
| 201 chromeos::kReportDeviceLocation, &report_location_)) { |
| 202 report_location_ = false; |
| 203 } |
| 204 if (!cros_settings_->GetBoolean( |
| 205 chromeos::kReportDeviceNetworkInterfaces, &report_network_interfaces_)) { |
| 206 report_network_interfaces_ = true; |
| 207 } |
| 208 if (!cros_settings_->GetBoolean( |
| 209 chromeos::kReportDeviceUsers, &report_users_)) { |
| 210 report_users_ = true; |
| 211 } |
200 | 212 |
201 if (report_location_) { | 213 if (report_location_) { |
202 ScheduleGeolocationUpdateRequest(); | 214 ScheduleGeolocationUpdateRequest(); |
203 } else { | 215 } else { |
204 geolocation_update_timer_.Stop(); | 216 geolocation_update_timer_.Stop(); |
205 position_ = content::Geoposition(); | 217 position_ = content::Geoposition(); |
206 local_state_->ClearPref(prefs::kDeviceLocation); | 218 local_state_->ClearPref(prefs::kDeviceLocation); |
207 } | 219 } |
208 } | 220 } |
209 | 221 |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
547 location.SetDouble(kSpeed, position.speed); | 559 location.SetDouble(kSpeed, position.speed); |
548 location.SetString(kTimestamp, | 560 location.SetString(kTimestamp, |
549 base::Int64ToString(position.timestamp.ToInternalValue())); | 561 base::Int64ToString(position.timestamp.ToInternalValue())); |
550 local_state_->Set(prefs::kDeviceLocation, location); | 562 local_state_->Set(prefs::kDeviceLocation, location); |
551 } | 563 } |
552 | 564 |
553 ScheduleGeolocationUpdateRequest(); | 565 ScheduleGeolocationUpdateRequest(); |
554 } | 566 } |
555 | 567 |
556 } // namespace policy | 568 } // namespace policy |
OLD | NEW |