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

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: fix and rollback unnecessary 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 // remote enrollment. crbug.com/403147. 577 // remote enrollment. crbug.com/403147.
578 ShowEnrollmentScreen(); 578 ShowEnrollmentScreen();
579 } else { 579 } else {
580 ShowAutoEnrollmentCheckScreen(); 580 ShowAutoEnrollmentCheckScreen();
581 } 581 }
582 } 582 }
583 583
584 void WizardController::OnEulaAccepted() { 584 void WizardController::OnEulaAccepted() {
585 time_eula_accepted_ = base::Time::Now(); 585 time_eula_accepted_ = base::Time::Now();
586 StartupUtils::MarkEulaAccepted(); 586 StartupUtils::MarkEulaAccepted();
587 bool uma_enabled = 587 base::Callback<void(bool)> callback_fn = base::Bind(
588 ResolveMetricsReportingEnabled(usage_statistics_reporting_); 588 &WizardController::InitiateMetricsReportingChangeCallback,
589 589 weak_factory_.GetWeakPtr());
stevenjb 2014/09/11 20:31:44 No need for local, just inline this.
gayane -on leave until 09-2017 2014/09/12 17:44:51 Done.
590 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); 590 InitiateMetricsReportingChange(usage_statistics_reporting_, callback_fn);
591 if (uma_enabled) {
592 #if defined(GOOGLE_CHROME_BUILD)
593 // The crash reporter initialization needs IO to complete.
594 base::ThreadRestrictions::ScopedAllowIO allow_io;
595 breakpad::InitCrashReporter(std::string());
596 #endif
597 }
598 591
599 if (skip_update_enroll_after_eula_) { 592 if (skip_update_enroll_after_eula_) {
600 PerformPostEulaActions(); 593 PerformPostEulaActions();
601 ShowAutoEnrollmentCheckScreen(); 594 ShowAutoEnrollmentCheckScreen();
602 } else { 595 } else {
603 InitiateOOBEUpdate(); 596 InitiateOOBEUpdate();
604 } 597 }
605 } 598 }
606 599
600 void WizardController::InitiateMetricsReportingChangeCallback(bool enabled) {
601 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled);
602 if (enabled) {
stevenjb 2014/09/11 20:31:44 if() could be in #if, but even better, early exit:
gayane -on leave until 09-2017 2014/09/12 17:44:51 Done.
603 #if defined(GOOGLE_CHROME_BUILD)
604 // The crash reporter initialization needs IO to complete.
605 base::ThreadRestrictions::ScopedAllowIO allow_io;
606 breakpad::InitCrashReporter(std::string());
607 #endif
608 }
609 }
610
607 void WizardController::OnUpdateErrorCheckingForUpdate() { 611 void WizardController::OnUpdateErrorCheckingForUpdate() {
608 // TODO(nkostylev): Update should be required during OOBE. 612 // TODO(nkostylev): Update should be required during OOBE.
609 // We do not want to block users from being able to proceed to the login 613 // We do not want to block users from being able to proceed to the login
610 // screen if there is any error checking for an update. 614 // screen if there is any error checking for an update.
611 // They could use "browse without sign-in" feature to set up the network to be 615 // They could use "browse without sign-in" feature to set up the network to be
612 // able to perform the update later. 616 // able to perform the update later.
613 OnUpdateCompleted(); 617 OnUpdateCompleted();
614 } 618 }
615 619
616 void WizardController::OnUpdateErrorUpdating() { 620 void WizardController::OnUpdateErrorUpdating() {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) { 1226 if (ShouldAutoStartEnrollment() || ShouldRecoverEnrollment()) {
1223 StartupUtils::MarkEulaAccepted(); 1227 StartupUtils::MarkEulaAccepted();
1224 auth_token_ = token; 1228 auth_token_ = token;
1225 InitiateOOBEUpdate(); 1229 InitiateOOBEUpdate();
1226 } else { 1230 } else {
1227 LOG(WARNING) << "Not in device enrollment."; 1231 LOG(WARNING) << "Not in device enrollment.";
1228 } 1232 }
1229 } 1233 }
1230 1234
1231 } // namespace chromeos 1235 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698