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

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller.cc

Issue 2383953002: [Bootstrapping] Introduce an accelerator to put a ChromeOS device into Slave OOBE process. (Closed)
Patch Set: Address achuith@'s comments. Created 4 years, 2 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 <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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return g_browser_process->local_state()->GetBoolean( 159 return g_browser_process->local_state()->GetBoolean(
160 prefs::kOobeControllerDetected); 160 prefs::kOobeControllerDetected);
161 } 161 }
162 162
163 void SetControllerDetectedPref(bool value) { 163 void SetControllerDetectedPref(bool value) {
164 PrefService* prefs = g_browser_process->local_state(); 164 PrefService* prefs = g_browser_process->local_state();
165 prefs->SetBoolean(prefs::kOobeControllerDetected, value); 165 prefs->SetBoolean(prefs::kOobeControllerDetected, value);
166 prefs->CommitPendingWrite(); 166 prefs->CommitPendingWrite();
167 } 167 }
168 168
169 // Checks if the device is a "slave" device in the bootstrapping process.
170 bool IsBootstrappingSlave() {
171 return g_browser_process->local_state()->GetBoolean(
172 prefs::kIsBootstrappingSlave);
173 }
174
169 // Checks if the device is a "Master" device in the bootstrapping process. 175 // Checks if the device is a "Master" device in the bootstrapping process.
170 bool IsBootstrappingMaster() { 176 bool IsBootstrappingMaster() {
171 return base::CommandLine::ForCurrentProcess()->HasSwitch( 177 return base::CommandLine::ForCurrentProcess()->HasSwitch(
172 chromeos::switches::kOobeBootstrappingMaster); 178 chromeos::switches::kOobeBootstrappingMaster);
173 } 179 }
174 180
175 bool NetworkAllowUpdate(const chromeos::NetworkState* network) { 181 bool NetworkAllowUpdate(const chromeos::NetworkState* network) {
176 if (!network || !network->IsConnectedState()) 182 if (!network || !network->IsConnectedState())
177 return false; 183 return false;
178 if (network->type() == shill::kTypeBluetooth || 184 if (network->type() == shill::kTypeBluetooth ||
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 return nullptr; 429 return nullptr;
424 } 430 }
425 431
426 void WizardController::ShowNetworkScreen() { 432 void WizardController::ShowNetworkScreen() {
427 VLOG(1) << "Showing network screen."; 433 VLOG(1) << "Showing network screen.";
428 // Hide the status area initially; it only appears after OOBE first animates 434 // 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. 435 // in. Keep it visible if the user goes back to the existing network screen.
430 SetStatusAreaVisible(HasScreen(kNetworkScreenName)); 436 SetStatusAreaVisible(HasScreen(kNetworkScreenName));
431 SetCurrentScreen(GetScreen(kNetworkScreenName)); 437 SetCurrentScreen(GetScreen(kNetworkScreenName));
432 438
433 MaybeStartListeningForSharkConnection(); 439 // There are two possible screens where we listen to the incoming Bluetooth
440 // connection request: the first one is the HID detection screen, which will
441 // show up when there is no sufficient input devices. In this case, we just
442 // keep the logic as it is today: always put the Bluetooth is discoverable
443 // mode. The other place is the Network screen (here), which will show up when
444 // there are input devices detected. In this case, we disable the Bluetooth by
445 // default until the user explicitly enable it by pressing a key combo (Ctrl+
446 // Alt+Shift+S).
447 if (IsBootstrappingSlave())
448 MaybeStartListeningForSharkConnection();
434 } 449 }
435 450
436 void WizardController::ShowLoginScreen(const LoginScreenContext& context) { 451 void WizardController::ShowLoginScreen(const LoginScreenContext& context) {
437 // This may be triggered by multiply asynchronous events from the JS side. 452 // This may be triggered by multiply asynchronous events from the JS side.
438 if (login_screen_started_) 453 if (login_screen_started_)
439 return; 454 return;
440 455
441 if (!time_eula_accepted_.is_null()) { 456 if (!time_eula_accepted_.is_null()) {
442 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_; 457 base::TimeDelta delta = base::Time::Now() - time_eula_accepted_;
443 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta); 458 UMA_HISTOGRAM_MEDIUM_TIMES("OOBE.EULAToSignInTime", delta);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 SetStatusAreaVisible(true); 567 SetStatusAreaVisible(true);
553 SetCurrentScreen(GetScreen(kSupervisedUserCreationScreenName)); 568 SetCurrentScreen(GetScreen(kSupervisedUserCreationScreenName));
554 } 569 }
555 570
556 void WizardController::ShowHIDDetectionScreen() { 571 void WizardController::ShowHIDDetectionScreen() {
557 VLOG(1) << "Showing HID discovery screen."; 572 VLOG(1) << "Showing HID discovery screen.";
558 // TODO(drcrash): Remove this after testing (http://crbug.com/647411). 573 // TODO(drcrash): Remove this after testing (http://crbug.com/647411).
559 SetShowMdOobe(false); // Disable the MD OOBE from there on. 574 SetShowMdOobe(false); // Disable the MD OOBE from there on.
560 SetStatusAreaVisible(true); 575 SetStatusAreaVisible(true);
561 SetCurrentScreen(GetScreen(kHIDDetectionScreenName)); 576 SetCurrentScreen(GetScreen(kHIDDetectionScreenName));
577 // In HID detection screen, puts the Bluetooth in discoverable mode and waits
578 // for the incoming Bluetooth connection request. See the comments in
579 // WizardController::ShowNetworkScreen() for more details.
562 MaybeStartListeningForSharkConnection(); 580 MaybeStartListeningForSharkConnection();
563 } 581 }
564 582
565 void WizardController::ShowControllerPairingScreen() { 583 void WizardController::ShowControllerPairingScreen() {
566 VLOG(1) << "Showing controller pairing screen."; 584 VLOG(1) << "Showing controller pairing screen.";
567 SetStatusAreaVisible(false); 585 SetStatusAreaVisible(false);
568 SetCurrentScreen(GetScreen(kControllerPairingScreenName)); 586 SetCurrentScreen(GetScreen(kControllerPairingScreenName));
569 } 587 }
570 588
571 void WizardController::ShowHostPairingScreen() { 589 void WizardController::ShowHostPairingScreen() {
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after
1431 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT; 1449 : policy::EnrollmentConfig::MODE_MANUAL_REENROLLMENT;
1432 } 1450 }
1433 1451
1434 EnrollmentScreen* screen = EnrollmentScreen::Get(this); 1452 EnrollmentScreen* screen = EnrollmentScreen::Get(this);
1435 screen->SetParameters(effective_config, shark_controller_.get()); 1453 screen->SetParameters(effective_config, shark_controller_.get());
1436 SetStatusAreaVisible(true); 1454 SetStatusAreaVisible(true);
1437 SetCurrentScreen(screen); 1455 SetCurrentScreen(screen);
1438 } 1456 }
1439 1457
1440 } // namespace chromeos 1458 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/ui/webui_login_view.cc ('k') | chrome/browser/ui/webui/chromeos/login/core_oobe_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698