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..aaf9c604968aa164f9f45c681de4cb594336f4ba 100644 |
--- a/chrome/browser/ui/browser_list.h |
+++ b/chrome/browser/ui/browser_list.h |
@@ -19,6 +19,10 @@ namespace chrome { |
class BrowserListObserver; |
} |
+namespace base { |
+class FilePath; |
noms (inactive)
2014/09/03 14:25:08
nit: I these should be sorted alphabetically by na
Mike Lerman
2014/09/03 15:28:34
Done.
|
+} |
+ |
// Maintains a list of Browser objects present in a given HostDesktop (see |
// HostDesktopType). |
class BrowserList { |
@@ -72,8 +76,18 @@ class BrowserList { |
static void SetLastActive(Browser* browser); |
// Closes all browsers for |profile| across all desktops. |
+ // TODO(mlerman): Move the Profile Deletion flow to use the overloaded |
+ // version of this method with a callback, then remove this method. |
static void CloseAllBrowsersWithProfile(Profile* profile); |
+ // Closes all browsers for |profile| across all desktops. Uses |
+ // TryToCloseBrowserList() to do the actual closing and trigger any |
+ // OnBeforeUnload events. If all OnBeforeUnload events are confirmed, |
+ // |on_close_success| is called. |
+ static void CloseAllBrowsersWithProfile( |
+ Profile* profile, |
+ const base::Callback<void(const base::FilePath&)>& on_close_success); |
+ |
// Returns true if at least one incognito session is active across all |
// desktops. |
static bool IsOffTheRecordSessionActive(); |
@@ -89,6 +103,27 @@ 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 |browsers_to_close| while respecting OnBeforeUnload |
+ // events. If there are no OnBeforeUnload events to be called, |
+ // |on_close_confirmed| will be called, with a parameter of |profile_path|. |
+ // If at least one unfired OnBeforeUnload event is found, handle it with a |
+ // callback to PostBeforeUnloadHandlers, which upon success will recursively |
+ // call this method to handle any other OnBeforeUnload events. |
+ static void TryToCloseBrowserList( |
+ const BrowserVector& browsers_to_close, |
+ const base::Callback<void(const base::FilePath&)>& on_close_success, |
+ const base::FilePath& profile_path); |
+ |
+ // Called after handling an OnBeforeUnload event. If |tab_close_confirmed| is |
+ // true, calls |TryToCloseBrowserList()|, passing the parameters |
+ // |browsers_to_close|, |on_close_confirmed|, and |profile_path|. Otherwise, |
+ // resets all the OnBeforeUnload event handlers. |
+ static void PostBeforeUnloadHandlers( |
+ const BrowserVector& browsers_to_close, |
+ const base::Callback<void(const base::FilePath&)>& on_close_success, |
+ const base::FilePath& profile_path, |
+ bool tab_close_confirmed); |
+ |
// 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 |