mirror of
https://github.com/electron/electron.git
synced 2026-01-25 23:38:18 -05:00
Merge pull request #5701 from danhp/propagate-close
Properly notify observers when window prevents close
This commit is contained in:
@@ -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];
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user