#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"
base::DictionaryValue* options)
: inspectable_web_contents_(brightray::InspectableWebContents::Create(
content::WebContents::CreateParams(browser_context))) {
- GetWebContents()->SetDelegate(new brightray::DefaultWebContentsDelegate());
+ GetWebContents()->SetDelegate(this);
}
NativeWindow::~NativeWindow() {
#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;
namespace atom {
-class NativeWindow {
+class NativeWindow : public content::WebContentsDelegate {
public:
virtual ~NativeWindow();
protected:
void SetNonLionFullscreen(bool fullscreen);
+ // Implementations of content::WebContentsDelegate.
+ virtual void HandleKeyboardEvent(
+ content::WebContents*,
+ const content::NativeWebKeyboardEvent&) OVERRIDE;
+
private:
void InstallView();
void UninstallView();
#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"
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<AtomEventProcessingWindow*>(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];