diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 23:42:11 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-28 23:42:11 +0000 |
commit | 7c687b4d471e4f0847c3d720a66270df845e4f5f (patch) | |
tree | ef0be272df49aa165a8da5f7a5c966068b3a0dba | |
parent | d5ce9f68f2cac24a08e62afd245357ff636a66d1 (diff) | |
download | chromium_src-7c687b4d471e4f0847c3d720a66270df845e4f5f.zip chromium_src-7c687b4d471e4f0847c3d720a66270df845e4f5f.tar.gz chromium_src-7c687b4d471e4f0847c3d720a66270df845e4f5f.tar.bz2 |
IE and Firefox always translate (alt+numpad 7) as an accelerator. We should too.
BUG=5372
TEST=Navigate somewhere, focus the omnibox, and hit alt+numpad 7. You should navigate to your home page (by default, the new tab page).
Review URL: http://codereview.chromium.org/113971
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17134 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/views/location_bar_view.cc | 37 | ||||
-rw-r--r-- | views/controls/textfield/textfield.cc | 9 |
2 files changed, 24 insertions, 22 deletions
diff --git a/chrome/browser/views/location_bar_view.cc b/chrome/browser/views/location_bar_view.cc index b2a6428..c4a82dc 100644 --- a/chrome/browser/views/location_bar_view.cc +++ b/chrome/browser/views/location_bar_view.cc @@ -891,8 +891,9 @@ bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { #if defined(OS_WIN) int c = e.GetCharacter(); // We don't process ALT + numpad digit as accelerators, they are used for - // entering special characters. - if (e.IsAltDown() && win_util::IsNumPadDigit(c, e.IsExtendedKey())) + // entering special characters. We do translate alt-home. + if (e.IsAltDown() && (c != VK_HOME) && + win_util::IsNumPadDigit(c, e.IsExtendedKey())) return true; // Skip accelerators for key combinations omnibox wants to crack. This list @@ -903,27 +904,27 @@ bool LocationBarView::SkipDefaultKeyEventProcessing(const views::KeyEvent& e) { // accelerators (e.g., F5 for reload the page should work even when the // Omnibox gets focused). switch (c) { - case VK_RETURN: - return true; + case VK_RETURN: + return true; - case VK_UP: - case VK_DOWN: - return !e.IsAltDown(); + case VK_UP: + case VK_DOWN: + return !e.IsAltDown(); - case VK_DELETE: - case VK_INSERT: - return !e.IsAltDown() && e.IsShiftDown() && !e.IsControlDown(); + case VK_DELETE: + case VK_INSERT: + return !e.IsAltDown() && e.IsShiftDown() && !e.IsControlDown(); - case 'X': - case 'V': - return !e.IsAltDown() && e.IsControlDown(); + case 'X': + case 'V': + return !e.IsAltDown() && e.IsControlDown(); - case VK_BACK: - case 0xbb: - return true; + case VK_BACK: + case 0xbb: + return true; - default: - return false; + default: + return false; } #else NOTIMPLEMENTED(); diff --git a/views/controls/textfield/textfield.cc b/views/controls/textfield/textfield.cc index 68afc91..79237f8 100644 --- a/views/controls/textfield/textfield.cc +++ b/views/controls/textfield/textfield.cc @@ -197,13 +197,14 @@ bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) { #if defined(OS_WIN) // TODO(hamaji): Figure out which keyboard combinations we need to add here, // similar to LocationBarView::SkipDefaultKeyEventProcessing. - if (e.GetCharacter() == VK_BACK) + const int c = e.GetCharacter(); + if (c == VK_BACK) return true; // We'll handle BackSpace ourselves. // We don't translate accelerators for ALT + NumPad digit, they are used for - // entering special characters. - if (e.IsAltDown() && - win_util::IsNumPadDigit(e.GetCharacter(), e.IsExtendedKey())) + // entering special characters. We do translate alt-home. + if (e.IsAltDown() && (c != VK_HOME) && + win_util::IsNumPadDigit(c, e.IsExtendedKey())) return true; #endif return false; |