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

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

Issue 2164033002: Refactoring startup logic for upcoming FRE changes (non-Win 10). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Using new welcome page URL 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 2f5652c5af5d86d4fb80a9feb4801ac1431048cb..3fbdae0ced68515b5c6bd67ce2913bb97695cb02 100644
--- a/chrome/browser/ui/startup/startup_browser_creator_impl.h
+++ b/chrome/browser/ui/startup/startup_browser_creator_impl.h
@@ -12,6 +12,7 @@
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "chrome/browser/ui/startup/startup_tab.h"
+#include "chrome/browser/ui/startup/startup_tab_provider.h"
#include "chrome/browser/ui/startup/startup_types.h"
#include "url/gurl.h"
@@ -67,6 +68,15 @@ class StartupBrowserCreatorImpl {
private:
FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs);
FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest, DetermineStartupTabs);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest,
+ DetermineStartupTabs_IncognitoOrCrash);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest,
+ DetermineStartupTabs_MasterPrefs);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest,
+ DetermineStartupTabs_CommandLine);
+ FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest,
+ DetermineStartupTabs_NewTabPage);
enum class WelcomeRunType {
NONE, // Do not inject the welcome page for this run.
@@ -97,14 +107,20 @@ class StartupBrowserCreatorImpl {
// should open in a tab, do so.
bool OpenApplicationTab(Profile* profile);
- // Invoked from Launch to handle processing of urls. This may do any of the
- // following:
- // . Invoke ProcessStartupURLs if |process_startup| is true.
- // . If |process_startup| is false, restore the last session if necessary,
- // or invoke ProcessSpecifiedURLs.
- // . Open the urls directly.
- void ProcessLaunchURLs(bool process_startup,
- const std::vector<GURL>& urls_to_open);
+ // Determines the URLs to be shown at startup by way of various policies
+ // (onboarding, pinned tabs, etc.), determines whether a session restore
+ // is necessary, and opens the URLs in a new or restored browser accordingly.
+ void ProcessLaunchUrlsUsingConsolidatedFlow(
Peter Kasting 2016/10/06 05:49:08 Nit: Make sure before you land that .cc order matc
+ bool process_startup,
+ const std::vector<GURL>& cmd_line_urls);
+
+ // Returns the tabs to be shown on startup, based on the policy functions in
+ // the given StartupTabProvider, the given tabs passed by the command line,
+ // and the interactions between those policies.
+ StartupTabs DetermineStartupTabs(const StartupTabProvider& provider,
+ const StartupTabs& cmd_line_tabs,
+ bool is_incognito,
+ bool is_post_crash_launch);
// Does the following:
// . If the user's startup pref is to restore the last session (or the
@@ -115,6 +131,32 @@ class StartupBrowserCreatorImpl {
// the caller must create a new browser.
bool ProcessStartupURLs(const std::vector<GURL>& urls_to_open);
+ // 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);
+
+ // Adds any startup infobars to the selected tab of the given browser.
+ void AddInfoBarsIfNecessary(
+ Browser* browser,
+ chrome::startup::IsProcessStartup is_process_startup);
+
+ // Record Rappor metrics on startup URLs.
Peter Kasting 2016/10/06 05:49:08 Nit: Records
+ void RecordRapporOnStartupURLs(const std::vector<GURL>& urls_to_open);
+
+ // TODO(crbug.com/651465): The following functions are deprecated. They will
+ // be removed once kUseConsolidatedStartupFlow is enabled by default.
+
+ // Invoked from Launch to handle processing of urls. This may do any of the
+ // following:
+ // . Invoke ProcessStartupURLs if |process_startup| is true.
+ // . If |process_startup| is false, restore the last session if necessary,
+ // or invoke ProcessSpecifiedURLs.
+ // . Open the urls directly.
+ // Under the kUseConsolidatedStartupFlow feature, this is replaced by
+ // ProcessLaunchUrlsUsingConsolidatedFlow().
+ void ProcessLaunchURLs(bool process_startup,
+ const std::vector<GURL>& urls_to_open);
+
// Invoked from either ProcessLaunchURLs or ProcessStartupURLs to handle
// processing of URLs where the behavior is common between process startup
// and launch via an existing process (i.e. those explicitly specified by
@@ -128,15 +170,6 @@ class StartupBrowserCreatorImpl {
// Otherwise null is returned and the caller must create a new browser.
Browser* ProcessSpecifiedURLs(const std::vector<GURL>& urls_to_open);
- // 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);
-
- // Adds any startup infobars to the selected tab of the given browser.
- void AddInfoBarsIfNecessary(
- Browser* browser,
- chrome::startup::IsProcessStartup is_process_startup);
-
// Adds additional startup URLs to the specified vector.
void AddStartupURLs(std::vector<GURL>* startup_urls) const;
@@ -149,9 +182,6 @@ class StartupBrowserCreatorImpl {
// suppress injecting the welcome page for future launches.
void InitializeWelcomeRunType(const std::vector<GURL>& urls_to_open);
- // Record Rappor metrics on startup URLs.
- void RecordRapporOnStartupURLs(const std::vector<GURL>& urls_to_open);
-
// Checks whether |profile_| has a reset trigger set.
bool ProfileHasResetTrigger() const;

Powered by Google App Engine
This is Rietveld 408576698