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) |