]> khamidou — GitHub mirrors - electron.git/commitdiff
use AtomEventProcessingWindow as native window.
authorCheng Zhao <zcbenz@gmail.com>
Fri, 12 Apr 2013 07:53:29 +0000 (15:53 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Fri, 12 Apr 2013 07:53:29 +0000 (15:53 +0800)
browser/native_window.cc
browser/native_window.h
browser/native_window_mac.h
browser/native_window_mac.mm

index c6f61a6e6b3b80e1e07902b5538dcbe1b4a84ad7..b8651b4cb2f2e6db85dd4011b73709fe9d66298b 100644 (file)
@@ -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();
 }
index 3898383d681c19d4674bb573c68c44cc21fa9272..237e7cf37862168557856090dd057a64d554a49d 100644 (file)
@@ -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<brightray::InspectableWebContents> inspectable_web_contents_;
 
index d243bd46bced559945c4d0e102bdb060c9b24845..e5fbed18401b6cf084b7d9ff5f37602a36231576 100644 (file)
@@ -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:
index 3f0acc6c8c185f8ce27b2ddfb8d0d1d8197a7804..3ae8811a6702707d2eedf14f259b2422f261234b 100644 (file)
 #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;