diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 00142ada8cde..71fe65e0d8c6 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -544,13 +544,6 @@ void NativeWindow::BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) { *proceed_to_fire_unload = proceed; - - if (!proceed) { - WindowList::WindowCloseCancelled(this); - - // Cancel unresponsive event when window close is cancelled. - window_unresposive_closure_.Cancel(); - } } void NativeWindow::MoveContents(content::WebContents* source, @@ -594,6 +587,13 @@ void NativeWindow::BeforeUnloadFired(const base::TimeTicks& proceed_time) { // there are two virtual functions named BeforeUnloadFired. } +void NativeWindow::BeforeUnloadDialogCancelled() { + WindowList::WindowCloseCancelled(this); + + // Cancel unresponsive event when window close is cancelled. + window_unresposive_closure_.Cancel(); +} + void NativeWindow::TitleWasSet(content::NavigationEntry* entry, bool explicit_set) { bool prevent_default = false; diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 642eb0c904d7..4e6f9d113fb7 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -241,6 +241,7 @@ class NativeWindow : public CommonWebContentsDelegate, // Implementations of content::WebContentsObserver. void RenderViewCreated(content::RenderViewHost* render_view_host) override; void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; + void BeforeUnloadDialogCancelled() override; void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override; bool OnMessageReceived(const IPC::Message& message) override;