diff --git a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc index 9a1ac1799e51d..8830672cf3962 100644 --- a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc +++ b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.cc @@ -109,6 +109,11 @@ void AccountChooserDialogView::WindowClosing() { } } +bool AccountChooserDialogView::ShouldAllowKeyEventsDuringInputProtection() + const { + return false; +} + bool AccountChooserDialogView::Accept() { DCHECK(controller_); controller_->OnSignInClicked(); diff --git a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.h b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.h index bb8589b73117b..5abd784dfa904 100644 --- a/chrome/browser/ui/views/passwords/account_chooser_dialog_view.h +++ b/chrome/browser/ui/views/passwords/account_chooser_dialog_view.h @@ -35,6 +35,11 @@ class AccountChooserDialogView : public views::DialogDelegate, // DialogDelegate: bool Accept() override; + // The 'Sign in' button releases a (possibly cross-origin / PSL-matched) + // saved password to the page. Gate Enter/Space behind the input-event + // activation protector's minimum-show-time so a socially-engineered + // keypress that races dialog appearance is rejected. + bool ShouldAllowKeyEventsDuringInputProtection() const override; private: std::u16string GetWindowTitle() const override; diff --git a/chrome/browser/ui/views/passwords/password_combined_selector_view.cc b/chrome/browser/ui/views/passwords/password_combined_selector_view.cc index 6da03eddbee5f..6181727184da3 100644 --- a/chrome/browser/ui/views/passwords/password_combined_selector_view.cc +++ b/chrome/browser/ui/views/passwords/password_combined_selector_view.cc @@ -522,6 +522,11 @@ bool PasswordCombinedSelectorView::Accept() { return false; } +bool PasswordCombinedSelectorView::ShouldAllowKeyEventsDuringInputProtection() + const { + return false; +} + void PasswordCombinedSelectorView::InitWindow() { auto main_view = std::make_unique(); main_view->SetLayoutManager(std::make_unique()); diff --git a/chrome/browser/ui/views/passwords/password_combined_selector_view.h b/chrome/browser/ui/views/passwords/password_combined_selector_view.h index b8d360c89fc37..5e3bcdf865798 100644 --- a/chrome/browser/ui/views/passwords/password_combined_selector_view.h +++ b/chrome/browser/ui/views/passwords/password_combined_selector_view.h @@ -49,6 +49,11 @@ class PasswordCombinedSelectorView // views::DialogDelegate: bool Accept() override; + // The 'Sign in' button releases a (possibly cross-origin / PSL-matched) + // saved password to the page. Gate Enter/Space behind the input-event + // activation protector's minimum-show-time so a socially-engineered + // keypress that races dialog appearance is rejected. + bool ShouldAllowKeyEventsDuringInputProtection() const override; const std::vector>& GetRadioButtonsForTesting() const {