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

Unified Diff: chrome/browser/views/location_bar_view.cc

Issue 99161: Handle all accelerators in focus manager when focused view doesn't want to ta... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 8 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
« no previous file with comments | « chrome/browser/task_manager.cc ('k') | chrome/views/controls/tree/tree_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/location_bar_view.cc
===================================================================
--- chrome/browser/views/location_bar_view.cc (revision 14861)
+++ chrome/browser/views/location_bar_view.cc (working copy)
@@ -788,13 +788,43 @@
}
}
-// We don't translate accelerators for ALT + numpad digit, they are used for
-// entering special characters.
bool LocationBarView::ShouldLookupAccelerators(const views::KeyEvent& e) {
- if (!e.IsAltDown())
+ int c = e.GetCharacter();
+ // We don't translate accelerators for ALT + numpad digit, they are used for
+ // entering special characters.
+ if (e.IsAltDown() && win_util::IsNumPadDigit(c, e.IsExtendedKey()))
+ return false;
+
+ // Skip accelerators for key combinations omnibox wants to crack. This list
+ // should be synced with AutocompleteEditViewWin::OnKeyDownOnlyWritable().
+ //
+ // We cannot return false for all keys because we still need to handle some
+ // accelerators (e.g., F5 for reload the page should work even when the
+ // Omnibox gets focused).
+ switch (c) {
+ case VK_RETURN:
+ return false;
+
+ case VK_UP:
+ case VK_DOWN:
+ return e.IsAltDown();
+
+ case VK_DELETE:
+ case VK_INSERT:
+ return e.IsAltDown() || !e.IsShiftDown();
+
+ case 'X':
+ case 'V':
+ return e.IsAltDown() || !e.IsControlDown();
+
+ case VK_BACK:
+ case VK_TAB:
+ case 0xbb:
+ return false;
+
+ default:
return true;
-
- return !win_util::IsNumPadDigit(e.GetCharacter(), e.IsExtendedKey());
+ }
}
// ShowInfoBubbleTask-----------------------------------------------------------
« no previous file with comments | « chrome/browser/task_manager.cc ('k') | chrome/views/controls/tree/tree_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698