Commit 6d7f9dd2 authored by Jacob Dufault's avatar Jacob Dufault Committed by Commit Bot

cros: Fix dismissing gaia dialog.

The back button did not work, but escape did. Unify these two exit paths so they
do not diverge, and also fix closing via back button.

Bug: 859130
Change-Id: I96286ea69fb9d230ed82e589030a9e1a747c5150
Reviewed-on: https://chromium-review.googlesource.com/1120868Reviewed-by: default avatarXiaoyin Hu <xiaoyinh@chromium.org>
Commit-Queue: Jacob Dufault <jdufault@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571905}
parent 16742b90
......@@ -239,9 +239,8 @@ void LoginDisplayHostMojo::ShowGaiaDialog(
can_close_dialog_ = false;
if (prefilled_account) {
bool is_signing_in = login_display_->IsSigninInProgress();
// Make sure gaia displays |account| if requested.
if (!is_signing_in)
if (!login_display_->IsSigninInProgress())
GetOobeUI()->GetGaiaScreenView()->ShowGaiaAsync(prefilled_account);
LoadWallpaper(*prefilled_account);
} else {
......@@ -254,20 +253,18 @@ void LoginDisplayHostMojo::ShowGaiaDialog(
void LoginDisplayHostMojo::HideGaiaDialog() {
DCHECK(dialog_);
if (!can_close_dialog_)
return;
if (GetOobeUI() && !can_close_dialog_) {
bool is_signing_in = login_display_->IsSigninInProgress();
// The dialog can not be closed if there is no user on the login screen.
// Refresh the dialog instead.
if (!is_signing_in && users_.empty() && GetOobeUI()) {
GetOobeUI()->GetGaiaScreenView()->ShowGaiaAsync(base::nullopt);
return;
}
LoadWallpaper(focused_pod_account_id_);
dialog_->Hide();
// The dialog can not be closed if there is no user on the login screen.
// Refresh the dialog instead.
if (!login_display_->IsSigninInProgress() && users_.empty()) {
GetOobeUI()->GetGaiaScreenView()->ShowGaiaAsync(base::nullopt);
return;
}
LoadWallpaper(focused_pod_account_id_);
dialog_->Hide();
}
void LoginDisplayHostMojo::UpdateGaiaDialogSize(int width, int height) {
......
......@@ -194,7 +194,7 @@ bool OobeUIDialogDelegate::HandleContextMenu(
}
std::vector<ui::Accelerator> OobeUIDialogDelegate::GetAccelerators() {
// TODO(crbug.com/809648): Adding necessory accelerators.
// TODO(crbug.com/809648): Adding necessary accelerators.
std::vector<ui::Accelerator> output;
for (const auto& pair : accel_map_)
......@@ -206,11 +206,10 @@ std::vector<ui::Accelerator> OobeUIDialogDelegate::GetAccelerators() {
bool OobeUIDialogDelegate::AcceleratorPressed(
const ui::Accelerator& accelerator) {
if (ui::VKEY_ESCAPE == accelerator.key_code()) {
// The widget should not be closed until the login is done.
// Consume the escape key here so WebDialogView won't have a chance to
// close the widget.
if (closable_by_esc_)
Hide();
// The widget should not be closed until the login is done. Consume the
// escape key here so WebDialogView won't have a chance to close the widget.
if (closable_by_esc_ && controller_)
controller_->HideGaiaDialog();
return true;
}
......
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