Commit 5420f021 authored by Yunke Zhou's avatar Yunke Zhou Committed by Chromium LUCI CQ

Oobe: move Back logic handling in GaiaScreen to WizardController

Bug: 1163474
Change-Id: I931fa71f052b40e11d3f0316717344a0895b36c3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2612946Reviewed-by: default avatarDenis Kuznetsov [CET] <antrim@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: Yunke Zhou <yunkez@google.com>
Cr-Commit-Position: refs/heads/master@{#842412}
parent 2a7e78c7
...@@ -25,8 +25,8 @@ std::string GaiaScreen::GetResultString(Result result) { ...@@ -25,8 +25,8 @@ std::string GaiaScreen::GetResultString(Result result) {
switch (result) { switch (result) {
case Result::BACK: case Result::BACK:
return "Back"; return "Back";
case Result::CLOSE_DIALOG: case Result::CANCEL:
return "CloseDialog"; return "Cancel";
case Result::ENTERPRISE_ENROLL: case Result::ENTERPRISE_ENROLL:
return "EnterpriseEnroll"; return "EnterpriseEnroll";
case Result::START_CONSUMER_KIOSK: case Result::START_CONSUMER_KIOSK:
...@@ -83,21 +83,15 @@ void GaiaScreen::HideImpl() { ...@@ -83,21 +83,15 @@ void GaiaScreen::HideImpl() {
} }
void GaiaScreen::OnUserAction(const std::string& action_id) { void GaiaScreen::OnUserAction(const std::string& action_id) {
if (action_id == kUserActionBack || action_id == kUserActionCancel) { if (action_id == kUserActionBack) {
// `kUserActionBack` will go back to user creation screen if possible. exit_callback_.Run(Result::BACK);
// `kUserActionCancel` will stay at the gaia screen and reload the screen. } else if (action_id == kUserActionCancel) {
if (action_id == kUserActionBack && context()->is_user_creation_enabled) { exit_callback_.Run(Result::CANCEL);
exit_callback_.Run(Result::BACK); } else if (action_id == kUserActionStartEnrollment) {
} else {
HandleCancel();
}
return;
}
if (action_id == kUserActionStartEnrollment) {
exit_callback_.Run(Result::ENTERPRISE_ENROLL); exit_callback_.Run(Result::ENTERPRISE_ENROLL);
return; } else {
BaseScreen::OnUserAction(action_id);
} }
BaseScreen::OnUserAction(action_id);
} }
bool GaiaScreen::HandleAccelerator(ash::LoginAcceleratorAction action) { bool GaiaScreen::HandleAccelerator(ash::LoginAcceleratorAction action) {
...@@ -112,15 +106,4 @@ bool GaiaScreen::HandleAccelerator(ash::LoginAcceleratorAction action) { ...@@ -112,15 +106,4 @@ bool GaiaScreen::HandleAccelerator(ash::LoginAcceleratorAction action) {
return false; return false;
} }
void GaiaScreen::HandleCancel() {
// Close the user pod if it exists and gaia is the first screen, or reload
// the page.
if (LoginDisplayHost::default_host()->HasUserPods() &&
!context()->is_user_creation_enabled) {
exit_callback_.Run(Result::CLOSE_DIALOG);
} else {
LoadOnline(EmptyAccountId());
}
}
} // namespace chromeos } // namespace chromeos
...@@ -24,7 +24,7 @@ class GaiaScreen : public BaseScreen { ...@@ -24,7 +24,7 @@ class GaiaScreen : public BaseScreen {
enum class Result { enum class Result {
BACK, BACK,
CLOSE_DIALOG, CANCEL,
ENTERPRISE_ENROLL, ENTERPRISE_ENROLL,
START_CONSUMER_KIOSK, START_CONSUMER_KIOSK,
}; };
...@@ -51,8 +51,6 @@ class GaiaScreen : public BaseScreen { ...@@ -51,8 +51,6 @@ class GaiaScreen : public BaseScreen {
void OnUserAction(const std::string& action_id) override; void OnUserAction(const std::string& action_id) override;
bool HandleAccelerator(ash::LoginAcceleratorAction action) override; bool HandleAccelerator(ash::LoginAcceleratorAction action) override;
void HandleCancel();
GaiaView* view_ = nullptr; GaiaView* view_ = nullptr;
ScreenExitCallback exit_callback_; ScreenExitCallback exit_callback_;
......
...@@ -957,10 +957,22 @@ void WizardController::OnGaiaScreenExit(GaiaScreen::Result result) { ...@@ -957,10 +957,22 @@ void WizardController::OnGaiaScreenExit(GaiaScreen::Result result) {
OnScreenExit(GaiaView::kScreenId, GaiaScreen::GetResultString(result)); OnScreenExit(GaiaView::kScreenId, GaiaScreen::GetResultString(result));
switch (result) { switch (result) {
case GaiaScreen::Result::BACK: case GaiaScreen::Result::BACK:
AdvanceToScreen(UserCreationView::kScreenId); case GaiaScreen::Result::CANCEL:
break; if (result == GaiaScreen::Result::BACK &&
case GaiaScreen::Result::CLOSE_DIALOG: wizard_context_->is_user_creation_enabled) {
LoginDisplayHost::default_host()->HideOobeDialog(); // `Result::BACK` is only triggered when pressing back button. It goes
// back to UserCreationScreen if screen is enabled; otherwise, it
// behaves the same as `Result::CANCEL` which is triggered by pressing
// ESC key.
AdvanceToScreen(UserCreationView::kScreenId);
break;
}
if (LoginDisplayHost::default_host()->HasUserPods() &&
!wizard_context_->is_user_creation_enabled) {
LoginDisplayHost::default_host()->HideOobeDialog();
} else {
GetScreen<GaiaScreen>()->LoadOnline(EmptyAccountId());
}
break; break;
case GaiaScreen::Result::ENTERPRISE_ENROLL: case GaiaScreen::Result::ENTERPRISE_ENROLL:
ShowEnrollmentScreenIfEligible(); ShowEnrollmentScreenIfEligible();
......
...@@ -12016,7 +12016,12 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -12016,7 +12016,12 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<suffix name="Family-link-notice.Done" label=""/> <suffix name="Family-link-notice.Done" label=""/>
<suffix name="Fingerprint-setup.Next" label=""/> <suffix name="Fingerprint-setup.Next" label=""/>
<suffix name="Gaia-signin.Back" label=""/> <suffix name="Gaia-signin.Back" label=""/>
<suffix name="Gaia-signin.CloseDialog" label=""/> <suffix name="Gaia-signin.Cancel" label=""/>
<suffix name="Gaia-signin.CloseDialog" label="">
<obsolete>
Removed in M89.
</obsolete>
</suffix>
<suffix name="Gaia-signin.EnterpriseEnroll" label=""/> <suffix name="Gaia-signin.EnterpriseEnroll" label=""/>
<suffix name="Gaia-signin.StartConsumerKiosk" label=""/> <suffix name="Gaia-signin.StartConsumerKiosk" label=""/>
<suffix name="Gesture-navigation.Next" label=""/> <suffix name="Gesture-navigation.Next" label=""/>
......
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