Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Unified Diff: chrome/browser/ui/unload_controller.cc

Issue 471763008: Nicely handle OnBeforeUnloads with guest and lock mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Callback before close browsers Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser_list.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/unload_controller.cc
diff --git a/chrome/browser/ui/unload_controller.cc b/chrome/browser/ui/unload_controller.cc
index fab4eb76d245679c9559e4763ceeb6c1f03b3ca6..8791f7056ebab71a2aa608d4d66f070b0be60a79 100644
--- a/chrome/browser/ui/unload_controller.cc
+++ b/chrome/browser/ui/unload_controller.cc
@@ -300,7 +300,13 @@ void UnloadController::ProcessPendingTabs() {
ClearUnloadState(web_contents, true);
}
} else if (is_calling_before_unload_handlers()) {
- on_close_confirmed_.Run(true);
+ base::Callback<void(bool)> on_close_confirmed = on_close_confirmed_;
+ // Reset |on_close_confirmed_| in case the callback tests
+ // |is_calling_before_unload_handlers()|, we want to return that calling
+ // is complete.
+ if (tabs_needing_unload_fired_.empty())
+ on_close_confirmed_.Reset();
+ on_close_confirmed.Run(true);
} else if (!tabs_needing_unload_fired_.empty()) {
// We've finished firing all beforeunload events and can proceed with unload
// events.
« no previous file with comments | « chrome/browser/ui/browser_list.cc ('k') | chrome/browser/ui/views/profiles/profile_chooser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698