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

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: access to prefs moved from browser_options_handle to metrics_reposting_state 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 // remote enrollment. crbug.com/403147. 606 // remote enrollment. crbug.com/403147.
607 ShowEnrollmentScreen(); 607 ShowEnrollmentScreen();
608 } else { 608 } else {
609 ShowAutoEnrollmentCheckScreen(); 609 ShowAutoEnrollmentCheckScreen();
610 } 610 }
611 } 611 }
612 612
613 void WizardController::OnEulaAccepted() { 613 void WizardController::OnEulaAccepted() {
614 time_eula_accepted_ = base::Time::Now(); 614 time_eula_accepted_ = base::Time::Now();
615 StartupUtils::MarkEulaAccepted(); 615 StartupUtils::MarkEulaAccepted();
616 bool uma_enabled = 616 base::Callback<void(bool)> callback_fn = base::Bind(
617 ResolveMetricsReportingEnabled(usage_statistics_reporting_); 617 &WizardController::InitiateMetricsReportingChangeCallback,
618 618 weak_factory_.GetWeakPtr());
619 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); 619 InitiateMetricsReportingChange(callback_fn, usage_statistics_reporting_);
620 if (uma_enabled) {
621 #if defined(GOOGLE_CHROME_BUILD)
622 // The crash reporter initialization needs IO to complete.
623 base::ThreadRestrictions::ScopedAllowIO allow_io;
624 breakpad::InitCrashReporter(std::string());
625 #endif
626 }
627 620
628 if (skip_update_enroll_after_eula_) { 621 if (skip_update_enroll_after_eula_) {
629 PerformPostEulaActions(); 622 PerformPostEulaActions();
630 ShowAutoEnrollmentCheckScreen(); 623 ShowAutoEnrollmentCheckScreen();
631 } else { 624 } else {
632 InitiateOOBEUpdate(); 625 InitiateOOBEUpdate();
633 } 626 }
634 } 627 }
635 628
629 void WizardController::InitiateMetricsReportingChangeCallback(bool success) {
630 if (success) {
Alexei Svitkine (slow) 2014/09/04 13:58:03 Nit: Prefer an early return.
gayane -on leave until 09-2017 2014/09/04 18:35:46 Done.
631 CrosSettings::Get()->SetBoolean(kStatsReportingPref,
632 usage_statistics_reporting_);
633 if (usage_statistics_reporting_) {
634 #if defined(GOOGLE_CHROME_BUILD)
635 // The crash reporter initialization needs IO to complete.
636 base::ThreadRestrictions::ScopedAllowIO allow_io;
637 breakpad::InitCrashReporter(std::string());
638 #endif
639 }
640 }
641 }
642
636 void WizardController::OnUpdateErrorCheckingForUpdate() { 643 void WizardController::OnUpdateErrorCheckingForUpdate() {
637 // TODO(nkostylev): Update should be required during OOBE. 644 // TODO(nkostylev): Update should be required during OOBE.
638 // We do not want to block users from being able to proceed to the login 645 // We do not want to block users from being able to proceed to the login
639 // screen if there is any error checking for an update. 646 // screen if there is any error checking for an update.
640 // They could use "browse without sign-in" feature to set up the network to be 647 // They could use "browse without sign-in" feature to set up the network to be
641 // able to perform the update later. 648 // able to perform the update later.
642 OnUpdateCompleted(); 649 OnUpdateCompleted();
643 } 650 }
644 651
645 void WizardController::OnUpdateErrorUpdating() { 652 void WizardController::OnUpdateErrorUpdating() {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) { 1258 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) {
1252 StartupUtils::MarkEulaAccepted(); 1259 StartupUtils::MarkEulaAccepted();
1253 auth_token_ = token; 1260 auth_token_ = token;
1254 InitiateOOBEUpdate(); 1261 InitiateOOBEUpdate();
1255 } else { 1262 } else {
1256 LOG(WARNING) << "Not in device enrollment."; 1263 LOG(WARNING) << "Not in device enrollment.";
1257 } 1264 }
1258 } 1265 }
1259 1266
1260 } // namespace chromeos 1267 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698