OLD | NEW |
---|---|
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 |
(...skipping 11 matching lines...) Expand all Loading... | |
22 namespace base { | 22 namespace base { |
23 class CommandLine; | 23 class CommandLine; |
24 class FilePath; | 24 class FilePath; |
25 } | 25 } |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 class WebContents; | 28 class WebContents; |
29 } | 29 } |
30 | 30 |
31 namespace internals { | 31 namespace internals { |
32 | |
32 GURL GetWelcomePageURL(); | 33 GURL GetWelcomePageURL(); |
33 } | 34 |
35 // On Windows 10 and higher, the welcome page is shown once following each OS | |
36 // upgrade, even when not in first-run. When this is true, the welcome page | |
gab
2015/07/09 18:05:13
"even when not" suggests it *may also* happen duri
grt (UTC plus 2)
2015/07/10 15:43:25
comment removed
| |
37 // precedes the NTP in the startup tabs, and the sync promo is not shown. | |
38 bool ShowWelcomePageAfterFirstRun(); | |
msw
2015/07/09 17:51:31
Inline this in StartupBrowserCreatorImpl::Initiali
grt (UTC plus 2)
2015/07/10 15:43:25
Done.
| |
39 | |
40 // Records that welcome page was shown for the current run. | |
41 void RecordWelcomeRunComplete(); | |
42 | |
43 } // namespace internals | |
34 | 44 |
35 // Assists launching the application and appending the initial tabs for a | 45 // Assists launching the application and appending the initial tabs for a |
36 // browser window. | 46 // browser window. |
37 class StartupBrowserCreatorImpl { | 47 class StartupBrowserCreatorImpl { |
38 public: | 48 public: |
39 // There are two ctors. The first one implies a NULL browser_creator object | 49 // There are two ctors. The first one implies a NULL browser_creator object |
40 // and thus no access to distribution-specific first-run behaviors. The | 50 // and thus no access to distribution-specific first-run behaviors. The |
41 // second one is always called when the browser starts even if it is not | 51 // second one is always called when the browser starts even if it is not |
42 // the first run. |is_first_run| indicates that this is a new profile. | 52 // the first run. |is_first_run| indicates that this is a new profile. |
43 StartupBrowserCreatorImpl(const base::FilePath& cur_dir, | 53 StartupBrowserCreatorImpl(const base::FilePath& cur_dir, |
(...skipping 28 matching lines...) Expand all Loading... | |
72 // browser. | 82 // browser. |
73 Browser* OpenTabsInBrowser(Browser* browser, | 83 Browser* OpenTabsInBrowser(Browser* browser, |
74 bool process_startup, | 84 bool process_startup, |
75 const StartupTabs& tabs, | 85 const StartupTabs& tabs, |
76 chrome::HostDesktopType desktop_type); | 86 chrome::HostDesktopType desktop_type); |
77 | 87 |
78 private: | 88 private: |
79 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs); | 89 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs); |
80 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); | 90 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); |
81 | 91 |
92 enum class WelcomeRunType { | |
93 NONE, // Do not inject the welcome page for this run. | |
94 FIRST_RUN_FIRST, // Inject the welcome page as the first first-run tab. | |
msw
2015/07/09 17:51:31
It doesn't seem like the enum needs to convey the
grt (UTC plus 2)
2015/07/09 18:59:38
I didn't differentiate these initially, but it tur
msw
2015/07/10 19:40:45
That sounds plausible, but I might have to see it
| |
95 FIRST_RUN_LAST, // Inject the welcome page as the last first-run tab. | |
96 ANY_RUN_FIRST, // Inject the welcome page as the first tab. | |
97 }; | |
98 | |
82 // If the process was launched with the web application command line flags, | 99 // If the process was launched with the web application command line flags, |
83 // e.g. --app=http://www.google.com/ or --app_id=... return true. | 100 // e.g. --app=http://www.google.com/ or --app_id=... return true. |
84 // In this case |app_url| or |app_id| are populated if they're non-null. | 101 // In this case |app_url| or |app_id| are populated if they're non-null. |
85 bool IsAppLaunch(std::string* app_url, std::string* app_id); | 102 bool IsAppLaunch(std::string* app_url, std::string* app_id); |
86 | 103 |
87 // If IsAppLaunch is true, tries to open an application window. | 104 // If IsAppLaunch is true, tries to open an application window. |
88 // If the app is specified to start in a tab, or IsAppLaunch is false, | 105 // If the app is specified to start in a tab, or IsAppLaunch is false, |
89 // returns false to specify default processing. |out_app_contents| is an | 106 // returns false to specify default processing. |out_app_contents| is an |
90 // optional argument to receive the created WebContents for the app. | 107 // optional argument to receive the created WebContents for the app. |
91 bool OpenApplicationWindow(Profile* profile, | 108 bool OpenApplicationWindow(Profile* profile, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 void AddUniqueURLs(const std::vector<GURL>& urls, StartupTabs* tabs); | 151 void AddUniqueURLs(const std::vector<GURL>& urls, StartupTabs* tabs); |
135 | 152 |
136 // Adds any startup infobars to the selected tab of the given browser. | 153 // Adds any startup infobars to the selected tab of the given browser. |
137 void AddInfoBarsIfNecessary( | 154 void AddInfoBarsIfNecessary( |
138 Browser* browser, | 155 Browser* browser, |
139 chrome::startup::IsProcessStartup is_process_startup); | 156 chrome::startup::IsProcessStartup is_process_startup); |
140 | 157 |
141 // Adds additional startup URLs to the specified vector. | 158 // Adds additional startup URLs to the specified vector. |
142 void AddStartupURLs(std::vector<GURL>* startup_urls) const; | 159 void AddStartupURLs(std::vector<GURL>* startup_urls) const; |
143 | 160 |
144 // Checks whether the Preferences backup is invalid and notifies user in | 161 // Initializes |welcome_run_type_| for this launch. For first-run, the type |
msw
2015/07/09 17:51:31
Don't explain the nuanced impl details here, move
grt (UTC plus 2)
2015/07/09 18:59:38
Done.
| |
145 // that case. | 162 // will be LAST_TAB for all systems except for Windows 10+, where it will be |
146 void CheckPreferencesBackup(Profile* profile); | 163 // FIRST_TAB. For non-first run, the type will be NONE for all systems |
gab
2015/07/09 18:05:13
FIRST_TAB and LAST_TAB don't match the values of t
grt (UTC plus 2)
2015/07/09 18:59:38
Done.
| |
164 // except for Windows 10+, where it will be FIRST_TAB if this is the first | |
165 // somewhat normal launch since an OS upgrade. | |
166 void InitializeWelcomeRunType(const std::vector<GURL>& urls_to_open); | |
167 | |
168 // Records that the welcome page was shown. | |
169 void RecordWelcomeRunComplete() const; | |
147 | 170 |
148 const base::FilePath cur_dir_; | 171 const base::FilePath cur_dir_; |
149 const base::CommandLine& command_line_; | 172 const base::CommandLine& command_line_; |
150 Profile* profile_; | 173 Profile* profile_; |
151 StartupBrowserCreator* browser_creator_; | 174 StartupBrowserCreator* browser_creator_; |
152 bool is_first_run_; | 175 bool is_first_run_; |
176 WelcomeRunType welcome_run_type_; | |
153 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); | 177 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); |
154 }; | 178 }; |
155 | 179 |
156 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ | 180 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ |
OLD | NEW |