| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/plugin_utils.h" | 5 #include "chrome/browser/plugins/plugin_utils.h" |
| 6 | 6 |
| 7 #include "base/values.h" | 7 #include "base/values.h" |
| 8 #include "chrome/browser/ui/webui/site_settings_helper.h" | |
| 9 #include "chrome/common/chrome_features.h" | 8 #include "chrome/common/chrome_features.h" |
| 10 #include "chrome/common/plugin_utils.h" | 9 #include "chrome/common/plugin_utils.h" |
| 11 #include "components/content_settings/core/browser/host_content_settings_map.h" | 10 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 12 #include "components/content_settings/core/common/content_settings_types.h" | 11 #include "components/content_settings/core/common/content_settings_types.h" |
| 13 #include "content/public/common/webplugininfo.h" | 12 #include "content/public/common/webplugininfo.h" |
| 14 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 15 #include "url/origin.h" | 14 #include "url/origin.h" |
| 16 | 15 |
| 17 namespace { | 16 namespace { |
| 18 | 17 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 GetPluginContentSettingInternal(host_content_settings_map, | 105 GetPluginContentSettingInternal(host_content_settings_map, |
| 107 false /* use_javascript_setting */, | 106 false /* use_javascript_setting */, |
| 108 main_frame_origin, plugin_url, kFlashPluginID, | 107 main_frame_origin, plugin_url, kFlashPluginID, |
| 109 &plugin_setting, nullptr, is_managed); | 108 &plugin_setting, nullptr, is_managed); |
| 110 return plugin_setting; | 109 return plugin_setting; |
| 111 } | 110 } |
| 112 | 111 |
| 113 // static | 112 // static |
| 114 bool PluginUtils::ShouldPreferHtmlOverPlugins( | 113 bool PluginUtils::ShouldPreferHtmlOverPlugins( |
| 115 const HostContentSettingsMap* host_content_settings_map) { | 114 const HostContentSettingsMap* host_content_settings_map) { |
| 116 std::string provider_id; | |
| 117 ContentSetting default_setting = | |
| 118 host_content_settings_map->GetDefaultContentSetting( | |
| 119 CONTENT_SETTINGS_TYPE_PLUGINS, &provider_id); | |
| 120 ALLOW_UNUSED_LOCAL(default_setting); | |
| 121 | |
| 122 // Working around a policy issue - do not allow PreferHtml if there is any | |
| 123 // policy for the plugin default setting. crbug.com/654072. | |
| 124 if (provider_id == site_settings::kPolicyProviderId) | |
| 125 return false; | |
| 126 | |
| 127 // Fine. No policy interferes. | |
| 128 return base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins); | 115 return base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins); |
| 129 } | 116 } |
| OLD | NEW |