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

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: Return updated state instead of success identifier + minor changes 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(usage_statistics_reporting_, callback_fn);
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 enabled) {
630 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled);
631 if (enabled) {
632 #if defined(GOOGLE_CHROME_BUILD)
633 // The crash reporter initialization needs IO to complete.
634 base::ThreadRestrictions::ScopedAllowIO allow_io;
635 breakpad::InitCrashReporter(std::string());
636 #endif
637 }
638 }
639
636 void WizardController::OnUpdateErrorCheckingForUpdate() { 640 void WizardController::OnUpdateErrorCheckingForUpdate() {
637 // TODO(nkostylev): Update should be required during OOBE. 641 // TODO(nkostylev): Update should be required during OOBE.
638 // We do not want to block users from being able to proceed to the login 642 // 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. 643 // 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 644 // They could use "browse without sign-in" feature to set up the network to be
641 // able to perform the update later. 645 // able to perform the update later.
642 OnUpdateCompleted(); 646 OnUpdateCompleted();
643 } 647 }
644 648
645 void WizardController::OnUpdateErrorUpdating() { 649 void WizardController::OnUpdateErrorUpdating() {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) { 1255 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) {
1252 StartupUtils::MarkEulaAccepted(); 1256 StartupUtils::MarkEulaAccepted();
1253 auth_token_ = token; 1257 auth_token_ = token;
1254 InitiateOOBEUpdate(); 1258 InitiateOOBEUpdate();
1255 } else { 1259 } else {
1256 LOG(WARNING) << "Not in device enrollment."; 1260 LOG(WARNING) << "Not in device enrollment.";
1257 } 1261 }
1258 } 1262 }
1259 1263
1260 } // namespace chromeos 1264 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698