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

Unified Diff: chrome/browser/ui/startup/default_browser_prompt.cc

Issue 1182513007: Reset browser.check_default_browser to true when Chrome is the user's default browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/default_browser_prompt.cc
diff --git a/chrome/browser/ui/startup/default_browser_prompt.cc b/chrome/browser/ui/startup/default_browser_prompt.cc
index 86a592ba84e1473536ef1258ccad48df782d2f89..84e559a5e4a3776697e5fbb5ea4eba14da61c708 100644
--- a/chrome/browser/ui/startup/default_browser_prompt.cc
+++ b/chrome/browser/ui/startup/default_browser_prompt.cc
@@ -14,6 +14,7 @@
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
@@ -194,8 +195,16 @@ void NotifyNotDefaultBrowserCallback(chrome::HostDesktopType desktop_type) {
ShellIntegration::SET_DEFAULT_INTERACTIVE));
}
-void CheckDefaultBrowserCallback(chrome::HostDesktopType desktop_type) {
- if (ShellIntegration::GetDefaultBrowser() == ShellIntegration::NOT_DEFAULT) {
+void CheckDefaultBrowserCallback(bool show_prompt,
+ chrome::HostDesktopType desktop_type) {
+ ShellIntegration::DefaultWebClientState state =
+ ShellIntegration::GetDefaultBrowser();
+ if (state == ShellIntegration::IS_DEFAULT) {
+ // Notify the user in the future if Chrome ceases to be the user's chosen
+ // default browser.
+ PrefService* prefs = ProfileManager::GetLastUsedProfile()->GetPrefs();
msw 2015/06/16 19:23:01 It seems odd to change the last used profile, mayb
grt (UTC plus 2) 2015/06/16 19:31:53 Ah, what I've done here may be unsafe for several
msw 2015/06/16 20:29:49 Maybe use profile->GetPath(), like ProfileSizeTask
grt (UTC plus 2) 2015/06/16 21:04:09 Done.
+ prefs->SetBoolean(prefs::kCheckDefaultBrowser, true);
+ } else if (show_prompt && state == ShellIntegration::NOT_DEFAULT) {
ShellIntegration::DefaultWebClientSetPermission default_change_mode =
ShellIntegration::CanSetAsDefaultBrowser();
@@ -218,12 +227,13 @@ void RegisterDefaultBrowserPromptPrefs(PrefRegistrySimple* registry) {
void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type) {
// We do not check if we are the default browser if:
- // - The user said "don't ask me again" on the infobar earlier.
// - There is a policy in control of this setting.
+ // We check if we are the default browser but do not prompt if:
+ // - The user said "don't ask me again" on the infobar earlier.
// - The "suppress_default_browser_prompt_for_version" master preference is
// set to the current version.
- if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser))
- return;
+ bool show_prompt =
+ profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser);
if (g_browser_process->local_state()->IsManagedPreference(
prefs::kDefaultBrowserSettingEnabled)) {
@@ -248,12 +258,12 @@ void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type) {
if (disable_version.IsValid()) {
const chrome::VersionInfo version_info;
if (disable_version.Equals(Version(version_info.Version())))
- return;
+ show_prompt = false;
msw 2015/06/16 19:23:01 nit: show_prompt &= disable_version.Equals(Version
grt (UTC plus 2) 2015/06/16 19:31:53 I don't like that pattern since it's using a bitwi
}
content::BrowserThread::PostTask(
content::BrowserThread::FILE, FROM_HERE,
- base::Bind(&CheckDefaultBrowserCallback, desktop_type));
+ base::Bind(&CheckDefaultBrowserCallback, show_prompt, desktop_type));
}
#if !defined(OS_WIN)
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/browser_options_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698