Commit 6db66756 authored by Roman Aleksandrov's avatar Roman Aleksandrov Committed by Commit Bot

Packaged License Screen: Introduce new screen to the OOBE flow.

Add Packaged License screen before Login screen if device packaged with
license.


Bug: 1024809
Change-Id: I8bc6359658e352f1369ecb8ac94a2133a3eba756
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1924434Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarRoman Sorokin [CET] <rsorokin@chromium.org>
Commit-Queue: Roman Aleksandrov <raleksandrov@google.com>
Cr-Commit-Position: refs/heads/master@{#721551}
parent 61df642a
......@@ -364,6 +364,10 @@ WizardController::~WizardController() {
void WizardController::Init(OobeScreenId first_screen) {
screen_manager_->Init(CreateScreens());
prescribed_enrollment_config_ = g_browser_process->platform_part()
->browser_policy_connector_chromeos()
->GetPrescribedEnrollmentConfig();
VLOG(1) << "Starting OOBE wizard with screen: " << first_screen;
first_screen_ = first_screen;
......@@ -591,6 +595,14 @@ void WizardController::ShowNetworkScreen() {
SetCurrentScreen(GetScreen(NetworkScreenView::kScreenId));
}
void WizardController::OnOwnershipStatusCheckDone(
DeviceSettingsService::OwnershipStatus status) {
if (status == DeviceSettingsService::OWNERSHIP_NONE)
ShowPackagedLicenseScreen();
else
ShowLoginScreen(LoginScreenContext());
}
void WizardController::ShowLoginScreen(const LoginScreenContext& context) {
// This may be triggered by multiply asynchronous events from the JS side.
if (login_screen_started_)
......@@ -747,6 +759,13 @@ void WizardController::ShowDiscoverScreen() {
SetCurrentScreen(GetScreen(DiscoverScreenView::kScreenId));
}
void WizardController::ShowPackagedLicenseScreen() {
if (should_show_packaged_license_screen())
SetCurrentScreen(GetScreen(PackagedLicenseView::kScreenId));
else
ShowLoginScreen(LoginScreenContext());
}
void WizardController::SkipToLoginForTesting(
const LoginScreenContext& context) {
VLOG(1) << "SkipToLoginForTesting.";
......@@ -796,7 +815,7 @@ void WizardController::OnWrongHWIDScreenExit() {
if (previous_screen_) {
SetCurrentScreen(previous_screen_);
} else {
ShowLoginScreen(LoginScreenContext());
ShowPackagedLicenseScreen();
}
}
......@@ -1214,7 +1233,7 @@ void WizardController::OnDeviceModificationCanceled() {
if (current_screen_)
current_screen_->Hide();
ShowLoginScreen(LoginScreenContext());
ShowPackagedLicenseScreen();
}
}
......@@ -1226,8 +1245,15 @@ void WizardController::OnSupervisionTransitionScreenExit() {
void WizardController::OnPackagedLicenseScreenExit(
PackagedLicenseScreen::Result result) {
// TODO(crbug.com/1024809): Add new screen to the OOBE flow.
NOTREACHED();
OnScreenExit(PackagedLicenseView::kScreenId, 0 /* exit_code */);
switch (result) {
case PackagedLicenseScreen::Result::DONT_ENROLL:
ShowLoginScreen(LoginScreenContext());
break;
case PackagedLicenseScreen::Result::ENROLL:
ShowEnrollmentScreen();
break;
}
}
void WizardController::OnOobeFlowFinished() {
......@@ -1278,7 +1304,7 @@ void WizardController::OnDeviceDisabledChecked(bool device_disabled) {
StartEnrollmentScreen(skip_update_enroll_after_eula_);
} else {
PerformOOBECompletedActions();
ShowLoginScreen(LoginScreenContext());
ShowPackagedLicenseScreen();
}
}
......@@ -1456,6 +1482,8 @@ void WizardController::AdvanceToScreen(OobeScreenId screen) {
ShowNetworkScreen();
} else if (screen == OobeScreen::SCREEN_SPECIAL_LOGIN) {
ShowLoginScreen(LoginScreenContext());
} else if (screen == PackagedLicenseView::kScreenId) {
ShowPackagedLicenseScreen();
} else if (screen == UpdateView::kScreenId) {
InitiateOOBEUpdate();
} else if (screen == EulaView::kScreenId) {
......@@ -1529,7 +1557,9 @@ void WizardController::AdvanceToScreen(OobeScreenId screen) {
ShowWelcomeScreen();
}
} else {
ShowLoginScreen(LoginScreenContext());
DeviceSettingsService::Get()->GetOwnershipStatusAsync(
base::Bind(&WizardController::OnOwnershipStatusCheckDone,
weak_factory_.GetWeakPtr()));
}
}
}
......
......@@ -135,6 +135,14 @@ class WizardController {
// Returns true if the current wizard instance has reached the login screen.
bool login_screen_started() const { return login_screen_started_; }
// Returns true if packaged license screen should be shown.
// License screen should be shown when device packed with license and other
// enrollment flows are not triggered by the device state.
bool should_show_packaged_license_screen() const {
return prescribed_enrollment_config_.is_license_packaged_with_device &&
!prescribed_enrollment_config_.should_enroll();
}
// Returns true if a given screen exists.
bool HasScreen(OobeScreenId screen);
......@@ -187,10 +195,15 @@ class WizardController {
void ShowMultiDeviceSetupScreen();
void ShowDiscoverScreen();
void ShowMarketingOptInScreen();
void ShowPackagedLicenseScreen();
// Shows images login screen.
void ShowLoginScreen(const LoginScreenContext& context);
// Shows default screen depending on device ownership.
void OnOwnershipStatusCheckDone(
DeviceSettingsService::OwnershipStatus status);
// Shared actions to be performed on a screen exit.
// |exit_code| is the screen specific exit code reported by the screen.
void OnScreenExit(OobeScreenId screen, int exit_code);
......
......@@ -411,6 +411,7 @@ cr.define('cr.ui.login', function() {
} else if (name == ACCELERATOR_ENROLLMENT) {
if (attributes.startEnrollmentAllowed ||
currentStepId == SCREEN_GAIA_SIGNIN ||
currentStepId == SCREEN_PACKAGED_LICENSE ||
currentStepId == SCREEN_ACCOUNT_PICKER) {
chrome.send('toggleEnrollmentScreen');
} else if (attributes.postponeEnrollmentAllowed ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment