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

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: 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 success) {
630 if (!success) {
Alexei Svitkine (slow) 2014/09/04 18:45:25 Nit: No need for {}'s for single line body.
gayane -on leave until 09-2017 2014/09/04 21:30:12 Done.
631 return;
632 }
633 CrosSettings::Get()->SetBoolean(kStatsReportingPref,
634 usage_statistics_reporting_);
635 if (usage_statistics_reporting_) {
636 #if defined(GOOGLE_CHROME_BUILD)
637 // The crash reporter initialization needs IO to complete.
638 base::ThreadRestrictions::ScopedAllowIO allow_io;
639 breakpad::InitCrashReporter(std::string());
640 #endif
641 }
642 }
643
636 void WizardController::OnUpdateErrorCheckingForUpdate() { 644 void WizardController::OnUpdateErrorCheckingForUpdate() {
637 // TODO(nkostylev): Update should be required during OOBE. 645 // TODO(nkostylev): Update should be required during OOBE.
638 // We do not want to block users from being able to proceed to the login 646 // 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. 647 // 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 648 // They could use "browse without sign-in" feature to set up the network to be
641 // able to perform the update later. 649 // able to perform the update later.
642 OnUpdateCompleted(); 650 OnUpdateCompleted();
643 } 651 }
644 652
645 void WizardController::OnUpdateErrorUpdating() { 653 void WizardController::OnUpdateErrorUpdating() {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) { 1259 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) {
1252 StartupUtils::MarkEulaAccepted(); 1260 StartupUtils::MarkEulaAccepted();
1253 auth_token_ = token; 1261 auth_token_ = token;
1254 InitiateOOBEUpdate(); 1262 InitiateOOBEUpdate();
1255 } else { 1263 } else {
1256 LOG(WARNING) << "Not in device enrollment."; 1264 LOG(WARNING) << "Not in device enrollment.";
1257 } 1265 }
1258 } 1266 }
1259 1267
1260 } // namespace chromeos 1268 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698