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

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

Issue 1492043002: Introduced switches for Master/Slave bootstrapping process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address achuith@'s comment Created 5 years 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdlib.h> 8 #include <stdlib.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 histogram->AddTime(step_time); 133 histogram->AddTime(step_time);
134 } 134 }
135 135
136 bool IsRemoraRequisition() { 136 bool IsRemoraRequisition() {
137 return g_browser_process->platform_part() 137 return g_browser_process->platform_part()
138 ->browser_policy_connector_chromeos() 138 ->browser_policy_connector_chromeos()
139 ->GetDeviceCloudPolicyManager() 139 ->GetDeviceCloudPolicyManager()
140 ->IsRemoraRequisition(); 140 ->IsRemoraRequisition();
141 } 141 }
142 142
143 // Checks if the device is a "Slave" device in the bootstrapping process.
144 bool IsBootstrappingSlave() {
dzhioev (left Google) 2015/12/04 21:23:00 I don't get it. Does this flag affect anything? As
145 return base::CommandLine::ForCurrentProcess()->HasSwitch(
146 chromeos::switches::kOobeBootstrappingSlave);
147 }
148
149 // Checks if the device is a "Master" device in the bootstrapping process.
150 bool IsBootstrappingMaster() {
151 return base::CommandLine::ForCurrentProcess()->HasSwitch(
152 chromeos::switches::kOobeBootstrappingMaster);
153 }
154
143 #if defined(GOOGLE_CHROME_BUILD) 155 #if defined(GOOGLE_CHROME_BUILD)
144 void InitializeCrashReporter() { 156 void InitializeCrashReporter() {
145 // The crash reporter initialization needs IO to complete. 157 // The crash reporter initialization needs IO to complete.
146 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); 158 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
147 breakpad::InitCrashReporter(std::string()); 159 breakpad::InitCrashReporter(std::string());
148 } 160 }
149 #endif 161 #endif
150 162
151 } // namespace 163 } // namespace
152 164
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 if (status == PrefService::INITIALIZATION_STATUS_ERROR) { 275 if (status == PrefService::INITIALIZATION_STATUS_ERROR) {
264 OnLocalStateInitialized(false); 276 OnLocalStateInitialized(false);
265 return; 277 return;
266 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) { 278 } else if (status == PrefService::INITIALIZATION_STATUS_WAITING) {
267 GetLocalState()->AddPrefInitObserver( 279 GetLocalState()->AddPrefInitObserver(
268 base::Bind(&WizardController::OnLocalStateInitialized, 280 base::Bind(&WizardController::OnLocalStateInitialized,
269 weak_factory_.GetWeakPtr())); 281 weak_factory_.GetWeakPtr()));
270 } 282 }
271 } 283 }
272 284
285 // If the device is in bootstrapping process, start the enrollment OOBE flow.
286 if (IsBootstrappingSlave() || IsBootstrappingMaster())
287 GetLocalState()->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
dzhioev (left Google) 2015/12/05 00:23:33 Could you please move this code to DeviceCloudPoli
288
273 // Use the saved screen preference from Local State. 289 // Use the saved screen preference from Local State.
274 const std::string screen_pref = 290 const std::string screen_pref =
275 GetLocalState()->GetString(prefs::kOobeScreenPending); 291 GetLocalState()->GetString(prefs::kOobeScreenPending);
276 if (is_out_of_box_ && !screen_pref.empty() && !IsHostPairingOobe() && 292 if (is_out_of_box_ && !screen_pref.empty() && !IsHostPairingOobe() &&
277 (first_screen_name.empty() || 293 (first_screen_name.empty() ||
278 first_screen_name == WizardController::kTestNoScreenName)) { 294 first_screen_name == WizardController::kTestNoScreenName)) {
279 first_screen_name_ = screen_pref; 295 first_screen_name_ = screen_pref;
280 } 296 }
281 297
282 AdvanceToScreen(first_screen_name_); 298 AdvanceToScreen(first_screen_name_);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 void WizardController::OnConnectionFailed() { 594 void WizardController::OnConnectionFailed() {
579 // TODO(dpolukhin): show error message after login screen is displayed. 595 // TODO(dpolukhin): show error message after login screen is displayed.
580 ShowLoginScreen(LoginScreenContext()); 596 ShowLoginScreen(LoginScreenContext());
581 } 597 }
582 598
583 void WizardController::OnUpdateCompleted() { 599 void WizardController::OnUpdateCompleted() {
584 const bool is_shark = g_browser_process->platform_part() 600 const bool is_shark = g_browser_process->platform_part()
585 ->browser_policy_connector_chromeos() 601 ->browser_policy_connector_chromeos()
586 ->GetDeviceCloudPolicyManager() 602 ->GetDeviceCloudPolicyManager()
587 ->IsSharkRequisition(); 603 ->IsSharkRequisition();
588 if (is_shark) { 604 if (is_shark || IsBootstrappingMaster()) {
589 ShowControllerPairingScreen(); 605 ShowControllerPairingScreen();
590 } else { 606 } else {
591 ShowAutoEnrollmentCheckScreen(); 607 ShowAutoEnrollmentCheckScreen();
592 } 608 }
593 } 609 }
594 610
595 void WizardController::OnEulaAccepted() { 611 void WizardController::OnEulaAccepted() {
596 time_eula_accepted_ = base::Time::Now(); 612 time_eula_accepted_ = base::Time::Now();
597 StartupUtils::MarkEulaAccepted(); 613 StartupUtils::MarkEulaAccepted();
598 InitiateMetricsReportingChange( 614 InitiateMetricsReportingChange(
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 } 1296 }
1281 1297
1282 bool WizardController::IsHostPairingOobe() const { 1298 bool WizardController::IsHostPairingOobe() const {
1283 return IsRemoraRequisition() && 1299 return IsRemoraRequisition() &&
1284 (base::CommandLine::ForCurrentProcess()->HasSwitch( 1300 (base::CommandLine::ForCurrentProcess()->HasSwitch(
1285 switches::kHostPairingOobe) || 1301 switches::kHostPairingOobe) ||
1286 shark_controller_detected_); 1302 shark_controller_detected_);
1287 } 1303 }
1288 1304
1289 void WizardController::MaybeStartListeningForSharkConnection() { 1305 void WizardController::MaybeStartListeningForSharkConnection() {
1290 if (!IsRemoraRequisition()) 1306 if (!IsRemoraRequisition() && !IsBootstrappingSlave())
1291 return; 1307 return;
1292 1308
1293 // We shouldn't be here if we are running pairing OOBE already. 1309 // We shouldn't be here if we are running pairing OOBE already.
1294 DCHECK(!IsHostPairingOobe()); 1310 DCHECK(!IsHostPairingOobe());
1295 1311
1296 if (!shark_connection_listener_) { 1312 if (!shark_connection_listener_) {
1297 shark_connection_listener_.reset( 1313 shark_connection_listener_.reset(
1298 new pairing_chromeos::SharkConnectionListener( 1314 new pairing_chromeos::SharkConnectionListener(
1299 base::Bind(&WizardController::OnSharkConnected, 1315 base::Bind(&WizardController::OnSharkConnected,
1300 weak_factory_.GetWeakPtr()))); 1316 weak_factory_.GetWeakPtr())));
(...skipping 25 matching lines...) Expand all
1326 } 1342 }
1327 1343
1328 EnrollmentScreen* screen = EnrollmentScreen::Get(this); 1344 EnrollmentScreen* screen = EnrollmentScreen::Get(this);
1329 screen->SetParameters(effective_config, shark_controller_.get(), 1345 screen->SetParameters(effective_config, shark_controller_.get(),
1330 remora_controller_.get()); 1346 remora_controller_.get());
1331 SetStatusAreaVisible(true); 1347 SetStatusAreaVisible(true);
1332 SetCurrentScreen(screen); 1348 SetCurrentScreen(screen);
1333 } 1349 }
1334 1350
1335 } // namespace chromeos 1351 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/chromeos/login/network_screen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698