From 87f44c42df4c497f60e264025173875d153344e9 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Wed, 24 Jun 2015 21:28:36 +0800 Subject: [PATCH] Handle close cancel in BeforeUnloadDialogCancelled --- atom/browser/native_window.cc | 14 +++++++------- atom/browser/native_window.h | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 00142ada..71fe65e0 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 642eb0c9..4e6f9d11 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; -- 2.43.0