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

Side by Side Diff: chrome/browser/ui/startup/default_browser_prompt.cc

Issue 1684843002: Remove HostDesktopType from ShowDefaultBrowserPrompt (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@metro-mode-14
Patch Set: rebase Created 4 years, 10 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 #include "chrome/browser/ui/startup/default_browser_prompt.h" 5 #include "chrome/browser/ui/startup/default_browser_prompt.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 } 195 }
196 196
197 // A shell_integration::DefaultWebClientObserver that handles the check to 197 // A shell_integration::DefaultWebClientObserver that handles the check to
198 // determine whether or not to show the default browser prompt. If Chrome is the 198 // determine whether or not to show the default browser prompt. If Chrome is the
199 // default browser, then the kCheckDefaultBrowser pref is reset. Otherwise, the 199 // default browser, then the kCheckDefaultBrowser pref is reset. Otherwise, the
200 // prompt is shown. 200 // prompt is shown.
201 class CheckDefaultBrowserObserver 201 class CheckDefaultBrowserObserver
202 : public shell_integration::DefaultWebClientObserver { 202 : public shell_integration::DefaultWebClientObserver {
203 public: 203 public:
204 CheckDefaultBrowserObserver(const base::FilePath& profile_path, 204 CheckDefaultBrowserObserver(const base::FilePath& profile_path,
205 bool show_prompt, 205 bool show_prompt);
206 chrome::HostDesktopType desktop_type);
207 ~CheckDefaultBrowserObserver() override; 206 ~CheckDefaultBrowserObserver() override;
208 207
209 private: 208 private:
210 void SetDefaultWebClientUIState( 209 void SetDefaultWebClientUIState(
211 shell_integration::DefaultWebClientUIState state) override; 210 shell_integration::DefaultWebClientUIState state) override;
212 bool IsOwnedByWorker() override; 211 bool IsOwnedByWorker() override;
213 212
214 void ResetCheckDefaultBrowserPref(); 213 void ResetCheckDefaultBrowserPref();
215 void ShowPrompt(); 214 void ShowPrompt();
216 215
217 // The path to the profile for which the prompt is to be shown. 216 // The path to the profile for which the prompt is to be shown.
218 base::FilePath profile_path_; 217 base::FilePath profile_path_;
219 218
220 // True if the prompt is to be shown if Chrome is not the default browser. 219 // True if the prompt is to be shown if Chrome is not the default browser.
221 bool show_prompt_; 220 bool show_prompt_;
222 chrome::HostDesktopType desktop_type_;
223 221
224 DISALLOW_COPY_AND_ASSIGN(CheckDefaultBrowserObserver); 222 DISALLOW_COPY_AND_ASSIGN(CheckDefaultBrowserObserver);
225 }; 223 };
226 224
227 CheckDefaultBrowserObserver::CheckDefaultBrowserObserver( 225 CheckDefaultBrowserObserver::CheckDefaultBrowserObserver(
228 const base::FilePath& profile_path, 226 const base::FilePath& profile_path,
229 bool show_prompt, 227 bool show_prompt)
230 chrome::HostDesktopType desktop_type) 228 : profile_path_(profile_path), show_prompt_(show_prompt) {}
231 : profile_path_(profile_path),
232 show_prompt_(show_prompt),
233 desktop_type_(desktop_type) {}
234 229
235 CheckDefaultBrowserObserver::~CheckDefaultBrowserObserver() {} 230 CheckDefaultBrowserObserver::~CheckDefaultBrowserObserver() {}
236 231
237 void CheckDefaultBrowserObserver::SetDefaultWebClientUIState( 232 void CheckDefaultBrowserObserver::SetDefaultWebClientUIState(
238 shell_integration::DefaultWebClientUIState state) { 233 shell_integration::DefaultWebClientUIState state) {
239 if (state == shell_integration::STATE_IS_DEFAULT) { 234 if (state == shell_integration::STATE_IS_DEFAULT) {
240 // Notify the user in the future if Chrome ceases to be the user's chosen 235 // Notify the user in the future if Chrome ceases to be the user's chosen
241 // default browser. 236 // default browser.
242 ResetCheckDefaultBrowserPref(); 237 ResetCheckDefaultBrowserPref();
243 } else if (show_prompt_ && state == shell_integration::STATE_NOT_DEFAULT && 238 } else if (show_prompt_ && state == shell_integration::STATE_NOT_DEFAULT &&
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 274
280 } // namespace 275 } // namespace
281 276
282 namespace chrome { 277 namespace chrome {
283 278
284 void RegisterDefaultBrowserPromptPrefs(PrefRegistrySimple* registry) { 279 void RegisterDefaultBrowserPromptPrefs(PrefRegistrySimple* registry) {
285 registry->RegisterStringPref( 280 registry->RegisterStringPref(
286 prefs::kBrowserSuppressDefaultBrowserPrompt, std::string()); 281 prefs::kBrowserSuppressDefaultBrowserPrompt, std::string());
287 } 282 }
288 283
289 void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type) { 284 void ShowDefaultBrowserPrompt(Profile* profile) {
290 // Do not check if Chrome is the default browser if there is a policy in 285 // Do not check if Chrome is the default browser if there is a policy in
291 // control of this setting. 286 // control of this setting.
292 if (g_browser_process->local_state()->IsManagedPreference( 287 if (g_browser_process->local_state()->IsManagedPreference(
293 prefs::kDefaultBrowserSettingEnabled)) { 288 prefs::kDefaultBrowserSettingEnabled)) {
294 // Handling of the browser.default_browser_setting_enabled policy setting is 289 // Handling of the browser.default_browser_setting_enabled policy setting is
295 // taken care of in BrowserProcessImpl. 290 // taken care of in BrowserProcessImpl.
296 return; 291 return;
297 } 292 }
298 293
299 PrefService* prefs = profile->GetPrefs(); 294 PrefService* prefs = profile->GetPrefs();
(...skipping 15 matching lines...) Expand all
315 const Version disable_version(disable_version_string); 310 const Version disable_version(disable_version_string);
316 DCHECK(disable_version_string.empty() || disable_version.IsValid()); 311 DCHECK(disable_version_string.empty() || disable_version.IsValid());
317 if (disable_version.IsValid() && 312 if (disable_version.IsValid() &&
318 disable_version == Version(version_info::GetVersionNumber())) { 313 disable_version == Version(version_info::GetVersionNumber())) {
319 show_prompt = false; 314 show_prompt = false;
320 } 315 }
321 } 316 }
322 317
323 scoped_refptr<shell_integration::DefaultBrowserWorker>( 318 scoped_refptr<shell_integration::DefaultBrowserWorker>(
324 new shell_integration::DefaultBrowserWorker( 319 new shell_integration::DefaultBrowserWorker(
325 new CheckDefaultBrowserObserver(profile->GetPath(), show_prompt, 320 new CheckDefaultBrowserObserver(profile->GetPath(), show_prompt)))
326 desktop_type)))
327 ->StartCheckIsDefault(); 321 ->StartCheckIsDefault();
328 } 322 }
329 323
330 #if !defined(OS_WIN) 324 #if !defined(OS_WIN)
331 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { 325 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) {
332 return false; 326 return false;
333 } 327 }
334 #endif 328 #endif
335 329
336 } // namespace chrome 330 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/startup/default_browser_prompt.h ('k') | chrome/browser/ui/startup/startup_browser_creator_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698