diff --git a/browser/native_window.cc b/browser/native_window.cc index c6f61a6e6b3b..b8651b4cb2f2 100644 --- a/browser/native_window.cc +++ b/browser/native_window.cc @@ -78,6 +78,14 @@ void NativeWindow::InitFromOptions(base::DictionaryValue* options) { Show(); } +void NativeWindow::ShowDevTools() { + inspectable_web_contents()->ShowDevTools(); +} + +void NativeWindow::CloseDevTools() { + // inspectable_web_contents()->CloseDevTools(); +} + content::WebContents* NativeWindow::GetWebContents() const { return inspectable_web_contents_->GetWebContents(); } diff --git a/browser/native_window.h b/browser/native_window.h index 3898383d681c..237e7cf37862 100644 --- a/browser/native_window.h +++ b/browser/native_window.h @@ -65,6 +65,8 @@ class NativeWindow { virtual void FlashFrame(bool flash) = 0; virtual void SetKiosk(bool kiosk) = 0; virtual bool IsKiosk() = 0; + virtual void ShowDevTools(); + virtual void CloseDevTools(); content::WebContents* GetWebContents() const; @@ -72,6 +74,10 @@ class NativeWindow { explicit NativeWindow(content::BrowserContext* browser_context, base::DictionaryValue* options); + brightray::InspectableWebContents* inspectable_web_contents() const { + return inspectable_web_contents_.get(); + } + private: scoped_ptr inspectable_web_contents_; diff --git a/browser/native_window_mac.h b/browser/native_window_mac.h index d243bd46bced..e5fbed18401b 100644 --- a/browser/native_window_mac.h +++ b/browser/native_window_mac.h @@ -44,8 +44,6 @@ class NativeWindowMac : public NativeWindow { virtual void SetKiosk(bool kiosk) OVERRIDE; virtual bool IsKiosk() OVERRIDE; - void set_is_fullscreen(bool fullscreen) { is_fullscreen_ = fullscreen; } - NSWindow* window() const { return window_; } protected: diff --git a/browser/native_window_mac.mm b/browser/native_window_mac.mm index 3f0acc6c8c18..3ae8811a6702 100644 --- a/browser/native_window_mac.mm +++ b/browser/native_window_mac.mm @@ -11,10 +11,31 @@ #include "base/mac/mac_util.h" #include "base/sys_string_conversions.h" #include "base/values.h" +#include "browser/atom_event_processing_window.h" #include "common/options_switches.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents_view.h" +@interface AtomNSWindow : AtomEventProcessingWindow { + @private + atom::NativeWindowMac* shell_; +} +- (void)setShell:(atom::NativeWindowMac*)shell; +- (IBAction)showDevTools:(id)sender; +@end + +@implementation AtomNSWindow + +- (void)setShell:(atom::NativeWindowMac*)shell { + shell_ = shell; +} + +- (IBAction)showDevTools:(id)sender { + shell_->ShowDevTools(); +} + +@end + namespace atom { NativeWindowMac::NativeWindowMac(content::BrowserContext* browser_context, @@ -36,10 +57,14 @@ NativeWindowMac::NativeWindowMac(content::BrowserContext* browser_context, NSUInteger style_mask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | NSTexturedBackgroundWindowMask; - window_ = [[NSWindow alloc] initWithContentRect:cocoa_bounds - styleMask:style_mask - backing:NSBackingStoreBuffered - defer:YES]; + AtomNSWindow* atom_window = [[AtomNSWindow alloc] + initWithContentRect:cocoa_bounds + styleMask:style_mask + backing:NSBackingStoreBuffered + defer:YES]; + [atom_window setShell:this]; + + window_ = atom_window; // Disable fullscreen button when 'fullscreen' is specified to false. bool fullscreen;