]> khamidou — GitHub mirrors - electron.git/commitdiff
Should send "closed" event when native window is closed.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 23 Apr 2014 02:24:46 +0000 (10:24 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 23 Apr 2014 02:24:46 +0000 (10:24 +0800)
atom/browser/native_window.h
atom/browser/native_window_gtk.cc
atom/browser/native_window_mac.h
atom/browser/native_window_mac.mm
atom/browser/native_window_win.cc

index 405fe527a0209dab4c2810f987a428f436ccd573..f10e509e4e92ab50b24dd403ecd235b88c07addd 100644 (file)
@@ -173,6 +173,11 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
                                       int child_process_id);
   void OverrideWebkitPrefs(const GURL& url, WebPreferences* prefs);
 
+  // Public API used by platform-dependent delegates and observers to send UI
+  // related notifications.
+  void NotifyWindowClosed();
+  void NotifyWindowBlur();
+
   void AddObserver(NativeWindowObserver* obs) {
     observers_.AddObserver(obs);
   }
@@ -196,9 +201,6 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
         inspectable_web_contents_.get());
   }
 
-  void NotifyWindowClosed();
-  void NotifyWindowBlur();
-
   // Called when the window needs to update its draggable region.
   virtual void UpdateDraggableRegions(
       const std::vector<DraggableRegion>& regions) = 0;
index 0b69b26e9d5d72a49add0a999aa2d981f2d3342f..f50fad7c74bdf70d71b94187d76fdc0bc854b6fe 100644 (file)
@@ -132,6 +132,7 @@ void NativeWindowGtk::Close() {
 }
 
 void NativeWindowGtk::CloseImmediately() {
+  NotifyWindowClosed();
   gtk_widget_destroy(GTK_WIDGET(window_));
   window_ = NULL;
 }
index 1a8efc9f2ed74500e3fe3e2f49ec4f2836b8372b..fdc1681356307fc7654b86656d761078a44ec654 100644 (file)
@@ -57,8 +57,6 @@ class NativeWindowMac : public NativeWindow {
   virtual bool HasModalDialog() OVERRIDE;
   virtual gfx::NativeWindow GetNativeWindow() OVERRIDE;
 
-  void NotifyWindowBlur() { NativeWindow::NotifyWindowBlur(); }
-
   // Returns true if |point| in local Cocoa coordinate system falls within
   // the draggable region.
   bool IsWithinDraggableRegion(NSPoint point) const;
index 673da67c349567402365d545c149f6e14b122f50..1162f0b0904cf93c00678ea2645b1223ff1434fc 100644 (file)
@@ -65,6 +65,7 @@ static const CGFloat kAtomWindowCornerRadius = 4.0;
 }
 
 - (void)windowWillClose:(NSNotification*)notification {
+  shell_->NotifyWindowClosed();
   [self autorelease];
 }
 
index 886ba8d128172789b13285177d4b977469688eea..fcbbc25a5bd674faa2777c5f1ba1dc098f1cbd53 100644 (file)
@@ -438,7 +438,7 @@ bool NativeWindowWin::AcceleratorPressed(
 }
 
 void NativeWindowWin::DeleteDelegate() {
-  // Do nothing, window is managed by users.
+  NotifyWindowClosed();
 }
 
 views::View* NativeWindowWin::GetInitiallyFocusedView() {