0

Introduced switches for Master/Slave bootstrapping process.

BUG=564370

Review URL: https://codereview.chromium.org/1492043002

Cr-Commit-Position: refs/heads/master@{#363646}
This commit is contained in:
xdai
2015-12-07 16:53:56 -08:00
committed by Commit bot
parent d6491e05a5
commit 7300b9e6ca
6 changed files with 52 additions and 7 deletions

@ -140,6 +140,18 @@ bool IsRemoraRequisition() {
->IsRemoraRequisition();
}
// Checks if the device is a "Slave" device in the bootstrapping process.
bool IsBootstrappingSlave() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kOobeBootstrappingSlave);
}
// Checks if the device is a "Master" device in the bootstrapping process.
bool IsBootstrappingMaster() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kOobeBootstrappingMaster);
}
#if defined(GOOGLE_CHROME_BUILD)
void InitializeCrashReporter() {
// The crash reporter initialization needs IO to complete.
@ -270,6 +282,11 @@ void WizardController::Init(const std::string& first_screen_name) {
}
}
// If the device is a Master device in bootstrapping process (mostly for demo
// and test purpose), start the enrollment OOBE flow.
if (IsBootstrappingMaster())
connector->GetDeviceCloudPolicyManager()->SetDeviceEnrollmentAutoStart();
// Use the saved screen preference from Local State.
const std::string screen_pref =
GetLocalState()->GetString(prefs::kOobeScreenPending);
@ -585,7 +602,7 @@ void WizardController::OnUpdateCompleted() {
->browser_policy_connector_chromeos()
->GetDeviceCloudPolicyManager()
->IsSharkRequisition();
if (is_shark) {
if (is_shark || IsBootstrappingMaster()) {
ShowControllerPairingScreen();
} else {
ShowAutoEnrollmentCheckScreen();
@ -1287,7 +1304,7 @@ bool WizardController::IsHostPairingOobe() const {
}
void WizardController::MaybeStartListeningForSharkConnection() {
if (!IsRemoraRequisition())
if (!IsRemoraRequisition() && !IsBootstrappingSlave())
return;
// We shouldn't be here if we are running pairing OOBE already.
@ -1308,6 +1325,14 @@ void WizardController::OnSharkConnected(
base::MessageLoop::current()->DeleteSoon(
FROM_HERE, shark_connection_listener_.release());
shark_controller_detected_ = true;
if (IsBootstrappingSlave()) {
g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetDeviceCloudPolicyManager()
->SetDeviceEnrollmentAutoStart();
}
ShowHostPairingScreen();
}

@ -185,6 +185,13 @@ bool DeviceCloudPolicyManagerChromeOS::IsSharkRequisition() const {
return GetDeviceRequisition() == kSharkRequisition;
}
void DeviceCloudPolicyManagerChromeOS::SetDeviceEnrollmentAutoStart() {
if (local_state_) {
local_state_->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
local_state_->SetBoolean(prefs::kDeviceEnrollmentCanExit, false);
}
}
void DeviceCloudPolicyManagerChromeOS::Shutdown() {
status_uploader_.reset();
syslog_uploader_.reset();

@ -74,6 +74,9 @@ class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager {
bool IsRemoraRequisition() const;
bool IsSharkRequisition() const;
// If set, the device will start the enterprise enrollment OOBE.
void SetDeviceEnrollmentAutoStart();
// CloudPolicyManager:
void Shutdown() override;

@ -204,17 +204,21 @@ void NetworkScreenHandler::GetAdditionalParameters(
// So we need to disable activation of login layouts if we are already in
// active user session.
//
// 3) This is the bootstrapping process for the remora device. The locale &
// input of the remora device is set up by a shark device. In this case we
// don't want EnableLoginLayout() to reset the input method to the hardware
// default method.
// 3) This is the bootstrapping process for the remora/"Slave" device. The
// locale & input of the remora/"Slave" device is set up by a shark/"Master"
// device. In this case we don't want EnableLoginLayout() to reset the input
// method to the hardware default method.
const bool is_remora = g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetDeviceCloudPolicyManager()
->IsRemoraRequisition();
const bool is_slave = base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kOobeBootstrappingSlave);
const bool enable_layouts =
!user_manager::UserManager::Get()->IsUserLoggedIn() && !is_remora;
!user_manager::UserManager::Get()->IsUserLoggedIn() && !is_slave &&
!is_remora;
dict->Set("languageList", language_list.release());
dict->Set(

@ -243,6 +243,10 @@ const char kOobeTimerInterval[] = "oobe-timer-interval";
// Indicates that a guest session has been started before OOBE completion.
const char kOobeGuestSession[] = "oobe-guest-session";
// Indicates that if we should start bootstrapping Master/Slave OOBE.
const char kOobeBootstrappingMaster[] = "oobe-bootstrapping-master";
const char kOobeBootstrappingSlave[] = "oobe-bootstrapping-slave";
// Specifies power stub behavior:
// 'cycle=2' - Cycles power states every 2 seconds.
// See FakeDBusThreadManager::ParsePowerCommandLineSwitch for full details.

@ -90,6 +90,8 @@ CHROMEOS_EXPORT extern const char kAggressiveCacheDiscardThreshold[];
CHROMEOS_EXPORT extern const char kAggressiveTabDiscardThreshold[];
CHROMEOS_EXPORT extern const char kAggressiveThreshold[];
CHROMEOS_EXPORT extern const char kNaturalScrollDefault[];
CHROMEOS_EXPORT extern const char kOobeBootstrappingMaster[];
CHROMEOS_EXPORT extern const char kOobeBootstrappingSlave[];
CHROMEOS_EXPORT extern const char kOobeGuestSession[];
CHROMEOS_EXPORT extern const char kOobeSkipPostLogin[];
CHROMEOS_EXPORT extern const char kOobeTimerInterval[];