diff options
-rw-r--r-- | chrome/browser/renderer_host/plugin_info_message_filter.cc | 39 | ||||
-rw-r--r-- | chrome/common/attrition_experiments.h | 11 | ||||
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 50 |
3 files changed, 93 insertions, 7 deletions
diff --git a/chrome/browser/renderer_host/plugin_info_message_filter.cc b/chrome/browser/renderer_host/plugin_info_message_filter.cc index 31770be..11864a7 100644 --- a/chrome/browser/renderer_host/plugin_info_message_filter.cc +++ b/chrome/browser/renderer_host/plugin_info_message_filter.cc @@ -26,8 +26,45 @@ #include "chrome/browser/plugin_installer.h" #endif +#if defined(OS_WIN) +// These includes are only necessary for the PluginInfobarExperiment. +#include "chrome/common/attrition_experiments.h" +#include "chrome/installer/util/google_update_settings.h" +#endif + using content::PluginService; +namespace { + +// Override the behavior of the security infobars for plugins. Only +// operational on windows and only for a small slice of the of the +// UMA opted-in population. +void PluginInfobarExperiment(bool* allow_outdated, + bool* always_authorize) { +#if !defined(OS_WIN) + return; +#else + std::wstring client_value; + if (!GoogleUpdateSettings::GetClient(&client_value)) + return; + if (client_value == attrition_experiments::kPluginNoBlockNoOOD) { + *always_authorize = true; + *allow_outdated = true; + } else if (client_value == attrition_experiments::kPluginNoBlockDoOOD) { + *always_authorize = true; + *allow_outdated = false; + } else if (client_value == attrition_experiments::kPluginDoBlockNoOOD) { + *always_authorize = false; + *allow_outdated = true; + } else if (client_value == attrition_experiments::kPluginDoBlockDoOOD) { + *always_authorize = false; + *allow_outdated = false; + } +#endif +} + +} // namespace + PluginInfoMessageFilter::Context::Context(int render_process_id, Profile* profile) : render_process_id_(render_process_id), @@ -161,6 +198,8 @@ void PluginInfoMessageFilter::Context::DecidePluginStatus( bool allow_outdated = allow_outdated_plugins_.GetValue(); bool always_authorize = always_authorize_plugins_.GetValue(); + PluginInfobarExperiment(&allow_outdated, &always_authorize); + // Check if the plug-in is outdated. if (group->IsVulnerable(plugin) && !allow_outdated) { if (allow_outdated_plugins_.IsManaged()) { diff --git a/chrome/common/attrition_experiments.h b/chrome/common/attrition_experiments.h index 2cbe511..8de75f8 100644 --- a/chrome/common/attrition_experiments.h +++ b/chrome/common/attrition_experiments.h @@ -32,6 +32,17 @@ const wchar_t kEnterprise[] = L"GGRV"; // The brand code for showing more compact bubbles (experimental). const wchar_t kBrief[] = L"CHMA"; +// Constants for the "infobar plugins" experiment. These strings become +// the registry omaha |client| value. The last one is considered to be +// the control group which reflects the current behavior. Note that +// DoInfobarPluginsExperiment() relies on the prefix being PI, so if you +// change the prefix you need to fix that function. +const wchar_t kPluginNoBlockNoOOD[] = L"PI01"; +const wchar_t kPluginNoBlockDoOOD[] = L"PI02"; +const wchar_t kPluginDoBlockNoOOD[] = L"PI04"; +const wchar_t kPluginDoBlockDoOOD[] = L"PI08"; +const wchar_t kNotInPluginExperiment[] = L"PI20"; + } // namespace #endif // CHROME_COMMON_ATTRITION_EXPERIMENTS_H_ diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index 118a283..e51e68f 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -279,6 +279,40 @@ bool LaunchSetupAsConsoleUser(const FilePath& setup_path, return launched; } +// The plugin infobar experiment is just setting the client registry value +// to one of four possible values from 10% of the elegible population, which +// is defined as active users that have opted-in for sending stats. +// Chrome reads this value and modifies the plugin blocking and infobar +// behavior accordingly. +bool DoInfobarPluginsExperiment(int dir_age_hours) { + std::wstring client; + if (!GoogleUpdateSettings::GetClient(&client)) + return false; + // Make sure the user is not already in this experiment. + if ((client.size() > 3) && (client[0] == L'P') && (client[1] == L'I')) + return false; + if (!GoogleUpdateSettings::GetCollectStatsConsent()) + return false; + if (dir_age_hours > (24 * 14)) + return false; + if (base::RandInt(0, 9)) { + GoogleUpdateSettings::SetClient( + attrition_experiments::kNotInPluginExperiment); + return false; + } + + const wchar_t* buckets[] = { + attrition_experiments::kPluginNoBlockNoOOD, + attrition_experiments::kPluginNoBlockDoOOD, + attrition_experiments::kPluginDoBlockNoOOD, + attrition_experiments::kPluginDoBlockDoOOD + }; + + size_t group = base::RandInt(0, arraysize(buckets)-1); + GoogleUpdateSettings::SetClient(buckets[group]); + VLOG(1) << "Plugin infobar experiment group: " << group; + return true; +} } // namespace GoogleChromeDistribution::GoogleChromeDistribution() @@ -673,9 +707,9 @@ bool GoogleChromeDistribution::GetExperimentDetails( return false; } -// Currently we only have one experiment: the inactive user toast. Which only -// applies for users doing upgrades. - +// Currently we have two experiments: 1) The inactive user toast. Which only +// applies to users doing upgrades, and 2) The plugin infobar experiment +// which only applies for active users. // // There are three scenarios when this function is called: // 1- Is a per-user-install and it updated: perform the experiment @@ -724,13 +758,16 @@ void GoogleChromeDistribution::LaunchUserExperiment( // chrome user data directory. FilePath user_data_dir(product.GetUserDataPath()); - const bool experiment_enabled = false; + const bool toast_experiment_enabled = false; const int kThirtyDays = 30 * 24; int dir_age_hours = GetDirectoryWriteAgeInHours( user_data_dir.value().c_str()); - if (!experiment_enabled) { - VLOG(1) << "Toast experiment is disabled."; + if (!toast_experiment_enabled) { + // Ok, no toast, but what about the plugin infobar experiment? + if (!DoInfobarPluginsExperiment(dir_age_hours)) { + VLOG(1) << "No infobar experiment"; + } return; } else if (dir_age_hours < 0) { // This means that we failed to find the user data dir. The most likely @@ -739,7 +776,6 @@ void GoogleChromeDistribution::LaunchUserExperiment( SetClient(base_group + kToastUDDirFailure, true); return; } else if (dir_age_hours < kThirtyDays) { - // An active user, so it does not qualify. VLOG(1) << "Chrome used in last " << dir_age_hours << " hours"; SetClient(base_group + kToastActiveGroup, true); return; |