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

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

Issue 2425233002: Rename policy ReportArcStatus to ReportArcStatusEnabled (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/device_status_collector_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/chromeos/policy/device_status_collector.h" 5 #include "chrome/browser/chromeos/policy/device_status_collector.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 chromeos::kReportDeviceUsers, callback); 465 chromeos::kReportDeviceUsers, callback);
466 hardware_status_subscription_ = cros_settings_->AddSettingsObserver( 466 hardware_status_subscription_ = cros_settings_->AddSettingsObserver(
467 chromeos::kReportDeviceHardwareStatus, callback); 467 chromeos::kReportDeviceHardwareStatus, callback);
468 session_status_subscription_ = cros_settings_->AddSettingsObserver( 468 session_status_subscription_ = cros_settings_->AddSettingsObserver(
469 chromeos::kReportDeviceSessionStatus, callback); 469 chromeos::kReportDeviceSessionStatus, callback);
470 os_update_status_subscription_ = cros_settings_->AddSettingsObserver( 470 os_update_status_subscription_ = cros_settings_->AddSettingsObserver(
471 chromeos::kReportOsUpdateStatus, callback); 471 chromeos::kReportOsUpdateStatus, callback);
472 running_kiosk_app_subscription_ = cros_settings_->AddSettingsObserver( 472 running_kiosk_app_subscription_ = cros_settings_->AddSettingsObserver(
473 chromeos::kReportRunningKioskApp, callback); 473 chromeos::kReportRunningKioskApp, callback);
474 474
475 report_arc_status_pref_.Init(prefs::kReportArcStatus, local_state_, callback); 475 report_arc_status_pref_.Init(prefs::kReportArcStatusEnabled, local_state_,
476 callback);
476 477
477 // Fetch the current values of the policies. 478 // Fetch the current values of the policies.
478 UpdateReportingSettings(); 479 UpdateReportingSettings();
479 480
480 // Get the the OS and firmware version info. 481 // Get the the OS and firmware version info.
481 base::PostTaskAndReplyWithResult( 482 base::PostTaskAndReplyWithResult(
482 content::BrowserThread::GetBlockingPool(), 483 content::BrowserThread::GetBlockingPool(),
483 FROM_HERE, 484 FROM_HERE,
484 base::Bind(&chromeos::version_loader::GetVersion, 485 base::Bind(&chromeos::version_loader::GetVersion,
485 chromeos::version_loader::VERSION_FULL), 486 chromeos::version_loader::VERSION_FULL),
486 base::Bind(&DeviceStatusCollector::OnOSVersion, 487 base::Bind(&DeviceStatusCollector::OnOSVersion,
487 weak_factory_.GetWeakPtr())); 488 weak_factory_.GetWeakPtr()));
488 base::PostTaskAndReplyWithResult( 489 base::PostTaskAndReplyWithResult(
489 content::BrowserThread::GetBlockingPool(), 490 content::BrowserThread::GetBlockingPool(),
490 FROM_HERE, 491 FROM_HERE,
491 base::Bind(&chromeos::version_loader::GetFirmware), 492 base::Bind(&chromeos::version_loader::GetFirmware),
492 base::Bind(&DeviceStatusCollector::OnOSFirmware, 493 base::Bind(&DeviceStatusCollector::OnOSFirmware,
493 weak_factory_.GetWeakPtr())); 494 weak_factory_.GetWeakPtr()));
494 } 495 }
495 496
496 DeviceStatusCollector::~DeviceStatusCollector() { 497 DeviceStatusCollector::~DeviceStatusCollector() {
497 } 498 }
498 499
499 // static 500 // static
500 void DeviceStatusCollector::RegisterPrefs(PrefRegistrySimple* registry) { 501 void DeviceStatusCollector::RegisterPrefs(PrefRegistrySimple* registry) {
501 registry->RegisterDictionaryPref(prefs::kDeviceActivityTimes, 502 registry->RegisterDictionaryPref(prefs::kDeviceActivityTimes,
502 new base::DictionaryValue); 503 new base::DictionaryValue);
503 registry->RegisterBooleanPref(prefs::kReportArcStatus, true); 504 registry->RegisterBooleanPref(prefs::kReportArcStatusEnabled, true);
504 } 505 }
505 506
506 void DeviceStatusCollector::CheckIdleState() { 507 void DeviceStatusCollector::CheckIdleState() {
507 CalculateIdleState(kIdleStateThresholdSeconds, 508 CalculateIdleState(kIdleStateThresholdSeconds,
508 base::Bind(&DeviceStatusCollector::IdleStateCallback, 509 base::Bind(&DeviceStatusCollector::IdleStateCallback,
509 base::Unretained(this))); 510 base::Unretained(this)));
510 } 511 }
511 512
512 void DeviceStatusCollector::UpdateReportingSettings() { 513 void DeviceStatusCollector::UpdateReportingSettings() {
513 // Attempt to fetch the current value of the reporting settings. 514 // Attempt to fetch the current value of the reporting settings.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 if (!cros_settings_->GetBoolean( 548 if (!cros_settings_->GetBoolean(
548 chromeos::kReportDeviceHardwareStatus, &report_hardware_status_)) { 549 chromeos::kReportDeviceHardwareStatus, &report_hardware_status_)) {
549 report_hardware_status_ = true; 550 report_hardware_status_ = true;
550 } 551 }
551 552
552 if (!cros_settings_->GetBoolean(chromeos::kReportDeviceSessionStatus, 553 if (!cros_settings_->GetBoolean(chromeos::kReportDeviceSessionStatus,
553 &report_kiosk_session_status_)) { 554 &report_kiosk_session_status_)) {
554 report_kiosk_session_status_ = true; 555 report_kiosk_session_status_ = true;
555 } 556 }
556 557
557 report_android_status_ = local_state_->GetBoolean(prefs::kReportArcStatus); 558 report_android_status_ =
559 local_state_->GetBoolean(prefs::kReportArcStatusEnabled);
558 560
559 if (!report_hardware_status_) { 561 if (!report_hardware_status_) {
560 ClearCachedResourceUsage(); 562 ClearCachedResourceUsage();
561 } else if (!already_reporting_hardware_status) { 563 } else if (!already_reporting_hardware_status) {
562 // Turning on hardware status reporting - fetch an initial sample 564 // Turning on hardware status reporting - fetch an initial sample
563 // immediately instead of waiting for the sampling timer to fire. 565 // immediately instead of waiting for the sampling timer to fire.
564 SampleResourceUsage(); 566 SampleResourceUsage();
565 } 567 }
566 568
567 // Os update status and running kiosk app reporting are disabled by default. 569 // Os update status and running kiosk app reporting are disabled by default.
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 1189
1188 void DeviceStatusCollector::OnOSVersion(const std::string& version) { 1190 void DeviceStatusCollector::OnOSVersion(const std::string& version) {
1189 os_version_ = version; 1191 os_version_ = version;
1190 } 1192 }
1191 1193
1192 void DeviceStatusCollector::OnOSFirmware(const std::string& version) { 1194 void DeviceStatusCollector::OnOSFirmware(const std::string& version) {
1193 firmware_version_ = version; 1195 firmware_version_ = version;
1194 } 1196 }
1195 1197
1196 } // namespace policy 1198 } // namespace policy
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/policy/device_status_collector_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698