diff options
author | scottmg <scottmg@chromium.org> | 2016-01-11 20:11:16 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-12 04:13:00 +0000 |
commit | 99985393d906a5364a43bca5855f189f2ac30bb0 (patch) | |
tree | 5c19a54856edcfb77a855038f94e001549046327 | |
parent | 9bb0e9e12ef9e59c77b4191616fde58bf7fcbe94 (diff) | |
download | chromium_src-99985393d906a5364a43bca5855f189f2ac30bb0.zip chromium_src-99985393d906a5364a43bca5855f189f2ac30bb0.tar.gz chromium_src-99985393d906a5364a43bca5855f189f2ac30bb0.tar.bz2 |
New experiment without registry deletion
Now requires the user to check "Always user this app".
BUG=576490
NOTRY=true
NOPRESUBMIT=true
Review URL: https://codereview.chromium.org/1575163002
Cr-Commit-Position: refs/heads/master@{#368774}
(cherry picked from commit 3d24f096b250b2364f75e6247e8a6d8ac7ec811b)
Review URL: https://codereview.chromium.org/1573123005
Cr-Commit-Position: refs/branch-heads/2526@{#544}
Cr-Branched-From: cb947c0153db0ec02a8abbcb3ca086d88bf6006f-refs/heads/master@{#352221}
-rw-r--r-- | chrome/browser/shell_integration_win.cc | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index c68dc17..27a66b3 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -53,6 +53,15 @@ namespace { const wchar_t kAppListAppNameSuffix[] = L"AppList"; const char kAsyncSetAsDefaultExperimentName[] = "AsyncSetAsDefault"; +// A prefix shared by multiple groups that kicks off the generic +// AsyncSetAsDefault experiment. +const char kAsyncSetAsDefaultExperimentEnabledGroupPrefix[] = "Enabled"; +// One of the group names for the AsyncSetAsDefault experiment. Unlike other +// "Enabled" groups, this group doesn't reset the current default browser choice +// in the registry. +const char kAsyncSetAsDefaultExperimentEnabledNoRegistryGroupName[] = + "EnabledNoRegistry"; + const char kEnableAsyncSetAsDefault[] = "enable-async-set-as-default"; const char kDisableAsyncSetAsDefault[] = "disable-async-set-as-default"; @@ -276,13 +285,24 @@ bool IsAsyncSetAsDefaultEnabled() { // Note: It's important to query the field trial state first, to ensure that // UMA reports the correct group. const std::string group_name = - base::FieldTrialList::FindFullName("AsyncSetAsDefault"); + base::FieldTrialList::FindFullName(kAsyncSetAsDefaultExperimentName); if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableAsyncSetAsDefault)) return false; if (CommandLine::ForCurrentProcess()->HasSwitch(kEnableAsyncSetAsDefault)) return true; - return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); + return base::StartsWith(group_name, + kAsyncSetAsDefaultExperimentEnabledGroupPrefix, + base::CompareCase::SENSITIVE); +} + +// Returns true if the default browser choice should be reset for the current +// user. +bool ShouldResetDefaultBrowser() { + return !base::StartsWith( + base::FieldTrialList::FindFullName(kAsyncSetAsDefaultExperimentName), + kAsyncSetAsDefaultExperimentEnabledNoRegistryGroupName, + base::CompareCase::SENSITIVE); } } // namespace @@ -719,7 +739,8 @@ void ShellIntegration::DefaultBrowserWorker::FinalizeSetAsDefault() { bool ShellIntegration::DefaultBrowserWorker::SetAsDefaultBrowserAsynchronous() { DCHECK(IsSetAsDefaultAsynchronous()); - ResetDefaultBrowser(); + if (ShouldResetDefaultBrowser()) + ResetDefaultBrowser(); base::CommandLine cmdline(base::FilePath(L"openwith.exe")); cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl()); |