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

Side by Side 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: Adding missing constructor Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_
6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/gtest_prod_util.h" 12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "chrome/browser/ui/startup/startup_tab.h" 14 #include "chrome/browser/ui/startup/startup_tab.h"
15 #include "chrome/browser/ui/startup/startup_tab_provider.h"
15 #include "chrome/browser/ui/startup/startup_types.h" 16 #include "chrome/browser/ui/startup/startup_types.h"
16 #include "url/gurl.h" 17 #include "url/gurl.h"
17 18
18 class Browser; 19 class Browser;
19 class Profile; 20 class Profile;
20 class StartupBrowserCreator; 21 class StartupBrowserCreator;
21 22
22 namespace base { 23 namespace base {
23 class CommandLine; 24 class CommandLine;
24 class FilePath; 25 class FilePath;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 61
61 // Convenience for OpenTabsInBrowser that converts |urls| into a set of 62 // Convenience for OpenTabsInBrowser that converts |urls| into a set of
62 // Tabs. 63 // Tabs.
63 Browser* OpenURLsInBrowser(Browser* browser, 64 Browser* OpenURLsInBrowser(Browser* browser,
64 bool process_startup, 65 bool process_startup,
65 const std::vector<GURL>& urls); 66 const std::vector<GURL>& urls);
66 67
67 private: 68 private:
68 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs); 69 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs);
69 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); 70 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch);
71 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest, DetermineStartupTabs);
72 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest,
73 DetermineStartupTabs_IncognitoOrCrash);
74 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorImplTest,
75 DetermineStartupTabs_MasterPrefs);
70 76
71 enum class WelcomeRunType { 77 enum class WelcomeRunType {
72 NONE, // Do not inject the welcome page for this run. 78 NONE, // Do not inject the welcome page for this run.
73 FIRST_TAB, // Inject the welcome page as the first tab. 79 FIRST_TAB, // Inject the welcome page as the first tab.
74 FIRST_RUN_LAST_TAB, // Inject the welcome page as the last first-run tab. 80 FIRST_RUN_LAST_TAB, // Inject the welcome page as the last first-run tab.
75 }; 81 };
76 82
77 // Creates a tab for each of the Tabs in |tabs|. If browser is non-null 83 // Creates a tab for each of the Tabs in |tabs|. If browser is non-null
78 // and a tabbed browser, the tabs are added to it. Otherwise a new tabbed 84 // and a tabbed browser, the tabs are added to it. Otherwise a new tabbed
79 // browser is created and the tabs are added to it. The browser the tabs 85 // browser is created and the tabs are added to it. The browser the tabs
(...skipping 19 matching lines...) Expand all
99 105
100 // Invoked from Launch to handle processing of urls. This may do any of the 106 // Invoked from Launch to handle processing of urls. This may do any of the
101 // following: 107 // following:
102 // . Invoke ProcessStartupURLs if |process_startup| is true. 108 // . Invoke ProcessStartupURLs if |process_startup| is true.
103 // . If |process_startup| is false, restore the last session if necessary, 109 // . If |process_startup| is false, restore the last session if necessary,
104 // or invoke ProcessSpecifiedURLs. 110 // or invoke ProcessSpecifiedURLs.
105 // . Open the urls directly. 111 // . Open the urls directly.
106 void ProcessLaunchURLs(bool process_startup, 112 void ProcessLaunchURLs(bool process_startup,
107 const std::vector<GURL>& urls_to_open); 113 const std::vector<GURL>& urls_to_open);
108 114
115 // Determines the URLs to be shown at startup by way of various policies
116 // (onboarding, pinned tabs, etc.), determines whether a session restore
117 // is necessary, and opens the content a new or restored browser accordingly.
grt (UTC plus 2) 2016/09/09 11:40:30 "opens the content"?
118 // This method is a refactoring of ProcessLaunchURLs above, and will replace
119 // that code path entirely once kUseConsolidatedStartupFlow is on by default.
120 void ProcessLaunchUrlsUsingConsolidatedFlow(
121 bool process_startup,
122 const std::vector<GURL>& urls_to_open);
123
124 // Returns the tabs to be shown on startup, based on the policy functions
grt (UTC plus 2) 2016/09/09 11:40:30 ...on startup when no URLs are provided on the com
125 // in the given StartupTabProvider, and the interactions between those
126 // policies.
127 StartupTabs DetermineStartupTabs(StartupTabProvider* provider,
128 bool is_incognito,
129 bool is_crash);
130
131 // Opens the given tabs in a new browser.
132 // TODO(tmartino): Add the ability to restore a session, and an additional
133 // argument which indicates which behavior (new or restored) should be used.
134 Browser* RestoreOrCreateBrowser(StartupTabs tabs);
135
109 // Does the following: 136 // Does the following:
110 // . If the user's startup pref is to restore the last session (or the 137 // . If the user's startup pref is to restore the last session (or the
111 // command line flag is present to force using last session), it is 138 // command line flag is present to force using last session), it is
112 // restored. 139 // restored.
113 // . Otherwise invoke ProcessSpecifiedURLs 140 // . Otherwise invoke ProcessSpecifiedURLs
114 // If a browser was created, true is returned. Otherwise returns false and 141 // If a browser was created, true is returned. Otherwise returns false and
115 // the caller must create a new browser. 142 // the caller must create a new browser.
116 bool ProcessStartupURLs(const std::vector<GURL>& urls_to_open); 143 bool ProcessStartupURLs(const std::vector<GURL>& urls_to_open);
117 144
118 // Invoked from either ProcessLaunchURLs or ProcessStartupURLs to handle 145 // Invoked from either ProcessLaunchURLs or ProcessStartupURLs to handle
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 const base::FilePath cur_dir_; 185 const base::FilePath cur_dir_;
159 const base::CommandLine& command_line_; 186 const base::CommandLine& command_line_;
160 Profile* profile_; 187 Profile* profile_;
161 StartupBrowserCreator* browser_creator_; 188 StartupBrowserCreator* browser_creator_;
162 bool is_first_run_; 189 bool is_first_run_;
163 WelcomeRunType welcome_run_type_; 190 WelcomeRunType welcome_run_type_;
164 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); 191 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl);
165 }; 192 };
166 193
167 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ 194 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698