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

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller.cc

Issue 506663003: Consolidates accessing and setting the UMA pref to be within metrics code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/chromeos/login/wizard_controller.h" 5 #include "chrome/browser/chromeos/login/wizard_controller.h"
6 6
7 #include <signal.h> 7 #include <signal.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 } else if (ShouldShowHostPairingScreen()) { 637 } else if (ShouldShowHostPairingScreen()) {
638 ShowHostPairingScreen(); 638 ShowHostPairingScreen();
639 } else { 639 } else {
640 ShowAutoEnrollmentCheckScreen(); 640 ShowAutoEnrollmentCheckScreen();
641 } 641 }
642 } 642 }
643 643
644 void WizardController::OnEulaAccepted() { 644 void WizardController::OnEulaAccepted() {
645 time_eula_accepted_ = base::Time::Now(); 645 time_eula_accepted_ = base::Time::Now();
646 StartupUtils::MarkEulaAccepted(); 646 StartupUtils::MarkEulaAccepted();
647 bool uma_enabled = 647 base::Callback<void(bool)> callback_fn = base::Bind(
648 ResolveMetricsReportingEnabled(usage_statistics_reporting_); 648 &WizardController::InitiateMetricsReportingChangeCallback,
Alexei Svitkine (slow) 2014/08/28 14:46:48 Nit: Indent 2 more.
gayane -on leave until 09-2017 2014/09/03 20:20:08 Done.
649 649 base::Unretained(this));
Alexei Svitkine (slow) 2014/08/28 14:46:48 Pass a weak ptr via weak_ptr_factory_ instead of b
gayane -on leave until 09-2017 2014/09/03 20:20:08 Done.
650 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); 650 InitiateMetricsReportingChange(callback_fn, usage_statistics_reporting_);
651 if (uma_enabled) {
652 #if defined(GOOGLE_CHROME_BUILD)
653 // The crash reporter initialization needs IO to complete.
654 base::ThreadRestrictions::ScopedAllowIO allow_io;
655 breakpad::InitCrashReporter(std::string());
656 #endif
657 }
658 651
659 if (skip_update_enroll_after_eula_) { 652 if (skip_update_enroll_after_eula_) {
660 PerformPostEulaActions(); 653 PerformPostEulaActions();
661 ShowAutoEnrollmentCheckScreen(); 654 ShowAutoEnrollmentCheckScreen();
662 } else { 655 } else {
663 InitiateOOBEUpdate(); 656 InitiateOOBEUpdate();
664 } 657 }
665 } 658 }
666 659
660 void WizardController::InitiateMetricsReportingChangeCallback(bool success) {
661 if (success) {
662 CrosSettings::Get()->SetBoolean(kStatsReportingPref,
663 usage_statistics_reporting_);
664 if (usage_statistics_reporting_)
665 {
Alexei Svitkine (slow) 2014/08/28 14:46:48 Nit: Should go on previous line.
gayane -on leave until 09-2017 2014/09/03 20:20:08 Done.
666 #if defined(GOOGLE_CHROME_BUILD)
667 // The crash reporter initialization needs IO to complete.
668 base::ThreadRestrictions::ScopedAllowIO allow_io;
669 breakpad::InitCrashReporter(std::string());
670 #endif
671 }
672 }
673 }
674
667 void WizardController::OnUpdateErrorCheckingForUpdate() { 675 void WizardController::OnUpdateErrorCheckingForUpdate() {
668 // TODO(nkostylev): Update should be required during OOBE. 676 // TODO(nkostylev): Update should be required during OOBE.
669 // We do not want to block users from being able to proceed to the login 677 // We do not want to block users from being able to proceed to the login
670 // screen if there is any error checking for an update. 678 // screen if there is any error checking for an update.
671 // They could use "browse without sign-in" feature to set up the network to be 679 // They could use "browse without sign-in" feature to set up the network to be
672 // able to perform the update later. 680 // able to perform the update later.
673 OnUpdateCompleted(); 681 OnUpdateCompleted();
674 } 682 }
675 683
676 void WizardController::OnUpdateErrorUpdating() { 684 void WizardController::OnUpdateErrorUpdating() {
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 bool WizardController::SetOnTimeZoneResolvedForTesting( 1284 bool WizardController::SetOnTimeZoneResolvedForTesting(
1277 const base::Closure& callback) { 1285 const base::Closure& callback) {
1278 if (timezone_resolved_) 1286 if (timezone_resolved_)
1279 return false; 1287 return false;
1280 1288
1281 on_timezone_resolved_for_testing_ = callback; 1289 on_timezone_resolved_for_testing_ = callback;
1282 return true; 1290 return true;
1283 } 1291 }
1284 1292
1285 } // namespace chromeos 1293 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698