diff options
-rw-r--r-- | chrome/browser/views/find_bar_host.cc | 5 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_host.h | 11 | ||||
-rwxr-xr-x | chrome/browser/views/find_bar_host_gtk.cc | 5 | ||||
-rwxr-xr-x | chrome/browser/views/find_bar_host_win.cc | 6 |
4 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/views/find_bar_host.cc b/chrome/browser/views/find_bar_host.cc index 2c25dd1..d81d6c1 100644 --- a/chrome/browser/views/find_bar_host.cc +++ b/chrome/browser/views/find_bar_host.cc @@ -355,6 +355,11 @@ void FindBarHost::UnregisterEscAccelerator() { bool FindBarHost::MaybeForwardKeystrokeToWebpage( const views::Textfield::Keystroke& key_stroke) { + if (!ShouldForwardKeystrokeToWebpageNative(key_stroke)) { + // Native implementation says not to forward these events. + return false; + } + switch (key_stroke.GetKeyboardCode()) { case base::VKEY_DOWN: case base::VKEY_UP: diff --git a/chrome/browser/views/find_bar_host.h b/chrome/browser/views/find_bar_host.h index 97f1ded..6c77776 100644 --- a/chrome/browser/views/find_bar_host.h +++ b/chrome/browser/views/find_bar_host.h @@ -44,10 +44,10 @@ class View; // //////////////////////////////////////////////////////////////////////////////// class FindBarHost : public views::AcceleratorTarget, - public views::FocusChangeListener, - public AnimationDelegate, - public FindBar, - public FindBarTesting { + public views::FocusChangeListener, + public AnimationDelegate, + public FindBar, + public FindBarTesting { public: explicit FindBarHost(BrowserView* browser_view); virtual ~FindBarHost(); @@ -155,6 +155,9 @@ class FindBarHost : public views::AcceleratorTarget, NativeWebKeyboardEvent GetKeyboardEvent( const TabContents* contents, const views::Textfield::Keystroke& key_stroke); + // Allows native implementation to prevent keystrokes from being forwarded. + bool ShouldForwardKeystrokeToWebpageNative( + const views::Textfield::Keystroke& key_stroke); // The BrowserView that created us. BrowserView* browser_view_; diff --git a/chrome/browser/views/find_bar_host_gtk.cc b/chrome/browser/views/find_bar_host_gtk.cc index 6a0989d..2a08e32 100755 --- a/chrome/browser/views/find_bar_host_gtk.cc +++ b/chrome/browser/views/find_bar_host_gtk.cc @@ -71,3 +71,8 @@ NativeWebKeyboardEvent FindBarHost::GetKeyboardEvent( return NativeWebKeyboardEvent(key_stroke.event()); } +bool FindBarHost::ShouldForwardKeystrokeToWebpageNative( + const views::Textfield::Keystroke& key_stroke) { + return true; +} + diff --git a/chrome/browser/views/find_bar_host_win.cc b/chrome/browser/views/find_bar_host_win.cc index 74577b4..dc93e34 100755 --- a/chrome/browser/views/find_bar_host_win.cc +++ b/chrome/browser/views/find_bar_host_win.cc @@ -189,3 +189,9 @@ gfx::NativeView FindBarHost::GetNativeView(BrowserView* browser_view) { return browser_view->GetWidget()->GetNativeView(); } +bool FindBarHost::ShouldForwardKeystrokeToWebpageNative( + const views::Textfield::Keystroke& key_stroke) { + // We specifically ignore WM_CHAR. See http://crbug.com/10509. + return key_stroke.message() == WM_KEYDOWN || key_stroke.message() == WM_KEYUP; +} + |