Commit 1258a3cb authored by Jason Lin's avatar Jason Lin Committed by Commit Bot

crostini: installer/upgrader dialog should not be forced close on esc

The installer/upgrader web page has its own closing logic to handle esc
key. The dialog code has logic to make sure that it is not forced close
on esc key so that the web page can have a chance to handle it. But this
behavior is broken by CL https://crrev.com/c/1877088. This CL fixes it
by implementing the new ShouldCloseDialogOnEscape() method.

Bug: 1053376
Test: manual
Change-Id: I4cbd9f9e0a6cfec53ff6c7a54c35b326361c5063
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2060367
Auto-Submit: Jason Lin <lxj@google.com>
Reviewed-by: default avatarNicholas Verne <nverne@chromium.org>
Reviewed-by: default avatarDavid Munro <davidmunro@google.com>
Commit-Queue: Nicholas Verne <nverne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742868}
parent 4221c656
...@@ -65,6 +65,13 @@ bool CrostiniInstallerDialog::ShouldShowCloseButton() const { ...@@ -65,6 +65,13 @@ bool CrostiniInstallerDialog::ShouldShowCloseButton() const {
return false; return false;
} }
// TODO(crbug.com/1053376): We should add a browser test for the dialog to check
// that <esc> or X button in overview mode cannot close the dialog immediately
// without the web page noticing it.
bool CrostiniInstallerDialog::ShouldCloseDialogOnEscape() const {
return false;
}
void CrostiniInstallerDialog::AdjustWidgetInitParams( void CrostiniInstallerDialog::AdjustWidgetInitParams(
views::Widget::InitParams* params) { views::Widget::InitParams* params) {
params->z_order = ui::ZOrderLevel::kNormal; params->z_order = ui::ZOrderLevel::kNormal;
......
...@@ -30,6 +30,7 @@ class CrostiniInstallerDialog : public SystemWebDialogDelegate { ...@@ -30,6 +30,7 @@ class CrostiniInstallerDialog : public SystemWebDialogDelegate {
// SystemWebDialogDelegate: // SystemWebDialogDelegate:
void GetDialogSize(gfx::Size* size) const override; void GetDialogSize(gfx::Size* size) const override;
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
bool ShouldCloseDialogOnEscape() const override;
void AdjustWidgetInitParams(views::Widget::InitParams* params) override; void AdjustWidgetInitParams(views::Widget::InitParams* params) override;
bool CanCloseDialog() const override; bool CanCloseDialog() const override;
void OnDialogShown(content::WebUI* webui) override; void OnDialogShown(content::WebUI* webui) override;
......
...@@ -47,6 +47,10 @@ bool CrostiniUpgraderDialog::ShouldShowCloseButton() const { ...@@ -47,6 +47,10 @@ bool CrostiniUpgraderDialog::ShouldShowCloseButton() const {
return false; return false;
} }
bool CrostiniUpgraderDialog::ShouldCloseDialogOnEscape() const {
return false;
}
void CrostiniUpgraderDialog::AdjustWidgetInitParams( void CrostiniUpgraderDialog::AdjustWidgetInitParams(
views::Widget::InitParams* params) { views::Widget::InitParams* params) {
params->z_order = ui::ZOrderLevel::kNormal; params->z_order = ui::ZOrderLevel::kNormal;
......
...@@ -22,6 +22,7 @@ class CrostiniUpgraderDialog : public SystemWebDialogDelegate { ...@@ -22,6 +22,7 @@ class CrostiniUpgraderDialog : public SystemWebDialogDelegate {
// SystemWebDialogDelegate: // SystemWebDialogDelegate:
void GetDialogSize(gfx::Size* size) const override; void GetDialogSize(gfx::Size* size) const override;
bool ShouldShowCloseButton() const override; bool ShouldShowCloseButton() const override;
bool ShouldCloseDialogOnEscape() const override;
void AdjustWidgetInitParams(views::Widget::InitParams* params) override; void AdjustWidgetInitParams(views::Widget::InitParams* params) override;
bool CanCloseDialog() const override; bool CanCloseDialog() const override;
void OnDialogShown(content::WebUI* webui) override; void OnDialogShown(content::WebUI* webui) override;
......
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