OLD | NEW |
---|---|
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 21 matching lines...) Expand all Loading... | |
32 #include "chrome/browser/chromeos/login/login_utils.h" | 32 #include "chrome/browser/chromeos/login/login_utils.h" |
33 #include "chrome/browser/chromeos/login/network_screen.h" | 33 #include "chrome/browser/chromeos/login/network_screen.h" |
34 #include "chrome/browser/chromeos/login/oobe_display.h" | 34 #include "chrome/browser/chromeos/login/oobe_display.h" |
35 #include "chrome/browser/chromeos/login/registration_screen.h" | 35 #include "chrome/browser/chromeos/login/registration_screen.h" |
36 #include "chrome/browser/chromeos/login/reset_screen.h" | 36 #include "chrome/browser/chromeos/login/reset_screen.h" |
37 #include "chrome/browser/chromeos/login/update_screen.h" | 37 #include "chrome/browser/chromeos/login/update_screen.h" |
38 #include "chrome/browser/chromeos/login/user_image_screen.h" | 38 #include "chrome/browser/chromeos/login/user_image_screen.h" |
39 #include "chrome/browser/chromeos/login/user_manager.h" | 39 #include "chrome/browser/chromeos/login/user_manager.h" |
40 #include "chrome/browser/chromeos/settings/cros_settings.h" | 40 #include "chrome/browser/chromeos/settings/cros_settings.h" |
41 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 41 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
42 #include "chrome/browser/google/google_util_chromeos.h" | |
42 #include "chrome/browser/prefs/pref_service.h" | 43 #include "chrome/browser/prefs/pref_service.h" |
43 #include "chrome/browser/profiles/profile_manager.h" | 44 #include "chrome/browser/profiles/profile_manager.h" |
44 #include "chrome/browser/ui/options/options_util.h" | 45 #include "chrome/browser/ui/options/options_util.h" |
45 #include "chrome/common/chrome_notification_types.h" | 46 #include "chrome/common/chrome_notification_types.h" |
46 #include "chrome/common/pref_names.h" | 47 #include "chrome/common/pref_names.h" |
47 #include "content/public/browser/browser_thread.h" | 48 #include "content/public/browser/browser_thread.h" |
48 #include "content/public/browser/notification_service.h" | 49 #include "content/public/browser/notification_service.h" |
49 #include "content/public/browser/notification_source.h" | 50 #include "content/public/browser/notification_source.h" |
50 #include "content/public/browser/notification_types.h" | 51 #include "content/public/browser/notification_types.h" |
51 #include "ui/base/accelerators/accelerator.h" | 52 #include "ui/base/accelerators/accelerator.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 previous_screen_(NULL), | 140 previous_screen_(NULL), |
140 #if defined(GOOGLE_CHROME_BUILD) | 141 #if defined(GOOGLE_CHROME_BUILD) |
141 is_official_build_(true), | 142 is_official_build_(true), |
142 #else | 143 #else |
143 is_official_build_(false), | 144 is_official_build_(false), |
144 #endif | 145 #endif |
145 is_out_of_box_(false), | 146 is_out_of_box_(false), |
146 host_(host), | 147 host_(host), |
147 oobe_display_(oobe_display), | 148 oobe_display_(oobe_display), |
148 usage_statistics_reporting_(true), | 149 usage_statistics_reporting_(true), |
150 rlz_enabled_(false), | |
149 skip_update_enroll_after_eula_(false), | 151 skip_update_enroll_after_eula_(false), |
150 login_screen_started_(false) { | 152 login_screen_started_(false), |
153 ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) { | |
151 DCHECK(default_controller_ == NULL); | 154 DCHECK(default_controller_ == NULL); |
152 default_controller_ = this; | 155 default_controller_ = this; |
153 } | 156 } |
154 | 157 |
155 WizardController::~WizardController() { | 158 WizardController::~WizardController() { |
156 if (default_controller_ == this) { | 159 if (default_controller_ == this) { |
157 default_controller_ = NULL; | 160 default_controller_ = NULL; |
158 } else { | 161 } else { |
159 NOTREACHED() << "More than one controller are alive."; | 162 NOTREACHED() << "More than one controller are alive."; |
160 } | 163 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 PrefService::UNSYNCABLE_PREF); | 419 PrefService::UNSYNCABLE_PREF); |
417 } | 420 } |
418 if (local_state->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { | 421 if (local_state->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { |
419 local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, | 422 local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, |
420 false, | 423 false, |
421 PrefService::UNSYNCABLE_PREF); | 424 PrefService::UNSYNCABLE_PREF); |
422 } | 425 } |
423 local_state->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); | 426 local_state->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); |
424 local_state->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); | 427 local_state->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); |
425 local_state->RegisterBooleanPref(prefs::kFactoryResetRequested, false); | 428 local_state->RegisterBooleanPref(prefs::kFactoryResetRequested, false); |
429 local_state->RegisterStringPref(prefs::kRLZBrand, std::string(), | |
430 PrefService::UNSYNCABLE_PREF); | |
431 local_state->RegisterBooleanPref(prefs::kRLZEnabled, false, | |
432 PrefService::UNSYNCABLE_PREF); | |
426 } | 433 } |
427 | 434 |
428 /////////////////////////////////////////////////////////////////////////////// | 435 /////////////////////////////////////////////////////////////////////////////// |
429 // WizardController, ExitHandlers: | 436 // WizardController, ExitHandlers: |
430 void WizardController::OnNetworkConnected() { | 437 void WizardController::OnNetworkConnected() { |
431 if (is_official_build_) { | 438 if (is_official_build_) { |
432 if (!IsEulaAccepted()) { | 439 if (!IsEulaAccepted()) { |
433 ShowEulaScreen(); | 440 ShowEulaScreen(); |
434 } else { | 441 } else { |
435 // Possible cases: | 442 // Possible cases: |
(...skipping 18 matching lines...) Expand all Loading... | |
454 ShowLoginScreen(); | 461 ShowLoginScreen(); |
455 } | 462 } |
456 | 463 |
457 void WizardController::OnUpdateCompleted() { | 464 void WizardController::OnUpdateCompleted() { |
458 OnOOBECompleted(); | 465 OnOOBECompleted(); |
459 } | 466 } |
460 | 467 |
461 void WizardController::OnEulaAccepted() { | 468 void WizardController::OnEulaAccepted() { |
462 time_eula_accepted_ = base::Time::Now(); | 469 time_eula_accepted_ = base::Time::Now(); |
463 MarkEulaAccepted(); | 470 MarkEulaAccepted(); |
464 bool enabled = | 471 bool uma_enabled = |
465 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); | 472 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); |
466 | 473 |
467 content::NotificationService::current()->Notify( | 474 content::NotificationService::current()->Notify( |
468 chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED, | 475 chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED, |
469 content::NotificationSource(content::Source<WizardController>(this)), | 476 content::NotificationSource(content::Source<WizardController>(this)), |
470 content::NotificationService::NoDetails()); | 477 content::NotificationService::NoDetails()); |
471 | 478 |
472 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled); | 479 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); |
473 if (enabled) { | 480 if (uma_enabled) { |
474 #if defined(USE_LINUX_BREAKPAD) | 481 #if defined(USE_LINUX_BREAKPAD) |
475 // The crash reporter initialization needs IO to complete. | 482 // The crash reporter initialization needs IO to complete. |
476 base::ThreadRestrictions::ScopedAllowIO allow_io; | 483 base::ThreadRestrictions::ScopedAllowIO allow_io; |
477 InitCrashReporter(); | 484 InitCrashReporter(); |
478 #endif | 485 #endif |
479 } | 486 } |
480 | 487 |
488 if (rlz_enabled_) { | |
489 SaveBoolPreferenceForced(prefs::kRLZEnabled, true); | |
490 LoadBrandCodeFromFile(); | |
491 } else { | |
492 OnEulaBlockingTasksDone(); | |
493 } | |
494 } | |
495 | |
496 void WizardController::LoadBrandCodeFromFile() { | |
497 google_util::chromeos::SetBrandFromFile( | |
498 base::Bind(&WizardController::OnEulaBlockingTasksDone, | |
499 weak_ptr_factory_.GetWeakPtr())); | |
500 } | |
501 | |
502 void WizardController::OnEulaBlockingTasksDone() { | |
503 LOG(ERROR) << "WizardController::OnEulaBlockingTasksDone"; | |
Nikita (slow)
2012/11/29 11:17:48
nit: Cleanup logging.
Ivan Korotkov
2012/11/29 17:42:28
Done.
| |
481 if (skip_update_enroll_after_eula_) { | 504 if (skip_update_enroll_after_eula_) { |
482 PerformPostEulaActions(); | 505 PerformPostEulaActions(); |
483 PerformPostUpdateActions(); | 506 PerformPostUpdateActions(); |
484 ShowEnterpriseEnrollmentScreen(); | 507 ShowEnterpriseEnrollmentScreen(); |
485 } else { | 508 } else { |
486 InitiateOOBEUpdate(); | 509 InitiateOOBEUpdate(); |
487 } | 510 } |
488 } | 511 } |
489 | 512 |
490 void WizardController::OnUpdateErrorCheckingForUpdate() { | 513 void WizardController::OnUpdateErrorCheckingForUpdate() { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
826 } | 849 } |
827 | 850 |
828 void WizardController::SetUsageStatisticsReporting(bool val) { | 851 void WizardController::SetUsageStatisticsReporting(bool val) { |
829 usage_statistics_reporting_ = val; | 852 usage_statistics_reporting_ = val; |
830 } | 853 } |
831 | 854 |
832 bool WizardController::GetUsageStatisticsReporting() const { | 855 bool WizardController::GetUsageStatisticsReporting() const { |
833 return usage_statistics_reporting_; | 856 return usage_statistics_reporting_; |
834 } | 857 } |
835 | 858 |
859 void WizardController::SetRlzEnabled(bool val) { | |
860 #if defined(ENABLE_RLZ) | |
861 rlz_enabled_ = val; | |
862 #endif | |
863 } | |
864 | |
865 bool WizardController::GetRlzEnabled() const { | |
866 return rlz_enabled_; | |
867 } | |
868 | |
836 // static | 869 // static |
837 bool WizardController::IsZeroDelayEnabled() { | 870 bool WizardController::IsZeroDelayEnabled() { |
838 return zero_delay_enabled_; | 871 return zero_delay_enabled_; |
839 } | 872 } |
840 | 873 |
841 // static | 874 // static |
842 void WizardController::SetZeroDelays() { | 875 void WizardController::SetZeroDelays() { |
843 kShowDelayMs = 0; | 876 kShowDelayMs = 0; |
844 zero_delay_enabled_ = true; | 877 zero_delay_enabled_ = true; |
845 } | 878 } |
846 | 879 |
847 } // namespace chromeos | 880 } // namespace chromeos |
OLD | NEW |