Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: chrome/browser/policy/device_status_collector.cc

Issue 10103029: Add device location reporting (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/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/chromeos/cros_settings.h" 10 #include "chrome/browser/chromeos/cros_settings.h"
11 #include "chrome/browser/chromeos/cros_settings_names.h" 11 #include "chrome/browser/chromeos/cros_settings_names.h"
12 #include "chrome/browser/chromeos/system/statistics_provider.h" 12 #include "chrome/browser/chromeos/system/statistics_provider.h"
13 #include "chrome/browser/policy/proto/device_management_backend.pb.h" 13 #include "chrome/browser/policy/proto/device_management_backend.pb.h"
14 #include "chrome/browser/prefs/pref_service.h" 14 #include "chrome/browser/prefs/pref_service.h"
15 #include "chrome/browser/prefs/scoped_user_pref_update.h" 15 #include "chrome/browser/prefs/scoped_user_pref_update.h"
16 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/chrome_version_info.h" 17 #include "chrome/common/chrome_version_info.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "content/browser/geolocation/geolocation_provider.h"
20 #include "content/public/browser/browser_thread.h"
19 21
20 using base::Time; 22 using base::Time;
21 using base::TimeDelta; 23 using base::TimeDelta;
22 using chromeos::VersionLoader; 24 using chromeos::VersionLoader;
23 25
24 namespace em = enterprise_management; 26 namespace em = enterprise_management;
25 27
26 namespace { 28 namespace {
27 // How many seconds of inactivity triggers the idle state. 29 // How many seconds of inactivity triggers the idle state.
28 const unsigned int kIdleStateThresholdSeconds = 300; 30 const unsigned int kIdleStateThresholdSeconds = 300;
(...skipping 17 matching lines...) Expand all
46 int previous_activity = 0; 48 int previous_activity = 0;
47 activity_times->GetInteger(day_key, &previous_activity); 49 activity_times->GetInteger(day_key, &previous_activity);
48 activity_times->SetInteger(day_key, 50 activity_times->SetInteger(day_key,
49 previous_activity + activity.InMilliseconds()); 51 previous_activity + activity.InMilliseconds());
50 } 52 }
51 53
52 } // namespace 54 } // namespace
53 55
54 namespace policy { 56 namespace policy {
55 57
58 // Helper class for retrieving the device's geographic location.
59 class DeviceStatusLocationHelper : public GeolocationObserver {
Joao da Silva 2012/04/20 09:49:57 I'd move this one to its own file.
bartfab (slow) 2012/04/20 14:10:15 Done.
60 public:
61 explicit DeviceStatusLocationHelper(PrefService* local_state);
62 virtual ~DeviceStatusLocationHelper();
63 void Destruct();
64
65 const Geoposition& GetPosition() const;
66
67 static void RegisterPrefs(PrefService* local_state);
68
69 virtual void OnLocationUpdate(const Geoposition& position);
Joao da Silva 2012/04/20 09:49:57 OVERRIDE
bartfab (slow) 2012/04/20 14:10:15 Done.
70
71 void SetGeolocationProviderForTest(GeolocationProvider* provider);
72
73 static const unsigned int kPollIntervalSeconds = 1800;
74
75 private:
76 void Init(const Geoposition& position);
77 void DestructInternal();
78
79 void ScheduleUpdate(const Geoposition& position);
80
81 void StartObserving();
82 void StopObserving();
83
84 void ReceiveUpdate(const Geoposition& position);
85
86 // Used by UI thread only
87 PrefService* local_state_;
88 Geoposition position_;
89
90 // Used by IO thread only
91 base::OneShotTimer<DeviceStatusLocationHelper> *timer_;
92 GeolocationProvider* provider_;
93 bool observing_;
94
95 DISALLOW_COPY_AND_ASSIGN(DeviceStatusLocationHelper);
96 };
97
98 DeviceStatusLocationHelper::DeviceStatusLocationHelper(
99 PrefService* local_state)
100 : local_state_(local_state),
101 timer_(NULL),
102 provider_(NULL),
103 observing_(false) {
104 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
105 Geoposition position;
106 std::string timestamp_str;
107 int64 timestamp;
108 const base::DictionaryValue* location =
109 local_state_->GetDictionary(prefs::kDeviceLocation);
110 if (location->GetDouble("latitude", &position.latitude) &&
111 location->GetDouble("longitude", &position.longitude) &&
112 location->GetDouble("altitude", &position.altitude) &&
113 location->GetDouble("accuracy", &position.accuracy) &&
114 location->GetDouble("altitude_accuracy",
115 &position.altitude_accuracy) &&
116 location->GetDouble("heading", &position.heading) &&
117 location->GetDouble("speed", &position.speed) &&
118 location->GetString("timestamp", &timestamp_str) &&
119 base::StringToInt64(timestamp_str, &timestamp)) {
120 position.timestamp = base::Time::FromInternalValue(timestamp);
Joao da Silva 2012/04/20 09:49:57 Nit: base::Time -> Time
bartfab (slow) 2012/04/20 14:10:15 It moved to its own .cc file without "using base::
121 position_ = position;
122 }
123 content::BrowserThread::PostTask(
124 content::BrowserThread::IO,
125 FROM_HERE,
126 base::Bind(&DeviceStatusLocationHelper::Init,
127 base::Unretained(this),
128 position_));
129 }
130
131 DeviceStatusLocationHelper::~DeviceStatusLocationHelper() {
132 // Do not call the destructor directly. Call Destruct() instead.
133 // The destructor is only public so that the DeleteSoon task can call it.
Joao da Silva 2012/04/20 09:49:57 Make the dtor private, and add friend class base:
bartfab (slow) 2012/04/20 14:10:15 Done.
134 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
135 DCHECK(local_state_ == NULL);
136 DCHECK(timer_ == NULL);
137 }
138
139 void DeviceStatusLocationHelper::Destruct() {
140 // This class has a specific shutdown sequence that ensures all classes it
141 // interfaces with are notified on the appropriate threads and any tasks
142 // posted to it are processed before destrucion.
Joao da Silva 2012/04/20 09:49:57 *destruction
bartfab (slow) 2012/04/20 14:10:15 Done.
143 //
144 // The shutdown sequence is initiated by calling Destruct() on the UI thread:
145 //
146 // 1. Destruct() makes the UI thread ignore any further updates it receives,
147 // then posts DestructInner() to the IO thread.
148 // 2. DestructInner() reaches the IO thread after any updates queued up for it
Joao da Silva 2012/04/20 09:49:57 In these 2 lines: DestructInner -> DestructInterna
bartfab (slow) 2012/04/20 14:10:15 Done.
149 // have been processed. This function destroys the poll timer and detaches
150 // from the GeolocationProvider so that no further updates can be received
151 // by the IO thread. Then, it posts DeleteSoon() back to the UI thread.
152 // 3. DeleteSoon() reaches the UI thread after any updates queued for it have
153 // been processed. At this point, there are no more tasks queued up for
154 // either of the threads and it is safe for the object to be deleted.
155 // 4. ~DeviceStatusLocationHelper() is run by DeleteSoon() and the object RIP.
156 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
157 local_state_ = NULL;
158 content::BrowserThread::PostTask(
159 content::BrowserThread::IO,
160 FROM_HERE,
161 base::Bind(&DeviceStatusLocationHelper::DestructInternal,
162 base::Unretained(this)));
163 }
164
165 const Geoposition& DeviceStatusLocationHelper::GetPosition() const {
166 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
167 return position_;
168 }
169
170 // static
171 void DeviceStatusLocationHelper::RegisterPrefs(PrefService* local_state) {
172 local_state->RegisterDictionaryPref(prefs::kDeviceLocation,
173 new DictionaryValue);
174 }
175
176 void DeviceStatusLocationHelper::OnLocationUpdate(const Geoposition& position) {
177 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
178 if (!position.IsValidFix())
179 return;
180 content::BrowserThread::PostTask(
181 content::BrowserThread::UI,
182 FROM_HERE,
183 base::Bind(&DeviceStatusLocationHelper::ReceiveUpdate,
184 base::Unretained(this), position));
185 StopObserving();
186 ScheduleUpdate(position);
187 }
188
189 void DeviceStatusLocationHelper::SetGeolocationProviderForTest(
190 GeolocationProvider* provider) {
191 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
192 DCHECK(!provider_);
193 provider_ = provider;
194 }
195
196 void DeviceStatusLocationHelper::Init(const Geoposition& position) {
197 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
198 if (!provider_)
199 provider_ = GeolocationProvider::GetInstance();
200 timer_ = new base::OneShotTimer<DeviceStatusLocationHelper>();
201 provider_->OnPermissionGranted();
Joao da Silva 2012/04/20 09:49:57 Doesn't this need a GURL?
bartfab (slow) 2012/04/20 14:10:15 The GURL parameter was not actually being used for
Joao da Silva 2012/04/20 14:21:09 I see, thanks for the clarification.
202 ScheduleUpdate(position);
203 }
204
205 void DeviceStatusLocationHelper::DestructInternal() {
206 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
207 delete timer_;
208 timer_ = 0;
209 StopObserving();
210 content::BrowserThread::DeleteSoon(content::BrowserThread::UI,
211 FROM_HERE,
212 this);
213 }
214
215 void DeviceStatusLocationHelper::ScheduleUpdate(const Geoposition& position) {
216 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
217 if (position.IsValidFix()) {
218 TimeDelta elapsed = Time::Now() - position.timestamp;
219 TimeDelta interval = TimeDelta::FromSeconds(kPollIntervalSeconds);
220 if (elapsed > interval)
221 StartObserving();
222 timer_->Start(FROM_HERE, interval - elapsed, this,
223 &DeviceStatusLocationHelper::StartObserving);
Joao da Silva 2012/04/20 09:49:57 Shouldn't this be in an else block here, so that i
bartfab (slow) 2012/04/20 14:10:15 Done.
224 } else {
225 StartObserving();
226 }
227 }
228
229 void DeviceStatusLocationHelper::StartObserving() {
230 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
231 timer_->Stop();
232 provider_->AddObserver(this, GeolocationObserverOptions(true));
233 observing_ = true;
234 }
235
236 void DeviceStatusLocationHelper::StopObserving() {
237 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
238 if (!observing_)
239 return;
240 provider_->RemoveObserver(this);
241 observing_ = false;
242 }
243
244 void DeviceStatusLocationHelper::ReceiveUpdate(const Geoposition& position) {
245 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
246 if (!local_state_)
247 return;
248 position_ = position;
249 DictionaryValue location;
250 location.SetDouble("latitude", position.latitude);
251 location.SetDouble("longitude", position.longitude);
252 location.SetDouble("altitude", position.altitude);
253 location.SetDouble("accuracy", position.accuracy);
254 location.SetDouble("altitude_accuracy", position.altitude_accuracy);
255 location.SetDouble("heading", position.heading);
256 location.SetDouble("speed", position.speed);
257 location.SetString("timestamp",
258 base::Int64ToString(position.timestamp.ToInternalValue()));
259 local_state_->Set(prefs::kDeviceLocation, location);
260 }
261
56 DeviceStatusCollector::DeviceStatusCollector( 262 DeviceStatusCollector::DeviceStatusCollector(
57 PrefService* local_state, 263 PrefService* local_state,
58 chromeos::system::StatisticsProvider* provider) 264 chromeos::system::StatisticsProvider* provider)
59 : max_stored_past_activity_days_(kMaxStoredPastActivityDays), 265 : max_stored_past_activity_days_(kMaxStoredPastActivityDays),
60 max_stored_future_activity_days_(kMaxStoredFutureActivityDays), 266 max_stored_future_activity_days_(kMaxStoredFutureActivityDays),
61 local_state_(local_state), 267 local_state_(local_state),
62 last_idle_check_(Time()), 268 last_idle_check_(Time()),
63 statistics_provider_(provider), 269 statistics_provider_(provider),
270 geolocation_provider_for_test_(NULL),
271 location_helper_(NULL),
64 report_version_info_(false), 272 report_version_info_(false),
65 report_activity_times_(false), 273 report_activity_times_(false),
66 report_boot_mode_(false) { 274 report_boot_mode_(false),
275 report_location_(false) {
67 timer_.Start(FROM_HERE, 276 timer_.Start(FROM_HERE,
68 TimeDelta::FromSeconds(kPollIntervalSeconds), 277 TimeDelta::FromSeconds(kPollIntervalSeconds),
69 this, &DeviceStatusCollector::CheckIdleState); 278 this, &DeviceStatusCollector::CheckIdleState);
70 279
71 cros_settings_ = chromeos::CrosSettings::Get(); 280 cros_settings_ = chromeos::CrosSettings::Get();
72 281
73 // Watch for changes to the individual policies that control what the status 282 // Watch for changes to the individual policies that control what the status
74 // reports contain. 283 // reports contain.
75 cros_settings_->AddSettingsObserver(chromeos::kReportDeviceVersionInfo, this); 284 cros_settings_->AddSettingsObserver(chromeos::kReportDeviceVersionInfo, this);
76 cros_settings_->AddSettingsObserver(chromeos::kReportDeviceActivityTimes, 285 cros_settings_->AddSettingsObserver(chromeos::kReportDeviceActivityTimes,
77 this); 286 this);
78 cros_settings_->AddSettingsObserver(chromeos::kReportDeviceBootMode, this); 287 cros_settings_->AddSettingsObserver(chromeos::kReportDeviceBootMode, this);
288 cros_settings_->AddSettingsObserver(chromeos::kReportDeviceLocation, this);
79 289
80 // Fetch the current values of the policies. 290 // Fetch the current values of the policies.
81 UpdateReportingSettings(); 291 UpdateReportingSettings();
82 292
83 // Get the the OS and firmware version info. 293 // Get the the OS and firmware version info.
84 version_loader_.GetVersion(&consumer_, 294 version_loader_.GetVersion(&consumer_,
85 base::Bind(&DeviceStatusCollector::OnOSVersion, 295 base::Bind(&DeviceStatusCollector::OnOSVersion,
86 base::Unretained(this)), 296 base::Unretained(this)),
87 VersionLoader::VERSION_FULL); 297 VersionLoader::VERSION_FULL);
88 version_loader_.GetFirmware(&consumer_, 298 version_loader_.GetFirmware(&consumer_,
89 base::Bind(&DeviceStatusCollector::OnOSFirmware, 299 base::Bind(&DeviceStatusCollector::OnOSFirmware,
90 base::Unretained(this))); 300 base::Unretained(this)));
91 } 301 }
92 302
93 DeviceStatusCollector::~DeviceStatusCollector() { 303 DeviceStatusCollector::~DeviceStatusCollector() {
94 cros_settings_->RemoveSettingsObserver(chromeos::kReportDeviceVersionInfo, 304 cros_settings_->RemoveSettingsObserver(chromeos::kReportDeviceVersionInfo,
95 this); 305 this);
96 cros_settings_->RemoveSettingsObserver(chromeos::kReportDeviceActivityTimes, 306 cros_settings_->RemoveSettingsObserver(chromeos::kReportDeviceActivityTimes,
97 this); 307 this);
98 cros_settings_->RemoveSettingsObserver(chromeos::kReportDeviceBootMode, this); 308 cros_settings_->RemoveSettingsObserver(chromeos::kReportDeviceBootMode, this);
309 cros_settings_->RemoveSettingsObserver(chromeos::kReportDeviceLocation, this);
310
311 if (location_helper_)
312 location_helper_->Destruct();
99 } 313 }
100 314
101 // static 315 // static
102 void DeviceStatusCollector::RegisterPrefs(PrefService* local_state) { 316 void DeviceStatusCollector::RegisterPrefs(PrefService* local_state) {
103 local_state->RegisterDictionaryPref(prefs::kDeviceActivityTimes, 317 local_state->RegisterDictionaryPref(prefs::kDeviceActivityTimes,
104 new DictionaryValue); 318 new DictionaryValue);
319 DeviceStatusLocationHelper::RegisterPrefs(local_state);
105 } 320 }
106 321
107 void DeviceStatusCollector::CheckIdleState() { 322 void DeviceStatusCollector::CheckIdleState() {
108 CalculateIdleState(kIdleStateThresholdSeconds, 323 CalculateIdleState(kIdleStateThresholdSeconds,
109 base::Bind(&DeviceStatusCollector::IdleStateCallback, 324 base::Bind(&DeviceStatusCollector::IdleStateCallback,
110 base::Unretained(this))); 325 base::Unretained(this)));
111 } 326 }
112 327
328 void DeviceStatusCollector::SetGeolocationProviderForTest(
329 GeolocationProvider* provider) {
330 geolocation_provider_for_test_ = provider;
331 if (location_helper_)
332 location_helper_->SetGeolocationProviderForTest(provider);
333 }
334
113 void DeviceStatusCollector::UpdateReportingSettings() { 335 void DeviceStatusCollector::UpdateReportingSettings() {
114 // Attempt to fetch the current value of the reporting settings. 336 // Attempt to fetch the current value of the reporting settings.
115 // If trusted values are not available, register this function to be called 337 // If trusted values are not available, register this function to be called
116 // back when they are available. 338 // back when they are available.
117 if (!cros_settings_->PrepareTrustedValues( 339 if (!cros_settings_->PrepareTrustedValues(
118 base::Bind(&DeviceStatusCollector::UpdateReportingSettings, 340 base::Bind(&DeviceStatusCollector::UpdateReportingSettings,
119 base::Unretained(this)))) { 341 base::Unretained(this)))) {
120 return; 342 return;
121 } 343 }
122 cros_settings_->GetBoolean( 344 cros_settings_->GetBoolean(
123 chromeos::kReportDeviceVersionInfo, &report_version_info_); 345 chromeos::kReportDeviceVersionInfo, &report_version_info_);
124 cros_settings_->GetBoolean( 346 cros_settings_->GetBoolean(
125 chromeos::kReportDeviceActivityTimes, &report_activity_times_); 347 chromeos::kReportDeviceActivityTimes, &report_activity_times_);
126 cros_settings_->GetBoolean( 348 cros_settings_->GetBoolean(
127 chromeos::kReportDeviceBootMode, &report_boot_mode_); 349 chromeos::kReportDeviceBootMode, &report_boot_mode_);
350 cros_settings_->GetBoolean(
351 chromeos::kReportDeviceLocation, &report_location_);
352
353 if (report_location_) {
354 if (!location_helper_) {
355 location_helper_ = new DeviceStatusLocationHelper(local_state_);
356 if (geolocation_provider_for_test_)
Joao da Silva 2012/04/20 09:49:57 Braces around the block when it spans more than 1
bartfab (slow) 2012/04/20 14:10:15 Done.
357 location_helper_->SetGeolocationProviderForTest(
358 geolocation_provider_for_test_);
359 }
360 } else {
361 if (location_helper_) {
362 location_helper_->Destruct();
363 location_helper_ = NULL;
364 }
365 local_state_->ClearPref(prefs::kDeviceLocation);
366 }
128 } 367 }
129 368
130 Time DeviceStatusCollector::GetCurrentTime() { 369 Time DeviceStatusCollector::GetCurrentTime() {
131 return Time::Now(); 370 return Time::Now();
132 } 371 }
133 372
134 // Remove all out-of-range activity times from the local store. 373 // Remove all out-of-range activity times from the local store.
135 void DeviceStatusCollector::PruneStoredActivityPeriods(Time base_time) { 374 void DeviceStatusCollector::PruneStoredActivityPeriods(Time base_time) {
136 const DictionaryValue* activity_times = 375 const DictionaryValue* activity_times =
137 local_state_->GetDictionary(prefs::kDeviceActivityTimes); 376 local_state_->GetDictionary(prefs::kDeviceActivityTimes);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 std::string dev_switch_mode; 490 std::string dev_switch_mode;
252 if (statistics_provider_->GetMachineStatistic( 491 if (statistics_provider_->GetMachineStatistic(
253 "devsw_boot", &dev_switch_mode)) { 492 "devsw_boot", &dev_switch_mode)) {
254 if (dev_switch_mode == "1") 493 if (dev_switch_mode == "1")
255 request->set_boot_mode("Dev"); 494 request->set_boot_mode("Dev");
256 else if (dev_switch_mode == "0") 495 else if (dev_switch_mode == "0")
257 request->set_boot_mode("Verified"); 496 request->set_boot_mode("Verified");
258 } 497 }
259 } 498 }
260 499
500 void DeviceStatusCollector::GetLocation(
501 em::DeviceStatusReportRequest* request) {
502 em::DeviceLocation* location = request->mutable_device_location();
503 if (!location_helper_) {
504 location->set_error_code(
505 em::DeviceLocation::ERROR_CODE_POSITION_UNAVAILABLE);
506 } else {
507 const Geoposition& position = location_helper_->GetPosition();
508 if (!position.IsValidFix()) {
509 location->set_error_code(
510 em::DeviceLocation::ERROR_CODE_POSITION_UNAVAILABLE);
511 location->set_error_message(position.error_message);
512 } else {
513 location->set_latitude(position.latitude);
514 location->set_longitude(position.longitude);
515 location->set_accuracy(position.accuracy);
516 location->set_timestamp(
517 (position.timestamp - Time::UnixEpoch()).InMilliseconds());
518 if (position.is_valid_altitude())
519 location->set_altitude(position.altitude);
520 if (position.is_valid_altitude_accuracy())
521 location->set_altitude_accuracy(position.altitude_accuracy);
522 if (position.is_valid_heading())
523 location->set_heading(position.heading);
524 if (position.is_valid_speed())
525 location->set_speed(position.speed);
526 location->set_error_code(em::DeviceLocation::ERROR_CODE_NONE);
527 }
528 }
529 }
530
261 void DeviceStatusCollector::GetStatus(em::DeviceStatusReportRequest* request) { 531 void DeviceStatusCollector::GetStatus(em::DeviceStatusReportRequest* request) {
262 if (report_activity_times_) 532 if (report_activity_times_)
263 GetActivityTimes(request); 533 GetActivityTimes(request);
264 534
265 if (report_version_info_) 535 if (report_version_info_)
266 GetVersionInfo(request); 536 GetVersionInfo(request);
267 537
268 if (report_boot_mode_) 538 if (report_boot_mode_)
269 GetBootMode(request); 539 GetBootMode(request);
540
541 if (report_location_)
542 GetLocation(request);
270 } 543 }
271 544
272 void DeviceStatusCollector::OnOSVersion(VersionLoader::Handle handle, 545 void DeviceStatusCollector::OnOSVersion(VersionLoader::Handle handle,
273 std::string version) { 546 std::string version) {
274 os_version_ = version; 547 os_version_ = version;
275 } 548 }
276 549
277 void DeviceStatusCollector::OnOSFirmware(VersionLoader::Handle handle, 550 void DeviceStatusCollector::OnOSFirmware(VersionLoader::Handle handle,
278 std::string version) { 551 std::string version) {
279 firmware_version_ = version; 552 firmware_version_ = version;
280 } 553 }
281 554
282 void DeviceStatusCollector::Observe( 555 void DeviceStatusCollector::Observe(
283 int type, 556 int type,
284 const content::NotificationSource& source, 557 const content::NotificationSource& source,
285 const content::NotificationDetails& details) { 558 const content::NotificationDetails& details) {
286 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED) 559 if (type == chrome::NOTIFICATION_SYSTEM_SETTING_CHANGED)
287 UpdateReportingSettings(); 560 UpdateReportingSettings();
288 else 561 else
289 NOTREACHED(); 562 NOTREACHED();
290 } 563 }
291 564
292 } // namespace policy 565 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698