| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include <sys/types.h> | 10 #include <sys/types.h> |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 } | 177 } |
| 178 | 178 |
| 179 #if defined(GOOGLE_CHROME_BUILD) | 179 #if defined(GOOGLE_CHROME_BUILD) |
| 180 void InitializeCrashReporter() { | 180 void InitializeCrashReporter() { |
| 181 // The crash reporter initialization needs IO to complete. | 181 // The crash reporter initialization needs IO to complete. |
| 182 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 182 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 183 breakpad::InitCrashReporter(std::string()); | 183 breakpad::InitCrashReporter(std::string()); |
| 184 } | 184 } |
| 185 #endif | 185 #endif |
| 186 | 186 |
| 187 bool UseMDOobe() { |
| 188 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 189 chromeos::switches::kEnableMdOobe); |
| 190 } |
| 191 |
| 187 } // namespace | 192 } // namespace |
| 188 | 193 |
| 189 namespace chromeos { | 194 namespace chromeos { |
| 190 | 195 |
| 191 const char WizardController::kNetworkScreenName[] = "network"; | 196 const char WizardController::kNetworkScreenName[] = "network"; |
| 192 const char WizardController::kLoginScreenName[] = "login"; | 197 const char WizardController::kLoginScreenName[] = "login"; |
| 193 const char WizardController::kUpdateScreenName[] = "update"; | 198 const char WizardController::kUpdateScreenName[] = "update"; |
| 194 const char WizardController::kUserImageScreenName[] = "image"; | 199 const char WizardController::kUserImageScreenName[] = "image"; |
| 195 const char WizardController::kEulaScreenName[] = "eula"; | 200 const char WizardController::kEulaScreenName[] = "eula"; |
| 196 const char WizardController::kEnableDebuggingScreenName[] = "debugging"; | 201 const char WizardController::kEnableDebuggingScreenName[] = "debugging"; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 !IsControllerDetected() && | 312 !IsControllerDetected() && |
| 308 (first_screen_name.empty() || | 313 (first_screen_name.empty() || |
| 309 first_screen_name == WizardController::kTestNoScreenName)) { | 314 first_screen_name == WizardController::kTestNoScreenName)) { |
| 310 first_screen_name_ = screen_pref; | 315 first_screen_name_ = screen_pref; |
| 311 } | 316 } |
| 312 // We need to reset the kOobeControllerDetected pref to allow the user to have | 317 // We need to reset the kOobeControllerDetected pref to allow the user to have |
| 313 // the choice to setup the device manually. The pref will be set properly if | 318 // the choice to setup the device manually. The pref will be set properly if |
| 314 // an eligible controller is detected later. | 319 // an eligible controller is detected later. |
| 315 SetControllerDetectedPref(false); | 320 SetControllerDetectedPref(false); |
| 316 | 321 |
| 322 // If flag disappeared after restart, disable. |
| 323 if (!UseMDOobe()) |
| 324 GetLocalState()->SetBoolean(prefs::kOobeMdMode, false); |
| 325 |
| 317 AdvanceToScreen(first_screen_name_); | 326 AdvanceToScreen(first_screen_name_); |
| 318 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && | 327 if (!IsMachineHWIDCorrect() && !StartupUtils::IsDeviceRegistered() && |
| 319 first_screen_name_.empty()) | 328 first_screen_name_.empty()) |
| 320 ShowWrongHWIDScreen(); | 329 ShowWrongHWIDScreen(); |
| 321 } | 330 } |
| 322 | 331 |
| 323 ErrorScreen* WizardController::GetErrorScreen() { | 332 ErrorScreen* WizardController::GetErrorScreen() { |
| 324 return oobe_ui_->GetErrorScreen(); | 333 return oobe_ui_->GetErrorScreen(); |
| 325 } | 334 } |
| 326 | 335 |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 host_->SetStatusAreaVisible(visible); | 922 host_->SetStatusAreaVisible(visible); |
| 914 } | 923 } |
| 915 | 924 |
| 916 void WizardController::OnHIDScreenNecessityCheck(bool screen_needed) { | 925 void WizardController::OnHIDScreenNecessityCheck(bool screen_needed) { |
| 917 if (!oobe_ui_) | 926 if (!oobe_ui_) |
| 918 return; | 927 return; |
| 919 | 928 |
| 920 if (screen_needed) { | 929 if (screen_needed) { |
| 921 ShowHIDDetectionScreen(); | 930 ShowHIDDetectionScreen(); |
| 922 } else { | 931 } else { |
| 923 oobe_ui_->EnableMdOobe(); | 932 if (UseMDOobe()) |
| 933 GetLocalState()->SetBoolean(prefs::kOobeMdMode, true); |
| 934 |
| 924 ShowNetworkScreen(); | 935 ShowNetworkScreen(); |
| 925 } | 936 } |
| 926 } | 937 } |
| 927 | 938 |
| 928 void WizardController::AdvanceToScreen(const std::string& screen_name) { | 939 void WizardController::AdvanceToScreen(const std::string& screen_name) { |
| 929 if (screen_name == kNetworkScreenName) { | 940 if (screen_name == kNetworkScreenName) { |
| 930 ShowNetworkScreen(); | 941 ShowNetworkScreen(); |
| 931 } else if (screen_name == kLoginScreenName) { | 942 } else if (screen_name == kLoginScreenName) { |
| 932 ShowLoginScreen(LoginScreenContext()); | 943 ShowLoginScreen(LoginScreenContext()); |
| 933 } else if (screen_name == kUpdateScreenName) { | 944 } else if (screen_name == kUpdateScreenName) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 time_oobe_started_ = base::Time::Now(); | 980 time_oobe_started_ = base::Time::Now(); |
| 970 if (IsRemoraPairingOobe() || IsControllerDetected()) { | 981 if (IsRemoraPairingOobe() || IsControllerDetected()) { |
| 971 ShowHostPairingScreen(); | 982 ShowHostPairingScreen(); |
| 972 } else if (CanShowHIDDetectionScreen()) { | 983 } else if (CanShowHIDDetectionScreen()) { |
| 973 hid_screen_ = GetScreen(kHIDDetectionScreenName); | 984 hid_screen_ = GetScreen(kHIDDetectionScreenName); |
| 974 base::Callback<void(bool)> on_check = base::Bind( | 985 base::Callback<void(bool)> on_check = base::Bind( |
| 975 &WizardController::OnHIDScreenNecessityCheck, | 986 &WizardController::OnHIDScreenNecessityCheck, |
| 976 weak_factory_.GetWeakPtr()); | 987 weak_factory_.GetWeakPtr()); |
| 977 oobe_ui_->GetHIDDetectionView()->CheckIsScreenRequired(on_check); | 988 oobe_ui_->GetHIDDetectionView()->CheckIsScreenRequired(on_check); |
| 978 } else { | 989 } else { |
| 979 oobe_ui_->EnableMdOobe(); | 990 if (UseMDOobe()) |
| 991 GetLocalState()->SetBoolean(prefs::kOobeMdMode, true); |
| 992 |
| 980 ShowNetworkScreen(); | 993 ShowNetworkScreen(); |
| 981 } | 994 } |
| 982 } else { | 995 } else { |
| 983 ShowLoginScreen(LoginScreenContext()); | 996 ShowLoginScreen(LoginScreenContext()); |
| 984 } | 997 } |
| 985 } | 998 } |
| 986 } | 999 } |
| 987 | 1000 |
| 988 /////////////////////////////////////////////////////////////////////////////// | 1001 /////////////////////////////////////////////////////////////////////////////// |
| 989 // WizardController, BaseScreenDelegate overrides: | 1002 // WizardController, BaseScreenDelegate overrides: |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; | 1417 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; |
| 1405 } | 1418 } |
| 1406 | 1419 |
| 1407 EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 1420 EnrollmentScreen* screen = EnrollmentScreen::Get(this); |
| 1408 screen->SetParameters(effective_config, shark_controller_.get()); | 1421 screen->SetParameters(effective_config, shark_controller_.get()); |
| 1409 SetStatusAreaVisible(true); | 1422 SetStatusAreaVisible(true); |
| 1410 SetCurrentScreen(screen); | 1423 SetCurrentScreen(screen); |
| 1411 } | 1424 } |
| 1412 | 1425 |
| 1413 } // namespace chromeos | 1426 } // namespace chromeos |
| OLD | NEW |