| Index: chrome/browser/plugins/plugins_field_trial.cc
|
| diff --git a/chrome/browser/plugins/plugins_field_trial.cc b/chrome/browser/plugins/plugins_field_trial.cc
|
| index 68d3d957432c554b800687e63d6a6b089bdb82cd..3dc9e27f50248d2c5c2221ec4ffdcfa0e47c480f 100644
|
| --- a/chrome/browser/plugins/plugins_field_trial.cc
|
| +++ b/chrome/browser/plugins/plugins_field_trial.cc
|
| @@ -5,7 +5,33 @@
|
| #include "chrome/browser/plugins/plugins_field_trial.h"
|
|
|
| #include "base/feature_list.h"
|
| +#include "base/strings/string_number_conversions.h"
|
| +#include "chrome/browser/engagement/site_engagement_service.h"
|
| #include "chrome/common/chrome_features.h"
|
| +#include "components/content_settings/core/browser/host_content_settings_map.h"
|
| +#include "components/variations/variations_associated_data.h"
|
| +
|
| +namespace {
|
| +
|
| +// The default site engagement threshold to allow Flash to be presented as an
|
| +// available plugin.
|
| +const double kSiteEngagementThresholdForFlash = 1.0;
|
| +
|
| +double GetSiteEngagementThresholdForFlash() {
|
| + double threshold = -1;
|
| + std::string param = variations::GetVariationParamValueByFeature(
|
| + features::kPreferHtmlOverPlugins,
|
| + PluginsFieldTrial::kSiteEngagementThresholdForFlashKey);
|
| + if (base::StringToDouble(param, &threshold) && threshold >= 0)
|
| + return threshold;
|
| + return kSiteEngagementThresholdForFlash;
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +// static
|
| +const char* PluginsFieldTrial::kSiteEngagementThresholdForFlashKey =
|
| + "engagement_threshold_for_flash";
|
|
|
| // static
|
| ContentSetting PluginsFieldTrial::EffectiveContentSetting(
|
| @@ -22,3 +48,11 @@ ContentSetting PluginsFieldTrial::EffectiveContentSetting(
|
| ? ContentSetting::CONTENT_SETTING_DETECT_IMPORTANT_CONTENT
|
| : ContentSetting::CONTENT_SETTING_BLOCK;
|
| }
|
| +
|
| +// static
|
| +bool PluginsFieldTrial::HasSufficientEngagementForFlash(
|
| + HostContentSettingsMap* settings,
|
| + const GURL& url) {
|
| + return SiteEngagementService::GetScoreFromSettings(settings, url) >=
|
| + GetSiteEngagementThresholdForFlash();
|
| +}
|
|
|