diff options
Diffstat (limited to 'chrome/browser/views/frame/browser_view.cc')
-rw-r--r-- | chrome/browser/views/frame/browser_view.cc | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 197ac7c..b03129e 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -421,7 +421,6 @@ BrowserView::BrowserView(Browser* browser) #if defined(OS_WIN) hung_window_detector_(&hung_plugin_action_), ticker_(0), - ignore_next_char_event_(false), #endif extension_shelf_(NULL), last_focused_view_storage_id_( @@ -1234,58 +1233,8 @@ bool BrowserView::PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event, } void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) { -#if defined(OS_WIN) - // Previous calls to TranslateMessage can generate Char events as well as - // RawKeyDown events, even if the latter triggered an accelerator. In these - // cases, we discard the Char events. - if (event.type == WebKit::WebInputEvent::Char && ignore_next_char_event_) { - ignore_next_char_event_ = false; - return; - } - // It's necessary to reset this flag, because a RawKeyDown event may not - // always generate a Char event. - ignore_next_char_event_ = false; -#endif - - if (event.type == WebKit::WebInputEvent::RawKeyDown) { - views::FocusManager* focus_manager = GetFocusManager(); - DCHECK(focus_manager); - - views::Accelerator accelerator( - static_cast<base::KeyboardCode>(event.windowsKeyCode), - (event.modifiers & NativeWebKeyboardEvent::ShiftKey) == - NativeWebKeyboardEvent::ShiftKey, - (event.modifiers & NativeWebKeyboardEvent::ControlKey) == - NativeWebKeyboardEvent::ControlKey, - (event.modifiers & NativeWebKeyboardEvent::AltKey) == - NativeWebKeyboardEvent::AltKey); - -#if defined(OS_WIN) - // This is tricky: we want to set ignore_next_char_event_ if - // ProcessAccelerator returns true. But ProcessAccelerator might delete - // |this| if the accelerator is a "close tab" one. So we speculatively - // set the flag and fix it if no event was handled. - ignore_next_char_event_ = true; -#endif - - if (focus_manager->ProcessAccelerator(accelerator)) { - // DANGER: |this| could be deleted now! - return; - } - -#if defined(OS_WIN) - // ProcessAccelerator didn't handle the accelerator, so we know both - // that |this| is still valid, and that we didn't want to set the flag. - ignore_next_char_event_ = false; -#endif - } - -#if defined(OS_WIN) - // Any unhandled keyboard/character messages should be defproced. - // This allows stuff like F10, etc to work correctly. - DefWindowProc(event.os_event.hwnd, event.os_event.message, - event.os_event.wParam, event.os_event.lParam); -#endif + unhandled_keyboard_event_handler_.HandleKeyboardEvent(event, + GetFocusManager()); } #if defined(TOOLKIT_VIEWS) |