Handle close cancel in BeforeUnloadDialogCancelled

This commit is contained in:
Cheng Zhao 2015-06-24 21:28:36 +08:00
parent b822a83bc2
commit 87f44c42df
2 changed files with 8 additions and 7 deletions

View file

@ -544,13 +544,6 @@ void NativeWindow::BeforeUnloadFired(content::WebContents* tab,
bool proceed, bool proceed,
bool* proceed_to_fire_unload) { bool* proceed_to_fire_unload) {
*proceed_to_fire_unload = proceed; *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, 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. // 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, void NativeWindow::TitleWasSet(content::NavigationEntry* entry,
bool explicit_set) { bool explicit_set) {
bool prevent_default = false; bool prevent_default = false;

View file

@ -241,6 +241,7 @@ class NativeWindow : public CommonWebContentsDelegate,
// Implementations of content::WebContentsObserver. // Implementations of content::WebContentsObserver.
void RenderViewCreated(content::RenderViewHost* render_view_host) override; void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void BeforeUnloadFired(const base::TimeTicks& proceed_time) override; void BeforeUnloadFired(const base::TimeTicks& proceed_time) override;
void BeforeUnloadDialogCancelled() override;
void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override; void TitleWasSet(content::NavigationEntry* entry, bool explicit_set) override;
bool OnMessageReceived(const IPC::Message& message) override; bool OnMessageReceived(const IPC::Message& message) override;