| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/plugins/plugins_field_trial.h" | 5 #include "chrome/browser/plugins/plugins_field_trial.h" |
| 6 | 6 |
| 7 #include "base/feature_list.h" | 7 #include "base/feature_list.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "chrome/common/chrome_features.h" | 9 #include "chrome/common/chrome_features.h" |
| 10 #include "components/variations/variations_associated_data.h" | 10 #include "components/variations/variations_associated_data.h" |
| 11 | 11 |
| 12 namespace { | 12 namespace { |
| 13 | 13 |
| 14 // The default site engagement threshold to allow Flash to be presented as an | 14 // The default site engagement threshold to allow Flash to be presented as an |
| 15 // available plugin. | 15 // available plugin. This value is not used for normal uses, but only for |
| 16 const double kSiteEngagementThresholdForFlash = 1.0; | 16 // developers / testers that don't have a field trial configuration. |
| 17 const double kDefaultSiteEngagementThresholdForFlash = 30.0; |
| 17 | 18 |
| 18 } // namespace | 19 } // namespace |
| 19 | 20 |
| 20 // static | 21 // static |
| 21 const char* PluginsFieldTrial::kSiteEngagementThresholdForFlashKey = | 22 const char* PluginsFieldTrial::kSiteEngagementThresholdForFlashKey = |
| 22 "engagement_threshold_for_flash"; | 23 "engagement_threshold_for_flash"; |
| 23 | 24 |
| 24 // static | 25 // static |
| 25 ContentSetting PluginsFieldTrial::EffectiveContentSetting( | 26 ContentSetting PluginsFieldTrial::EffectiveContentSetting( |
| 26 ContentSettingsType type, | 27 ContentSettingsType type, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 38 } | 39 } |
| 39 | 40 |
| 40 // static | 41 // static |
| 41 double PluginsFieldTrial::GetSiteEngagementThresholdForFlash() { | 42 double PluginsFieldTrial::GetSiteEngagementThresholdForFlash() { |
| 42 double threshold = -1; | 43 double threshold = -1; |
| 43 std::string param = variations::GetVariationParamValueByFeature( | 44 std::string param = variations::GetVariationParamValueByFeature( |
| 44 features::kPreferHtmlOverPlugins, | 45 features::kPreferHtmlOverPlugins, |
| 45 PluginsFieldTrial::kSiteEngagementThresholdForFlashKey); | 46 PluginsFieldTrial::kSiteEngagementThresholdForFlashKey); |
| 46 if (base::StringToDouble(param, &threshold) && threshold >= 0) | 47 if (base::StringToDouble(param, &threshold) && threshold >= 0) |
| 47 return threshold; | 48 return threshold; |
| 48 return kSiteEngagementThresholdForFlash; | 49 return kDefaultSiteEngagementThresholdForFlash; |
| 49 } | 50 } |
| OLD | NEW |