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

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

Issue 471763008: Nicely handle OnBeforeUnloads with guest and lock mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: working browser closing and lock included Created 6 years, 4 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/browser_list.h
diff --git a/chrome/browser/ui/browser_list.h b/chrome/browser/ui/browser_list.h
index 11a736b12959f7a1b4b6eedae32f8ab215492767..9094f1562a5633ecbd389ad1a67bbcc327842335 100644
--- a/chrome/browser/ui/browser_list.h
+++ b/chrome/browser/ui/browser_list.h
@@ -74,6 +74,13 @@ class BrowserList {
// Closes all browsers for |profile| across all desktops.
static void CloseAllBrowsersWithProfile(Profile* profile);
+ // Closes all browsers for |profile| across all desktops. If an OnBeforeUnload
noms (inactive) 2014/08/26 20:17:32 nit: maybe add "event"?
Mike Lerman 2014/08/27 14:11:39 Done.
+ // causes any browser to not be closed, |on_close_aborted| is called.
+ // Otherwise, |on_close_success| is called.
+ static void CloseAllBrowsersWithProfile(Profile* profile,
Peter Kasting 2014/08/26 20:26:15 Nit: Align all args. (Several places)
Mike Lerman 2014/08/27 14:11:39 Done (several places).
+ const base::Callback<void(size_t)>& on_close_success,
+ const base::Callback<void(size_t)>& on_close_aborted);
+
// Returns true if at least one incognito session is active across all
// desktops.
static bool IsOffTheRecordSessionActive();
@@ -82,6 +89,9 @@ class BrowserList {
// across all desktops.
static bool IsOffTheRecordSessionActiveForProfile(Profile* profile);
+ // Null operation method for use with CloseAllBrowsersWithProfile.
+ static void DoNothing(size_t var) {}
noms (inactive) 2014/08/26 20:17:32 Hmm, I'm not super keen on this going in the publi
Peter Kasting 2014/08/26 20:26:15 Yeah, don't define something like this in the clas
Mike Lerman 2014/08/27 14:11:38 I'll remove the on_close_aborted parameter of Clos
+
private:
BrowserList();
~BrowserList();
@@ -89,6 +99,20 @@ class BrowserList {
// Helper method to remove a browser instance from a list of browsers
static void RemoveBrowserFrom(Browser* browser, BrowserVector* browser_list);
+ // Attempts to close |browser_to_close| while respecting OnBeforeUnloads.
noms (inactive) 2014/08/26 20:17:32 nit: OnBeforeUnload events?
Mike Lerman 2014/08/27 14:11:38 Done.
+ static void TryToCloseBrowserList(const BrowserVector& browsers_to_close,
+ const base::Callback<void(size_t)>& on_close_confirmed,
+ const base::Callback<void(size_t)>& on_close_aborted,
+ const size_t profile_index);
+
+ // Called after handling an OnBeforeUnload. Will either try to close more
noms (inactive) 2014/08/26 20:17:32 nit: an OnBeforeUnload event?
Mike Lerman 2014/08/27 14:11:39 Done.
+ // browsers or will call |on_close_aborted|.
+ static void PostBeforeUnloadHandlers(const BrowserVector& browsers_to_close,
+ const base::Callback<void(size_t)>& on_close_confirmed,
+ const base::Callback<void(size_t)>& on_close_aborted,
+ const size_t profile_index,
+ bool proceed);
noms (inactive) 2014/08/26 20:17:32 Please document all parameters
Mike Lerman 2014/08/27 14:11:38 Done.
+
// A vector of the browsers in this list, in the order they were added.
BrowserVector browsers_;
// A vector of the browsers in this list that have been activated, in the

Powered by Google App Engine
This is Rietveld 408576698