Commit b50430d7 authored by Tommy C. Li's avatar Tommy C. Li Committed by Commit Bot

Plugins: Allow Flash to run inside extensions.

 1. Allows Flash to be loaded inside extensions.
 2. Makes the "Plugin Blocked" content setting popup use the same
    content setting fetching logic as the actual plugin loading.

Bug: 822102
Change-Id: If2bdd226d7923bfe7251a5db378106a0a55abcc1
Reviewed-on: https://chromium-review.googlesource.com/969074
Commit-Queue: Tommy Li <tommycli@chromium.org>
Reviewed-by: default avatarRaymes Khoury <raymes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544913}
parent a37b38ca
...@@ -310,6 +310,23 @@ TEST_F(PluginInfoHostImplTest, RunAllFlashInAllowMode) { ...@@ -310,6 +310,23 @@ TEST_F(PluginInfoHostImplTest, RunAllFlashInAllowMode) {
EXPECT_THAT(status, Eq(chrome::mojom::PluginStatus::kAllowed)); EXPECT_THAT(status, Eq(chrome::mojom::PluginStatus::kAllowed));
} }
TEST_F(PluginInfoHostImplTest, PluginsAllowedInWhitelistedSchemes) {
VerifyPluginContentSetting(GURL("http://example.com"), "foo",
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, true,
false);
VerifyPluginContentSetting(GURL("https://example.com"), "foo",
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, true,
false);
VerifyPluginContentSetting(GURL("file://foobar/"), "foo",
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, true,
false);
VerifyPluginContentSetting(GURL("chrome-extension://extension-id"), "foo",
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, true,
false);
VerifyPluginContentSetting(GURL("unknown-scheme://foobar"), "foo",
CONTENT_SETTING_BLOCK, true, false);
}
TEST_F(PluginInfoHostImplTest, GetPluginContentSetting) { TEST_F(PluginInfoHostImplTest, GetPluginContentSetting) {
HostContentSettingsMap* map = HostContentSettingsMap* map =
HostContentSettingsMapFactory::GetForProfile(profile()); HostContentSettingsMapFactory::GetForProfile(profile());
......
...@@ -86,11 +86,12 @@ void GetPluginContentSettingInternal( ...@@ -86,11 +86,12 @@ void GetPluginContentSettingInternal(
*setting = CONTENT_SETTING_DETECT_IMPORTANT_CONTENT; *setting = CONTENT_SETTING_DETECT_IMPORTANT_CONTENT;
// Unless the setting is explicitly ALLOW, return BLOCK for any scheme that // Unless the setting is explicitly ALLOW, return BLOCK for any scheme that
// is not HTTP, HTTPS, or FILE. // is not HTTP, HTTPS, FILE, or chrome-extension.
if (*setting != CONTENT_SETTING_ALLOW && if (*setting != CONTENT_SETTING_ALLOW &&
PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map) && PluginUtils::ShouldPreferHtmlOverPlugins(host_content_settings_map) &&
!main_frame_url.SchemeIsHTTPOrHTTPS() && !main_frame_url.SchemeIsHTTPOrHTTPS() &&
!main_frame_url.SchemeIsFile()) { !main_frame_url.SchemeIsFile() &&
!main_frame_url.SchemeIs(extensions::kExtensionScheme)) {
*setting = CONTENT_SETTING_BLOCK; *setting = CONTENT_SETTING_BLOCK;
} }
} }
......
...@@ -672,7 +672,8 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel( ...@@ -672,7 +672,8 @@ ContentSettingPluginBubbleModel::ContentSettingPluginBubbleModel(
GURL url = web_contents->GetURL(); GURL url = web_contents->GetURL();
std::unique_ptr<base::Value> value = std::unique_ptr<base::Value> value =
map->GetWebsiteSetting(url, url, content_type(), std::string(), &info); map->GetWebsiteSetting(url, url, content_type(), std::string(), &info);
ContentSetting setting = content_settings::ValueToContentSetting(value.get()); ContentSetting setting = PluginUtils::GetFlashPluginContentSetting(
map, url::Origin::Create(url), url, nullptr);
// If the setting is not managed by the user, hide the "Manage" button. // If the setting is not managed by the user, hide the "Manage" button.
if (info.source != SETTING_SOURCE_USER) if (info.source != SETTING_SOURCE_USER)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment