Chromium Code Reviews| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 // Stores the list of all screens that should be shown when resuming OOBE. | 102 // Stores the list of all screens that should be shown when resuming OOBE. |
| 103 const char *kResumableScreens[] = { | 103 const char *kResumableScreens[] = { |
| 104 chromeos::WizardController::kNetworkScreenName, | 104 chromeos::WizardController::kNetworkScreenName, |
| 105 chromeos::WizardController::kUpdateScreenName, | 105 chromeos::WizardController::kUpdateScreenName, |
| 106 chromeos::WizardController::kEulaScreenName, | 106 chromeos::WizardController::kEulaScreenName, |
| 107 chromeos::WizardController::kEnrollmentScreenName, | 107 chromeos::WizardController::kEnrollmentScreenName, |
| 108 chromeos::WizardController::kTermsOfServiceScreenName, | 108 chromeos::WizardController::kTermsOfServiceScreenName, |
| 109 chromeos::WizardController::kAutoEnrollmentCheckScreenName | 109 chromeos::WizardController::kAutoEnrollmentCheckScreenName |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // the role of a "slave" device in the OOBE bootstrapping process. | |
|
achuithb
2016/10/01 16:49:17
s/the/The
| |
| 113 const char kOobeBootstrappingSlave[] = "slave"; | |
|
achuithb
2016/10/01 16:49:17
Is this the only possible value? Why not have a bo
xdai1
2016/10/03 21:08:00
You're right. Since we don't need an accelerator f
| |
| 114 | |
| 112 // Checks flag for HID-detection screen show. | 115 // Checks flag for HID-detection screen show. |
| 113 bool CanShowHIDDetectionScreen() { | 116 bool CanShowHIDDetectionScreen() { |
| 114 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 117 return !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 115 chromeos::switches::kDisableHIDDetectionOnOOBE); | 118 chromeos::switches::kDisableHIDDetectionOnOOBE); |
| 116 } | 119 } |
| 117 | 120 |
| 118 bool IsResumableScreen(const std::string& screen) { | 121 bool IsResumableScreen(const std::string& screen) { |
| 119 for (size_t i = 0; i < arraysize(kResumableScreens); ++i) { | 122 for (size_t i = 0; i < arraysize(kResumableScreens); ++i) { |
| 120 if (screen == kResumableScreens[i]) | 123 if (screen == kResumableScreens[i]) |
| 121 return true; | 124 return true; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 return g_browser_process->local_state()->GetBoolean( | 162 return g_browser_process->local_state()->GetBoolean( |
| 160 prefs::kOobeControllerDetected); | 163 prefs::kOobeControllerDetected); |
| 161 } | 164 } |
| 162 | 165 |
| 163 void SetControllerDetectedPref(bool value) { | 166 void SetControllerDetectedPref(bool value) { |
| 164 PrefService* prefs = g_browser_process->local_state(); | 167 PrefService* prefs = g_browser_process->local_state(); |
| 165 prefs->SetBoolean(prefs::kOobeControllerDetected, value); | 168 prefs->SetBoolean(prefs::kOobeControllerDetected, value); |
| 166 prefs->CommitPendingWrite(); | 169 prefs->CommitPendingWrite(); |
| 167 } | 170 } |
| 168 | 171 |
| 172 // Checks if the device is a "slave" device in the bootstrapping process. | |
| 173 bool IsBootstrappingSlave() { | |
| 174 return g_browser_process->local_state()->GetString( | |
| 175 prefs::kOobeBootstrappingRole) == kOobeBootstrappingSlave; | |
| 176 } | |
| 177 | |
| 169 // Checks if the device is a "Master" device in the bootstrapping process. | 178 // Checks if the device is a "Master" device in the bootstrapping process. |
| 170 bool IsBootstrappingMaster() { | 179 bool IsBootstrappingMaster() { |
| 171 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 180 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 172 chromeos::switches::kOobeBootstrappingMaster); | 181 chromeos::switches::kOobeBootstrappingMaster); |
| 173 } | 182 } |
| 174 | 183 |
| 175 bool NetworkAllowUpdate(const chromeos::NetworkState* network) { | 184 bool NetworkAllowUpdate(const chromeos::NetworkState* network) { |
| 176 if (!network || !network->IsConnectedState()) | 185 if (!network || !network->IsConnectedState()) |
| 177 return false; | 186 return false; |
| 178 if (network->type() == shill::kTypeBluetooth || | 187 if (network->type() == shill::kTypeBluetooth || |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 return nullptr; | 432 return nullptr; |
| 424 } | 433 } |
| 425 | 434 |
| 426 void WizardController::ShowNetworkScreen() { | 435 void WizardController::ShowNetworkScreen() { |
| 427 VLOG(1) << "Showing network screen."; | 436 VLOG(1) << "Showing network screen."; |
| 428 // Hide the status area initially; it only appears after OOBE first animates | 437 // Hide the status area initially; it only appears after OOBE first animates |
| 429 // in. Keep it visible if the user goes back to the existing network screen. | 438 // in. Keep it visible if the user goes back to the existing network screen. |
| 430 SetStatusAreaVisible(HasScreen(kNetworkScreenName)); | 439 SetStatusAreaVisible(HasScreen(kNetworkScreenName)); |
| 431 SetCurrentScreen(GetScreen(kNetworkScreenName)); | 440 SetCurrentScreen(GetScreen(kNetworkScreenName)); |
| 432 | 441 |
| 433 MaybeStartListeningForSharkConnection(); | 442 if (IsBootstrappingSlave()) |
| 443 MaybeStartListeningForSharkConnection(); | |
| 434 } | 444 } |
| 435 | 445 |
| 436 void WizardController::ShowLoginScreen(const LoginScreenContext& context) { | 446 void WizardController::ShowLoginScreen(const LoginScreenContext& context) { |
| 437 // This may be triggered by multiply asynchronous events from the JS side. | 447 // This may be triggered by multiply asynchronous events from the JS side. |
| 438 if (login_screen_started_) | 448 if (login_screen_started_) |
| 439 return; | 449 return; |
| 440 | 450 |
| 441 if (!time_eula_accepted_.is_null()) { | 451 if (!time_eula_accepted_.is_null()) { |
| 442 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_; | 452 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_; |
| 443 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta); | 453 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta); |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1431 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; | 1441 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; |
| 1432 } | 1442 } |
| 1433 | 1443 |
| 1434 EnrollmentScreen* screen = EnrollmentScreen::Get(this); | 1444 EnrollmentScreen* screen = EnrollmentScreen::Get(this); |
| 1435 screen->SetParameters(effective_config, shark_controller_.get()); | 1445 screen->SetParameters(effective_config, shark_controller_.get()); |
| 1436 SetStatusAreaVisible(true); | 1446 SetStatusAreaVisible(true); |
| 1437 SetCurrentScreen(screen); | 1447 SetCurrentScreen(screen); |
| 1438 } | 1448 } |
| 1439 | 1449 |
| 1440 } // namespace chromeos | 1450 } // namespace chromeos |
| OLD | NEW |