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

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

Issue 1598553003: Implement the Windows desktop search redirection feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self-review Created 4 years, 11 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_H_ 5 #ifndef CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ 6 #define CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 void set_show_main_browser_window(bool show_main_browser_window) { 94 void set_show_main_browser_window(bool show_main_browser_window) {
95 show_main_browser_window_ = show_main_browser_window; 95 show_main_browser_window_ = show_main_browser_window;
96 } 96 }
97 97
98 bool show_main_browser_window() const { 98 bool show_main_browser_window() const {
99 return show_main_browser_window_; 99 return show_main_browser_window_;
100 } 100 }
101 101
102 bool show_desktop_search_redirection_infobar() const {
103 return show_desktop_search_redirection_infobar_;
104 }
105
102 // For faking that no profiles have been launched yet. 106 // For faking that no profiles have been launched yet.
103 static void ClearLaunchedProfilesForTesting(); 107 static void ClearLaunchedProfilesForTesting();
104 108
105 static void RegisterLocalStatePrefs(PrefRegistrySimple* registry); 109 static void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
106 110
107 #if defined(OS_WIN) 111 #if defined(OS_WIN)
108 // Setting Chrome as the default browser in Windows 10+ requires a specific 112 // Setting Chrome as the default browser in Windows 10+ requires a specific
109 // url to be opened through openwith.exe. This url is intercepted in 113 // url to be opened through openwith.exe. This url is intercepted in
110 // ProcessCmdLineImpl when the callback is set. See DefaultBrowserWorker in 114 // ProcessCmdLineImpl when the callback is set. See DefaultBrowserWorker in
111 // shell_integration.h for more details. Only call this on the UI 115 // shell_integration.h for more details. Only call this on the UI
(...skipping 14 matching lines...) Expand all
126 private: 130 private:
127 friend class CloudPrintProxyPolicyTest; 131 friend class CloudPrintProxyPolicyTest;
128 friend class CloudPrintProxyPolicyStartupTest; 132 friend class CloudPrintProxyPolicyStartupTest;
129 friend class StartupBrowserCreatorImpl; 133 friend class StartupBrowserCreatorImpl;
130 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, 134 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
131 ReadingWasRestartedAfterNormalStart); 135 ReadingWasRestartedAfterNormalStart);
132 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, 136 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest,
133 ReadingWasRestartedAfterRestart); 137 ReadingWasRestartedAfterRestart);
134 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, UpdateWithTwoProfiles); 138 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, UpdateWithTwoProfiles);
135 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, LastUsedProfileActivated); 139 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorTest, LastUsedProfileActivated);
136 FRIEND_TEST_ALL_PREFIXES(StartupBrowserCreatorWinTest,
137 GetURLsFromCommandLineWithDesktopSearchURL);
138 140
139 // Returns the list of URLs to open from the command line. The returned 141 // Returns the list of URLs to open from the command line. The returned vector
140 // vector is empty if the user didn't specify any URLs on the command line. 142 // is empty if the user didn't specify any URLs on the command line.
143 // |show_search_redirection_infobar| is set to true if an infobar should be
144 // shown to inform the user that a desktop search has been redirected to the
145 // default search engine.
141 static std::vector<GURL> GetURLsFromCommandLine( 146 static std::vector<GURL> GetURLsFromCommandLine(
142 const base::CommandLine& command_line, 147 const base::CommandLine& command_line,
143 const base::FilePath& cur_dir, 148 const base::FilePath& cur_dir,
144 Profile* profile); 149 Profile* profile,
150 bool* show_desktop_search_redirection_infobar);
145 151
146 static bool ProcessCmdLineImpl(const base::CommandLine& command_line, 152 static bool ProcessCmdLineImpl(const base::CommandLine& command_line,
147 const base::FilePath& cur_dir, 153 const base::FilePath& cur_dir,
148 bool process_startup, 154 bool process_startup,
149 Profile* last_used_profile, 155 Profile* last_used_profile,
150 const Profiles& last_opened_profiles, 156 const Profiles& last_opened_profiles,
151 StartupBrowserCreator* browser_creator); 157 StartupBrowserCreator* browser_creator);
152 158
153 // This function performs command-line handling and is invoked only after 159 // This function performs command-line handling and is invoked only after
154 // start up (for example when we get a start request for another process). 160 // start up (for example when we get a start request for another process).
(...skipping 21 matching lines...) Expand all
176 182
177 // True if the set-as-default dialog has been explicitly suppressed. 183 // True if the set-as-default dialog has been explicitly suppressed.
178 // This information is used to allow the default browser prompt to show on 184 // This information is used to allow the default browser prompt to show on
179 // first-run when the dialog has been suppressed. 185 // first-run when the dialog has been suppressed.
180 bool is_default_browser_dialog_suppressed_; 186 bool is_default_browser_dialog_suppressed_;
181 187
182 // Whether the browser window should be shown immediately after it has been 188 // Whether the browser window should be shown immediately after it has been
183 // created. Default is true. 189 // created. Default is true.
184 bool show_main_browser_window_; 190 bool show_main_browser_window_;
185 191
192 // Whether an infobar should be shown to inform the user that a desktop search
193 // has been redirected to the default search engine.
194 bool show_desktop_search_redirection_infobar_;
195
186 // True if we have already read and reset the preference kWasRestarted. (A 196 // True if we have already read and reset the preference kWasRestarted. (A
187 // member variable instead of a static variable inside WasRestarted because 197 // member variable instead of a static variable inside WasRestarted because
188 // of testing.) 198 // of testing.)
189 static bool was_restarted_read_; 199 static bool was_restarted_read_;
190 200
191 static bool in_synchronous_profile_launch_; 201 static bool in_synchronous_profile_launch_;
192 202
193 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreator); 203 DISALLOW_COPY_AND_ASSIGN(StartupBrowserCreator);
194 }; 204 };
195 205
196 // Returns true if |profile| has exited uncleanly and has not been launched 206 // Returns true if |profile| has exited uncleanly and has not been launched
197 // after the unclean exit. 207 // after the unclean exit.
198 bool HasPendingUncleanExit(Profile* profile); 208 bool HasPendingUncleanExit(Profile* profile);
199 209
200 // Returns the path that contains the profile that should be loaded on process 210 // Returns the path that contains the profile that should be loaded on process
201 // startup. 211 // startup.
202 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir, 212 base::FilePath GetStartupProfilePath(const base::FilePath& user_data_dir,
203 const base::CommandLine& command_line); 213 const base::CommandLine& command_line);
204 214
205 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_ 215 #endif // CHROME_BROWSER_UI_STARTUP_STARTUP_BROWSER_CREATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698