Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1330)

Unified Diff: chrome/browser/ui/views/location_bar/bubble_icon_view.cc

Issue 1955583002: Second try at fixing location bar icon keyboard activation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/bubble_icon_view.cc
diff --git a/chrome/browser/ui/views/location_bar/bubble_icon_view.cc b/chrome/browser/ui/views/location_bar/bubble_icon_view.cc
index 6b62f1134d08f37d2d30934cb25b28406d333254..9cf8c041f928b4fc0aad2fa2d97f829bca193272 100644
--- a/chrome/browser/ui/views/location_bar/bubble_icon_view.cc
+++ b/chrome/browser/ui/views/location_bar/bubble_icon_view.cc
@@ -98,11 +98,22 @@ void BubbleIconView::OnMouseReleased(const ui::MouseEvent& event) {
ExecuteCommand(EXECUTE_SOURCE_MOUSE);
}
-bool BubbleIconView::OnKeyReleased(const ui::KeyEvent& event) {
- if (event.key_code() != ui::VKEY_SPACE && event.key_code() != ui::VKEY_RETURN)
+bool BubbleIconView::OnKeyPressed(const ui::KeyEvent& event) {
+ if (event.key_code() != ui::VKEY_RETURN && event.key_code() != ui::VKEY_SPACE)
return false;
ink_drop_delegate_->OnAction(views::InkDropState::ACTIVATED);
+ // As with CustomButton, return activates on key down and space activates on
+ // key up.
+ if (event.key_code() == ui::VKEY_RETURN)
+ ExecuteCommand(EXECUTE_SOURCE_KEYBOARD);
+ return true;
+}
+
+bool BubbleIconView::OnKeyReleased(const ui::KeyEvent& event) {
+ if (event.key_code() != ui::VKEY_SPACE)
+ return false;
+
ExecuteCommand(EXECUTE_SOURCE_KEYBOARD);
return true;
}
« no previous file with comments | « chrome/browser/ui/views/location_bar/bubble_icon_view.h ('k') | chrome/browser/ui/views/location_bar/icon_label_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698