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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator_impl.h

Issue 2457653003: Completing refactor of startup_browser_creator_impl (Closed)
Patch Set: Created 4 years, 2 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/startup/startup_browser_creator_impl.h
diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.h b/chrome/browser/ui/startup/startup_browser_creator_impl.h
index 7cc98d360d1c914372b1b10d7b955511c1bb9ae2..ac5f34951f1031e273e837ad9687de94aee7d064 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.h
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.h
@@ -84,6 +84,12 @@ class StartupBrowserCreatorImpl {
FIRST_RUN_LAST_TAB, // Inject the welcome page as the last first-run tab.
};
+ enum class BrowserOpenBehavior {
+ NEW, // Open in a new browser.
+ SYNCHRONOUS_RESTORE, // Attempt a synchronous session restore.
+ USE_EXISTING // Attempt to add to an existing tabbed browser.
grt (UTC plus 2) 2016/10/28 09:22:12 nit: add a trailing comma
tmartino 2016/10/28 18:34:27 Done
+ };
+
// Creates a tab for each of the Tabs in |tabs|. If browser is non-null
// and a tabbed browser, the tabs are added to it. Otherwise a new tabbed
// browser is created and the tabs are added to it. The browser the tabs
@@ -122,6 +128,37 @@ class StartupBrowserCreatorImpl {
bool is_incognito,
bool is_post_crash_launch);
+ // Determines whether an asynchronous session restore is necessary; if so,
+ // kicks one off and returns true.
+ bool MaybeAsyncRestore(const StartupTabs& tabs,
+ bool process_startup,
+ bool is_post_crash_launch);
+
+ // Returns a browser displaying the contents of |tabs|. Based on |behavior|,
+ // this may attempt a session restore or create a new browser. May also allow
+ // DOM Storage to begin cleanup once it's clear it is not needed anymore.
+ Browser* RestoreOrCreateBrowser(const StartupTabs& tabs,
+ BrowserOpenBehavior behavior,
+ uint32_t restore_options,
+ bool process_startup,
+ bool is_post_crash_launch);
+
+ // Determines how the launch flow should obtain a Browser.
+ static BrowserOpenBehavior DetermineBrowserOpenBehavior(
+ const SessionStartupPref& pref,
+ bool process_startup,
+ bool is_post_crash_launch,
+ bool has_restore_switch,
+ bool has_new_window_switch,
+ bool has_cmd_line_tabs);
+
+ // Populates and returns the relevant bitmask options which must be passed
+ // when restoring a session.
+ static uint32_t DetermineSynchronousRestoreOptions(
+ bool has_create_browser_default,
+ bool has_create_browser_switch,
+ bool was_mac_login_or_resume);
+
// Adds a Tab to |tabs| for each url in |urls| that doesn't already exist
// in |tabs|.
void AddUniqueURLs(const std::vector<GURL>& urls, StartupTabs* tabs);

Powered by Google App Engine
This is Rietveld 408576698