Merge pull request #5701 from danhp/propagate-close

Properly notify observers when window prevents close
This commit is contained in:
Cheng Zhao 2016-05-26 05:33:55 +00:00
commit 20b09e9d03
2 changed files with 12 additions and 0 deletions

View file

@ -6,6 +6,7 @@
#include <string>
#include "atom/browser/window_list.h"
#include "atom/common/color_util.h"
#include "atom/common/draggable_region.h"
#include "atom/common/options_switches.h"
@ -553,6 +554,11 @@ NativeWindowMac::~NativeWindowMac() {
}
void NativeWindowMac::Close() {
if (!IsClosable()) {
WindowList::WindowCloseCancelled(this);
return;
}
[window_ performClose:nil];
}

View file

@ -9,6 +9,7 @@
#include "atom/browser/ui/views/menu_bar.h"
#include "atom/browser/ui/views/menu_layout.h"
#include "atom/browser/window_list.h"
#include "atom/common/color_util.h"
#include "atom/common/draggable_region.h"
#include "atom/common/native_mate_converters/image_converter.h"
@ -284,6 +285,11 @@ NativeWindowViews::~NativeWindowViews() {
}
void NativeWindowViews::Close() {
if (!IsClosable()) {
WindowList::WindowCloseCancelled(this);
return;
}
window_->Close();
}