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

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

Issue 1578013002: Reset browser.check_default_browser on update. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missing line 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
« no previous file with comments | « chrome/browser/ui/browser_ui_prefs.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type) { 289 void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type) {
290 // Do not check if Chrome is the default browser if there is a policy in 290 // Do not check if Chrome is the default browser if there is a policy in
291 // control of this setting. 291 // control of this setting.
292 if (g_browser_process->local_state()->IsManagedPreference( 292 if (g_browser_process->local_state()->IsManagedPreference(
293 prefs::kDefaultBrowserSettingEnabled)) { 293 prefs::kDefaultBrowserSettingEnabled)) {
294 // Handling of the browser.default_browser_setting_enabled policy setting is 294 // Handling of the browser.default_browser_setting_enabled policy setting is
295 // taken care of in BrowserProcessImpl. 295 // taken care of in BrowserProcessImpl.
296 return; 296 return;
297 } 297 }
298 298
299 PrefService* prefs = profile->GetPrefs();
300 // Reset preferences if kResetCheckDefaultBrowser is true.
301 if (prefs->GetBoolean(prefs::kResetCheckDefaultBrowser)) {
302 prefs->SetBoolean(prefs::kResetCheckDefaultBrowser, false);
303 prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
304 }
305
299 // Check if Chrome is the default browser but do not prompt if: 306 // Check if Chrome is the default browser but do not prompt if:
300 // - The user said "don't ask me again" on the infobar earlier. 307 // - The user said "don't ask me again" on the infobar earlier.
301 // - The "suppress_default_browser_prompt_for_version" master preference is 308 // - The "suppress_default_browser_prompt_for_version" master preference is
302 // set to the current version. 309 // set to the current version.
303 bool show_prompt = 310 bool show_prompt = prefs->GetBoolean(prefs::kCheckDefaultBrowser);
304 profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser);
305 if (show_prompt) { 311 if (show_prompt) {
306 const std::string disable_version_string = 312 const std::string disable_version_string =
307 g_browser_process->local_state()->GetString( 313 g_browser_process->local_state()->GetString(
308 prefs::kBrowserSuppressDefaultBrowserPrompt); 314 prefs::kBrowserSuppressDefaultBrowserPrompt);
309 const Version disable_version(disable_version_string); 315 const Version disable_version(disable_version_string);
310 DCHECK(disable_version_string.empty() || disable_version.IsValid()); 316 DCHECK(disable_version_string.empty() || disable_version.IsValid());
311 if (disable_version.IsValid()) { 317 if (disable_version.IsValid()) {
312 if (disable_version.Equals(Version(version_info::GetVersionNumber()))) 318 if (disable_version.Equals(Version(version_info::GetVersionNumber())))
313 show_prompt = false; 319 show_prompt = false;
314 } 320 }
315 } 321 }
316 322
317 scoped_refptr<ShellIntegration::DefaultBrowserWorker>( 323 scoped_refptr<ShellIntegration::DefaultBrowserWorker>(
318 new ShellIntegration::DefaultBrowserWorker( 324 new ShellIntegration::DefaultBrowserWorker(
319 new CheckDefaultBrowserObserver(profile->GetPath(), show_prompt, 325 new CheckDefaultBrowserObserver(profile->GetPath(), show_prompt,
320 desktop_type))) 326 desktop_type)))
321 ->StartCheckIsDefault(); 327 ->StartCheckIsDefault();
322 } 328 }
323 329
324 #if !defined(OS_WIN) 330 #if !defined(OS_WIN)
325 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) { 331 bool ShowFirstRunDefaultBrowserPrompt(Profile* profile) {
326 return false; 332 return false;
327 } 333 }
328 #endif 334 #endif
329 335
330 } // namespace chrome 336 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_ui_prefs.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698