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

Unified Diff: chrome/browser/plugins/plugin_utils.cc

Issue 2408613002: Replace kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… (Closed)
Patch Set: Replace remaining kPreferHtmlOverPlugins feature checks with PluginUtils::ShouldPreferHtmlOverPlugi… Created 4 years, 2 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 | « chrome/browser/plugins/plugin_utils.h ('k') | chrome/browser/plugins/plugins_field_trial.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/plugins/plugin_utils.cc
diff --git a/chrome/browser/plugins/plugin_utils.cc b/chrome/browser/plugins/plugin_utils.cc
index 2a21946c26d2769c5d4e9e859c8fb4a5675f905e..cb99e803b25638518f6b39fbbfbf57282a739b47 100644
--- a/chrome/browser/plugins/plugin_utils.cc
+++ b/chrome/browser/plugins/plugin_utils.cc
@@ -5,9 +5,11 @@
#include "chrome/browser/plugins/plugin_utils.h"
#include "base/values.h"
+#include "chrome/browser/ui/webui/site_settings_helper.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/plugin_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
+#include "components/content_settings/core/common/content_settings_types.h"
#include "content/public/common/webplugininfo.h"
#include "url/gurl.h"
#include "url/origin.h"
@@ -70,7 +72,7 @@ void GetPluginContentSettingInternal(
// For non-JavaScript treated plugins (Flash): unless the user has explicitly
// ALLOWed plugins, return BLOCK for any non-HTTP and non-FILE origin.
if (!use_javascript_setting && *setting != CONTENT_SETTING_ALLOW &&
- base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins) &&
+ PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map) &&
!main_frame_url.SchemeIsHTTPOrHTTPS() && !main_frame_url.SchemeIsFile()) {
*setting = CONTENT_SETTING_BLOCK;
}
@@ -107,3 +109,21 @@ ContentSetting PluginUtils::GetFlashPluginContentSetting(
&plugin_setting, nullptr, is_managed);
return plugin_setting;
}
+
+// static
+bool PluginUtils::ShouldPreferHtmlOverPlugins(
+ const HostContentSettingsMap* host_content_settings_map) {
+ std::string provider_id;
+ ContentSetting default_setting =
+ host_content_settings_map->GetDefaultContentSetting(
+ CONTENT_SETTINGS_TYPE_PLUGINS, &provider_id);
+ ALLOW_UNUSED_LOCAL(default_setting);
+
+ // Working around a policy issue - do not allow PreferHtml if there is any
+ // policy for the plugin default setting. crbug.com/654072.
+ if (provider_id == site_settings::kPolicyProviderId)
+ return false;
+
+ // Fine. No policy interferes.
+ return base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins);
+}
« no previous file with comments | « chrome/browser/plugins/plugin_utils.h ('k') | chrome/browser/plugins/plugins_field_trial.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698