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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_impl.h

Issue 1226643002: Welcome page changes for Windows 10 and over. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rewording in policy_templates.json and sync to position 338549 Created 5 years, 5 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
(...skipping 12 matching lines...) Expand all
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
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_TAB, // Inject the welcome page as the first tab.
85 FIRST_RUN_LAST_TAB, // Inject the welcome page as the last first-run tab.
86 };
87
82 // If the process was launched with the web application command line flags, 88 // 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. 89 // 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. 90 // 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); 91 bool IsAppLaunch(std::string* app_url, std::string* app_id);
86 92
87 // If IsAppLaunch is true, tries to open an application window. 93 // 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, 94 // 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 95 // returns false to specify default processing. |out_app_contents| is an
90 // optional argument to receive the created WebContents for the app. 96 // optional argument to receive the created WebContents for the app.
91 bool OpenApplicationWindow(Profile* profile, 97 bool OpenApplicationWindow(Profile* profile,
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 void AddUniqueURLs(const std::vector<GURL>& urls, StartupTabs* tabs); 140 void AddUniqueURLs(const std::vector<GURL>& urls, StartupTabs* tabs);
135 141
136 // Adds any startup infobars to the selected tab of the given browser. 142 // Adds any startup infobars to the selected tab of the given browser.
137 void AddInfoBarsIfNecessary( 143 void AddInfoBarsIfNecessary(
138 Browser* browser, 144 Browser* browser,
139 chrome::startup::IsProcessStartup is_process_startup); 145 chrome::startup::IsProcessStartup is_process_startup);
140 146
141 // Adds additional startup URLs to the specified vector. 147 // Adds additional startup URLs to the specified vector.
142 void AddStartupURLs(std::vector<GURL>* startup_urls) const; 148 void AddStartupURLs(std::vector<GURL>* startup_urls) const;
143 149
144 // Checks whether the Preferences backup is invalid and notifies user in 150 // Initializes |welcome_run_type_| for this launch. Also persists state to
145 // that case. 151 // suppress injecting the welcome page for future launches.
146 void CheckPreferencesBackup(Profile* profile); 152 void InitializeWelcomeRunType(const std::vector<GURL>& urls_to_open);
147 153
148 const base::FilePath cur_dir_; 154 const base::FilePath cur_dir_;
149 const base::CommandLine& command_line_; 155 const base::CommandLine& command_line_;
150 Profile* profile_; 156 Profile* profile_;
151 StartupBrowserCreator* browser_creator_; 157 StartupBrowserCreator* browser_creator_;
152 bool is_first_run_; 158 bool is_first_run_;
159 WelcomeRunType welcome_run_type_;
153 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl); 160 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreatorImpl);
154 }; 161 };
155 162
156 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_ 163 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698