Chromium Code Reviews| Index: chrome/browser/shell_integration_win.cc |
| diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc |
| index 04bc80c220d314d2a3c7074f0c420cbde1eb233b..0744ed6ea6a98d748eb24f9b2d10d5fd1212ccd3 100644 |
| --- a/chrome/browser/shell_integration_win.cc |
| +++ b/chrome/browser/shell_integration_win.cc |
| @@ -56,6 +56,10 @@ namespace { |
| const wchar_t kAppListAppNameSuffix[] = L"AppList"; |
| const char kAsyncSetAsDefaultExperimentName[] = "AsyncSetAsDefault"; |
| +// One of the group name for the AsynSetAsDefault experiment. This group disable |
| +// the default browser choice reset for the async flow. The other enabled group |
| +// is "EnabledFull" where the default browser choice is reset. |
|
gab
2016/01/12 01:09:04
// One of the group names for the AsyncSetAsDefaul
Patrick Monette
2016/01/12 01:22:03
I like it.
|
| +const char kEnabledNoRegistryGroupName[] = "EnabledNoRegistry"; |
|
gab
2016/01/12 01:09:04
kAsyncSetAsDefaultExperimentEnabledNoRegistryGroup
gab
2016/01/12 01:09:04
Also add
// A prefix shared by multiple groups t
Patrick Monette
2016/01/12 01:22:03
Done.
|
| const char kEnableAsyncSetAsDefault[] = "enable-async-set-as-default"; |
| const char kDisableAsyncSetAsDefault[] = "disable-async-set-as-default"; |
| @@ -279,7 +283,7 @@ 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)) |
| @@ -300,6 +304,14 @@ bool RegisterBrowser() { |
| true); |
| } |
| +// Returns true if the default browser choice should be reset for the current |
| +// user. |
| +bool ShouldResetDefaultBrowser() { |
|
gab
2016/01/12 01:09:04
Put this below IsAsyncSetAsDefaultEnabled() to kee
Patrick Monette
2016/01/12 01:22:03
Done.
|
| + return !base::StartsWith( |
| + base::FieldTrialList::FindFullName(kAsyncSetAsDefaultExperimentName), |
| + kEnabledNoRegistryGroupName, base::CompareCase::SENSITIVE); |
| +} |
| + |
| } // namespace |
| // static |
| @@ -720,7 +732,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()); |