diff --git a/browser/native_window.cc b/browser/native_window.cc index d911e827634c..49d77f7d9138 100644 --- a/browser/native_window.cc +++ b/browser/native_window.cc @@ -8,7 +8,6 @@ #include "base/values.h" #include "brightray/browser/browser_context.h" -#include "brightray/browser/default_web_contents_delegate.h" #include "brightray/browser/inspectable_web_contents.h" #include "brightray/browser/inspectable_web_contents_view.h" #include "common/options_switches.h" @@ -22,7 +21,7 @@ NativeWindow::NativeWindow(content::BrowserContext* browser_context, base::DictionaryValue* options) : inspectable_web_contents_(brightray::InspectableWebContents::Create( content::WebContents::CreateParams(browser_context))) { - GetWebContents()->SetDelegate(new brightray::DefaultWebContentsDelegate()); + GetWebContents()->SetDelegate(this); } NativeWindow::~NativeWindow() { diff --git a/browser/native_window.h b/browser/native_window.h index 237e7cf37862..11a4443c4faf 100644 --- a/browser/native_window.h +++ b/browser/native_window.h @@ -10,6 +10,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "content/public/browser/web_contents_delegate.h" namespace base { class DictionaryValue; @@ -32,7 +33,7 @@ class Size; namespace atom { -class NativeWindow { +class NativeWindow : public content::WebContentsDelegate { public: virtual ~NativeWindow(); diff --git a/browser/native_window_mac.h b/browser/native_window_mac.h index e5fbed18401b..a10f5c74ce68 100644 --- a/browser/native_window_mac.h +++ b/browser/native_window_mac.h @@ -49,6 +49,11 @@ class NativeWindowMac : public NativeWindow { protected: void SetNonLionFullscreen(bool fullscreen); + // Implementations of content::WebContentsDelegate. + virtual void HandleKeyboardEvent( + content::WebContents*, + const content::NativeWebKeyboardEvent&) OVERRIDE; + private: void InstallView(); void UninstallView(); diff --git a/browser/native_window_mac.mm b/browser/native_window_mac.mm index ddf43e93f88c..a9fce7c2ed4e 100644 --- a/browser/native_window_mac.mm +++ b/browser/native_window_mac.mm @@ -11,10 +11,11 @@ #include "base/mac/mac_util.h" #include "base/sys_string_conversions.h" #include "base/values.h" -#include "browser/atom_event_processing_window.h" +#import "browser/atom_event_processing_window.h" #include "brightray/browser/inspectable_web_contents.h" #include "brightray/browser/inspectable_web_contents_view.h" #include "common/options_switches.h" +#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" @@ -293,6 +294,19 @@ bool NativeWindowMac::IsKiosk() { return is_kiosk_; } +void NativeWindowMac::HandleKeyboardEvent( + content::WebContents*, + const content::NativeWebKeyboardEvent& event) { + if (event.skip_in_browser || + event.type == content::NativeWebKeyboardEvent::Char) + return; + + AtomEventProcessingWindow* event_window = + static_cast(window()); + DCHECK([event_window isKindOfClass:[AtomEventProcessingWindow class]]); + [event_window redispatchKeyEvent:event.os_event]; +} + void NativeWindowMac::InstallView() { NSView* view = inspectable_web_contents()->GetView()->GetNativeView(); [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; diff --git a/vendor/brightray b/vendor/brightray index 57770d517efe..5a1c81d204ef 160000 --- a/vendor/brightray +++ b/vendor/brightray @@ -1 +1 @@ -Subproject commit 57770d517efe09b0b74e891f5baed0cbb2cad2c1 +Subproject commit 5a1c81d204ef308cb747ad3b2e4535f6dd456704