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

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

Issue 2681203002: Add Browser::SkipCallBeforeUnload so that the browser windows can be closed regardless of beforeunl… (Closed)
Patch Set: refactor Created 3 years, 10 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
Index: chrome/browser/ui/unload_controller.h
diff --git a/chrome/browser/ui/unload_controller.h b/chrome/browser/ui/unload_controller.h
index e8f22e862c43370856531805457957e653d5681b..ea9c5b60c7a52fe261aa3d8ec8097c8b5533f95e 100644
--- a/chrome/browser/ui/unload_controller.h
+++ b/chrome/browser/ui/unload_controller.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
#define CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_
+#include <memory>
#include <set>
#include "base/callback.h"
@@ -16,6 +17,7 @@
class Browser;
class TabStripModel;
+class UnloadControllerWebContentsDelegate;
namespace content {
class NotificationSource;
@@ -62,13 +64,14 @@ class UnloadController : public content::NotificationObserver,
bool ShouldCloseWindow();
// Begins the process of confirming whether the associated browser can be
- // closed.
- bool CallBeforeUnloadHandlers(
- const base::Callback<void(bool)>& on_close_confirmed);
+ // closed. Beforeunload events won't be fired if |skip_before_unload_event|
+ // is true.
+ bool TryToCloseWindow(bool skip_before_unload_event,
+ const base::Callback<void(bool)>& on_close_confirmed);
// Clears the results of any beforeunload confirmation dialogs triggered by a
- // CallBeforeUnloadHandlers call.
- void ResetBeforeUnloadHandlers();
+ // TryToCloseWindow call.
+ void ResetCloseWindow();
// Returns true if |browser_| has any tabs that have BeforeUnload handlers
// that have not been fired. This method is non-const because it builds a list
@@ -107,7 +110,7 @@ class UnloadController : public content::NotificationObserver,
void TabDetachedImpl(content::WebContents* contents);
// Processes the next tab that needs it's beforeunload/unload event fired.
- void ProcessPendingTabs();
+ void ProcessPendingTabs(bool skip_before_unload_event);
// Whether we've completed firing all the tabs' beforeunload/unload events.
bool HasCompletedUnloadProcessing() const;
@@ -155,6 +158,10 @@ class UnloadController : public content::NotificationObserver,
// are currently confirming that the browser is closable.
base::Callback<void(bool)> on_close_confirmed_;
+ // Manage tabs with beforeunload/unload handlers when beforeunload events are
+ // bypassed.
+ std::unique_ptr<UnloadControllerWebContentsDelegate> web_contents_delegate_;
+
base::WeakPtrFactory<UnloadController> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(UnloadController);

Powered by Google App Engine
This is Rietveld 408576698