Commit 8a674ef1 authored by proberge's avatar proberge Committed by Commit Bot

Chrome Cleanup: Prevent accidental prompt acceptance

If a user is typing as the Chrome Cleanup prompt is opening, there's a
good chance that a Space or Enter keyboard click will accept the dialog,
surprising users who did not intend to consent to the Chrome Cleanup.

This works around the issue by setting the initial focus on the details
button. This brings the user to a new tab with more details about
Chrome Cleanup and allows them to start cleanup from there.

Bug: 690020
Change-Id: Ibac7fe55ecc403e831e8fc4fc469c980557b83d4
Reviewed-on: https://chromium-review.googlesource.com/575355
Commit-Queue: proberge <proberge@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487940}
parent 7e56993a
...@@ -95,6 +95,13 @@ base::string16 ChromeCleanerDialog::GetWindowTitle() const { ...@@ -95,6 +95,13 @@ base::string16 ChromeCleanerDialog::GetWindowTitle() const {
return l10n_util::GetStringUTF16(IDS_CHROME_CLEANUP_PROMPT_TITLE); return l10n_util::GetStringUTF16(IDS_CHROME_CLEANUP_PROMPT_TITLE);
} }
views::View* ChromeCleanerDialog::GetInitiallyFocusedView() {
// Set focus away from the Remove/OK button to prevent accidental prompt
// acceptance if the user is typing as the dialog appears.
DCHECK(details_button_);
return details_button_;
}
// DialogDelegate overrides. // DialogDelegate overrides.
views::View* ChromeCleanerDialog::CreateFootnoteView() { views::View* ChromeCleanerDialog::CreateFootnoteView() {
......
...@@ -46,6 +46,7 @@ class ChromeCleanerDialog : public views::DialogDelegateView, ...@@ -46,6 +46,7 @@ class ChromeCleanerDialog : public views::DialogDelegateView,
// views::WidgetDelegate overrides. // views::WidgetDelegate overrides.
ui::ModalType GetModalType() const override; ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override; base::string16 GetWindowTitle() const override;
views::View* GetInitiallyFocusedView() override;
// views::DialogDelegate overrides. // views::DialogDelegate overrides.
views::View* CreateFootnoteView() override; views::View* CreateFootnoteView() 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