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

Unified Diff: chrome/browser/shell_integration_win.cc

Issue 1571383004: New experiment without registry deletion (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2564
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/shell_integration_win.cc
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 2738bb2a0104bde30a672b1bf6f4dcaaa5c6098f..25006cc7430525531cb14f5351acd76ddfbcc792 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);
}
bool RegisterBrowser() {
@@ -723,7 +743,8 @@ bool ShellIntegration::DefaultBrowserWorker::SetAsDefaultBrowserAsynchronous() {
if (!RegisterBrowser())
return false;
- ResetDefaultBrowser();
+ if (ShouldResetDefaultBrowser())
+ ResetDefaultBrowser();
base::CommandLine cmdline(base::FilePath(L"openwith.exe"));
cmdline.AppendArgNative(StartupBrowserCreator::GetDefaultBrowserUrl());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698