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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 PrefService::UNSYNCABLE_PREF); | 414 PrefService::UNSYNCABLE_PREF); |
412 } | 415 } |
413 if (local_state->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { | 416 if (local_state->FindPreference(prefs::kVirtualKeyboardEnabled) == NULL) { |
414 local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, | 417 local_state->RegisterBooleanPref(prefs::kVirtualKeyboardEnabled, |
415 false, | 418 false, |
416 PrefService::UNSYNCABLE_PREF); | 419 PrefService::UNSYNCABLE_PREF); |
417 } | 420 } |
418 local_state->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); | 421 local_state->RegisterBooleanPref(prefs::kOwnerPrimaryMouseButtonRight, false); |
419 local_state->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); | 422 local_state->RegisterBooleanPref(prefs::kOwnerTapToClickEnabled, true); |
420 local_state->RegisterBooleanPref(prefs::kFactoryResetRequested, false); | 423 local_state->RegisterBooleanPref(prefs::kFactoryResetRequested, false); |
| 424 local_state->RegisterStringPref(prefs::kRLZBrand, std::string(), |
| 425 PrefService::UNSYNCABLE_PREF); |
| 426 local_state->RegisterBooleanPref(prefs::kRLZEnabled, false, |
| 427 PrefService::UNSYNCABLE_PREF); |
421 } | 428 } |
422 | 429 |
423 /////////////////////////////////////////////////////////////////////////////// | 430 /////////////////////////////////////////////////////////////////////////////// |
424 // WizardController, ExitHandlers: | 431 // WizardController, ExitHandlers: |
425 void WizardController::OnNetworkConnected() { | 432 void WizardController::OnNetworkConnected() { |
426 if (is_official_build_) { | 433 if (is_official_build_) { |
427 if (!IsEulaAccepted()) { | 434 if (!IsEulaAccepted()) { |
428 ShowEulaScreen(); | 435 ShowEulaScreen(); |
429 } else { | 436 } else { |
430 // Possible cases: | 437 // Possible cases: |
(...skipping 18 matching lines...) Expand all Loading... |
449 ShowLoginScreen(); | 456 ShowLoginScreen(); |
450 } | 457 } |
451 | 458 |
452 void WizardController::OnUpdateCompleted() { | 459 void WizardController::OnUpdateCompleted() { |
453 OnOOBECompleted(); | 460 OnOOBECompleted(); |
454 } | 461 } |
455 | 462 |
456 void WizardController::OnEulaAccepted() { | 463 void WizardController::OnEulaAccepted() { |
457 time_eula_accepted_ = base::Time::Now(); | 464 time_eula_accepted_ = base::Time::Now(); |
458 MarkEulaAccepted(); | 465 MarkEulaAccepted(); |
459 bool enabled = | 466 bool uma_enabled = |
460 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); | 467 OptionsUtil::ResolveMetricsReportingEnabled(usage_statistics_reporting_); |
461 | 468 |
462 content::NotificationService::current()->Notify( | 469 content::NotificationService::current()->Notify( |
463 chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED, | 470 chrome::NOTIFICATION_WIZARD_EULA_ACCEPTED, |
464 content::NotificationSource(content::Source<WizardController>(this)), | 471 content::NotificationSource(content::Source<WizardController>(this)), |
465 content::NotificationService::NoDetails()); | 472 content::NotificationService::NoDetails()); |
466 | 473 |
467 CrosSettings::Get()->SetBoolean(kStatsReportingPref, enabled); | 474 CrosSettings::Get()->SetBoolean(kStatsReportingPref, uma_enabled); |
468 if (enabled) { | 475 if (uma_enabled) { |
469 #if defined(USE_LINUX_BREAKPAD) | 476 #if defined(USE_LINUX_BREAKPAD) |
470 // The crash reporter initialization needs IO to complete. | 477 // The crash reporter initialization needs IO to complete. |
471 base::ThreadRestrictions::ScopedAllowIO allow_io; | 478 base::ThreadRestrictions::ScopedAllowIO allow_io; |
472 InitCrashReporter(); | 479 InitCrashReporter(); |
473 #endif | 480 #endif |
474 } | 481 } |
475 | 482 |
| 483 // TODO(ivankr): post-AU action when |kRLZEnabled| is unset. |
| 484 #if defined(ENABLE_RLZ) |
| 485 SaveBoolPreferenceForced(prefs::kRLZEnabled, rlz_enabled_); |
| 486 #endif |
| 487 if (rlz_enabled_) |
| 488 LoadBrandCodeFromFile(); |
| 489 else |
| 490 OnEulaBlockingTasksDone(); |
| 491 } |
| 492 |
| 493 void WizardController::LoadBrandCodeFromFile() { |
| 494 google_util::chromeos::SetBrandFromFile( |
| 495 base::Bind(&WizardController::OnEulaBlockingTasksDone, |
| 496 weak_ptr_factory_.GetWeakPtr())); |
| 497 } |
| 498 |
| 499 void WizardController::OnEulaBlockingTasksDone() { |
476 if (skip_update_enroll_after_eula_) { | 500 if (skip_update_enroll_after_eula_) { |
477 PerformPostEulaActions(); | 501 PerformPostEulaActions(); |
478 PerformPostUpdateActions(); | 502 PerformPostUpdateActions(); |
479 ShowEnterpriseEnrollmentScreen(); | 503 ShowEnterpriseEnrollmentScreen(); |
480 } else { | 504 } else { |
481 InitiateOOBEUpdate(); | 505 InitiateOOBEUpdate(); |
482 } | 506 } |
483 } | 507 } |
484 | 508 |
485 void WizardController::OnUpdateErrorCheckingForUpdate() { | 509 void WizardController::OnUpdateErrorCheckingForUpdate() { |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
821 } | 845 } |
822 | 846 |
823 void WizardController::SetUsageStatisticsReporting(bool val) { | 847 void WizardController::SetUsageStatisticsReporting(bool val) { |
824 usage_statistics_reporting_ = val; | 848 usage_statistics_reporting_ = val; |
825 } | 849 } |
826 | 850 |
827 bool WizardController::GetUsageStatisticsReporting() const { | 851 bool WizardController::GetUsageStatisticsReporting() const { |
828 return usage_statistics_reporting_; | 852 return usage_statistics_reporting_; |
829 } | 853 } |
830 | 854 |
| 855 void WizardController::SetRlzEnabled(bool val) { |
| 856 #if defined(ENABLE_RLZ) |
| 857 rlz_enabled_ = val; |
| 858 #endif |
| 859 } |
| 860 |
| 861 bool WizardController::GetRlzEnabled() const { |
| 862 return rlz_enabled_; |
| 863 } |
| 864 |
831 // static | 865 // static |
832 bool WizardController::IsZeroDelayEnabled() { | 866 bool WizardController::IsZeroDelayEnabled() { |
833 return zero_delay_enabled_; | 867 return zero_delay_enabled_; |
834 } | 868 } |
835 | 869 |
836 // static | 870 // static |
837 void WizardController::SetZeroDelays() { | 871 void WizardController::SetZeroDelays() { |
838 kShowDelayMs = 0; | 872 kShowDelayMs = 0; |
839 zero_delay_enabled_ = true; | 873 zero_delay_enabled_ = true; |
840 } | 874 } |
841 | 875 |
842 } // namespace chromeos | 876 } // namespace chromeos |
OLD | NEW |