Chromium Code Reviews| 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 12 matching lines...) Expand all Loading... | |
| 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 GURL GetWelcomePageURL(); | 32 GURL GetWelcomePageURL(); |
| 33 } | 33 } // namespace internals |
| 34 | 34 |
| 35 // Assists launching the application and appending the initial tabs for a | 35 // Assists launching the application and appending the initial tabs for a |
| 36 // browser window. | 36 // browser window. |
| 37 class StartupBrowserCreatorImpl { | 37 class StartupBrowserCreatorImpl { |
| 38 public: | 38 public: |
| 39 // There are two ctors. The first one implies a NULL browser_creator object | 39 // 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 | 40 // 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 | 41 // 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. | 42 // the first run. |is_first_run| indicates that this is a new profile. |
| 43 StartupBrowserCreatorImpl(const base::FilePath& cur_dir, | 43 StartupBrowserCreatorImpl(const base::FilePath& cur_dir, |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 72 // browser. | 72 // browser. |
| 73 Browser* OpenTabsInBrowser(Browser* browser, | 73 Browser* OpenTabsInBrowser(Browser* browser, |
| 74 bool process_startup, | 74 bool process_startup, |
| 75 const StartupTabs& tabs, | 75 const StartupTabs& tabs, |
| 76 chrome::HostDesktopType desktop_type); | 76 chrome::HostDesktopType desktop_type); |
| 77 | 77 |
| 78 private: | 78 private: |
| 79 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs); | 79 FRIEND_TEST_ALL_PREFIXES(BrowserTest, RestorePinnedTabs); |
| 80 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); | 80 FRIEND_TEST_ALL_PREFIXES(BrowserTest, AppIdSwitch); |
| 81 | 81 |
| 82 enum class WelcomeRunType { | |
| 83 NONE, // Do not inject the welcome page for this run. | |
| 84 FIRST_RUN_FIRST, // Inject the welcome page as the first first-run tab. | |
| 85 FIRST_RUN_LAST, // Inject the welcome page as the last first-run tab. | |
| 86 ANY_RUN_FIRST, // Inject the welcome page as the first tab. | |
| 87 }; | |
| 88 | |
| 82 // If the process was launched with the web application command line flags, | 89 // 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. | 90 // 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. | 91 // 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); | 92 bool IsAppLaunch(std::string* app_url, std::string* app_id); |
| 86 | 93 |
| 87 // If IsAppLaunch is true, tries to open an application window. | 94 // 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, | 95 // 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 | 96 // returns false to specify default processing. |out_app_contents| is an |
| 90 // optional argument to receive the created WebContents for the app. | 97 // optional argument to receive the created WebContents for the app. |
| 91 bool OpenApplicationWindow(Profile* profile, | 98 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); | 141 void AddUniqueURLs(const std::vector<GURL>& urls, StartupTabs* tabs); |
| 135 | 142 |
| 136 // Adds any startup infobars to the selected tab of the given browser. | 143 // Adds any startup infobars to the selected tab of the given browser. |
| 137 void AddInfoBarsIfNecessary( | 144 void AddInfoBarsIfNecessary( |
| 138 Browser* browser, | 145 Browser* browser, |
| 139 chrome::startup::IsProcessStartup is_process_startup); | 146 chrome::startup::IsProcessStartup is_process_startup); |
| 140 | 147 |
| 141 // Adds additional startup URLs to the specified vector. | 148 // Adds additional startup URLs to the specified vector. |
| 142 void AddStartupURLs(std::vector<GURL>* startup_urls) const; | 149 void AddStartupURLs(std::vector<GURL>* startup_urls) const; |
| 143 | 150 |
| 144 // Checks whether the Preferences backup is invalid and notifies user in | 151 // Initializes |welcome_run_type_| for this launch. Also records that the |
| 145 // that case. | 152 // welcome page is to be injected for future launches. |
|
msw
2015/07/10 22:07:32
nit: "is to be" or "is not to be"? no joke, won't
grt (UTC plus 2)
2015/07/11 12:16:08
English... I wrote that thinking "...is to be inje
| |
| 146 void CheckPreferencesBackup(Profile* profile); | 153 void InitializeWelcomeRunType(const std::vector<GURL>& urls_to_open); |
| 147 | 154 |
| 148 const base::FilePath cur_dir_; | 155 const base::FilePath cur_dir_; |
| 149 const base::CommandLine& command_line_; | 156 const base::CommandLine& command_line_; |
| 150 Profile* profile_; | 157 Profile* profile_; |
| 151 StartupBrowserCreator* browser_creator_; | 158 StartupBrowserCreator* browser_creator_; |
| 152 bool is_first_run_; | 159 bool is_first_run_; |
| 160 WelcomeRunType welcome_run_type_; | |
| 153 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); | 161 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); |
| 154 }; | 162 }; |
| 155 | 163 |
| 156 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ | 164 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ |
| OLD | NEW |