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

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: android check removed 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 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 // remote enrollment. crbug.com/403147. 584 // remote enrollment. crbug.com/403147.
585 ShowEnrollmentScreen(); 585 ShowEnrollmentScreen();
586 } else { 586 } else {
587 ShowAutoEnrollmentCheckScreen(); 587 ShowAutoEnrollmentCheckScreen();
588 } 588 }
589 } 589 }
590 590
591 void WizardController::OnEulaAccepted() { 591 void WizardController::OnEulaAccepted() {
592 time_eula_accepted_ = base::Time::Now(); 592 time_eula_accepted_ = base::Time::Now();
593 StartupUtils::MarkEulaAccepted(); 593 StartupUtils::MarkEulaAccepted();
594 bool uma_enabled = 594 InitiateMetricsReportingChange(
595 ResolveMetricsReportingEnabled(usage_statistics_reporting_); 595 usage_statistics_reporting_,
596 596 base::Bind(&WizardController::InitiateMetricsReportingChangeCallback,
597 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); 597 weak_factory_.GetWeakPtr()));
598 if (uma_enabled) {
599 #if defined(GOOGLE_CHROME_BUILD)
600 // The crash reporter initialization needs IO to complete.
601 base::ThreadRestrictions::ScopedAllowIO allow_io;
602 breakpad::InitCrashReporter(std::string());
603 #endif
604 }
605 598
606 if (skip_update_enroll_after_eula_) { 599 if (skip_update_enroll_after_eula_) {
607 PerformPostEulaActions(); 600 PerformPostEulaActions();
608 ShowAutoEnrollmentCheckScreen(); 601 ShowAutoEnrollmentCheckScreen();
609 } else { 602 } else {
610 InitiateOOBEUpdate(); 603 InitiateOOBEUpdate();
611 } 604 }
612 } 605 }
613 606
607 void WizardController::InitiateMetricsReportingChangeCallback(bool enabled) {
608 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled);
609 if (!enabled)
610 return;
611 #if defined(GOOGLE_CHROME_BUILD)
612 // The crash reporter initialization needs IO to complete.
613 base::ThreadRestrictions::ScopedAllowIO allow_io;
614 breakpad::InitCrashReporter(std::string());
615 #endif
616
617 }
618
614 void WizardController::OnUpdateErrorCheckingForUpdate() { 619 void WizardController::OnUpdateErrorCheckingForUpdate() {
615 // TODO(nkostylev): Update should be required during OOBE. 620 // TODO(nkostylev): Update should be required during OOBE.
616 // We do not want to block users from being able to proceed to the login 621 // We do not want to block users from being able to proceed to the login
617 // screen if there is any error checking for an update. 622 // screen if there is any error checking for an update.
618 // They could use "browse without sign-in" feature to set up the network to be 623 // They could use "browse without sign-in" feature to set up the network to be
619 // able to perform the update later. 624 // able to perform the update later.
620 OnUpdateCompleted(); 625 OnUpdateCompleted();
621 } 626 }
622 627
623 void WizardController::OnUpdateErrorUpdating() { 628 void WizardController::OnUpdateErrorUpdating() {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 bool WizardController::SetOnTimeZoneResolvedForTesting( 1234 bool WizardController::SetOnTimeZoneResolvedForTesting(
1230 const base::Closure& callback) { 1235 const base::Closure& callback) {
1231 if (timezone_resolved_) 1236 if (timezone_resolved_)
1232 return false; 1237 return false;
1233 1238
1234 on_timezone_resolved_for_testing_ = callback; 1239 on_timezone_resolved_for_testing_ = callback;
1235 return true; 1240 return true;
1236 } 1241 }
1237 1242
1238 } // namespace chromeos 1243 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.h ('k') | chrome/browser/chromeos/settings/device_settings_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698