Commit ba3b26e3 authored by Andy Paicu's avatar Andy Paicu Committed by Commit Bot

Disable flash by default for M76.

This sets the default flash content setting to block and enables an
already-prepared information banner that warns users who override the
setting that flash will stop being supported in December 2020.

Bug: 882276
Change-Id: Ifa27c0462abc1e17bb5309b8eea187997096aa9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1585882
Commit-Queue: Andy Paicu <andypaicu@chromium.org>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Reviewed-by: default avatarAnthony LaForge <laforge@chromium.org>
Reviewed-by: default avatarBalazs Engedy <engedy@chromium.org>
Reviewed-by: default avatarKamila Hasanbega <hkamila@google.com>
Cr-Commit-Position: refs/heads/master@{#655960}
parent 34d5f125
......@@ -228,7 +228,7 @@ TEST_F(HostContentSettingsMapTest, IndividualSettings) {
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_COOKIES, std::string()));
#if BUILDFLAG(ENABLE_PLUGINS)
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host, host, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
#endif
......@@ -633,24 +633,13 @@ TEST_F(HostContentSettingsMapTest, HostTrimEndingDotCheck) {
std::string()));
#if BUILDFLAG(ENABLE_PLUGINS)
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_PLUGINS,
std::string()));
host_ending_with_dot, host_ending_with_dot,
CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_PLUGINS,
std::string(), CONTENT_SETTING_DEFAULT);
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
host_ending_with_dot,
CONTENT_SETTINGS_TYPE_PLUGINS,
std::string()));
host_content_settings_map->SetContentSettingDefaultScope(
host_ending_with_dot, GURL(), CONTENT_SETTINGS_TYPE_PLUGINS,
std::string(), CONTENT_SETTING_BLOCK);
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetContentSetting(
host_ending_with_dot,
......@@ -1205,7 +1194,7 @@ TEST_F(HostContentSettingsMapTest, ManagedDefaultContentSetting) {
// Remove the preference to manage the default-content-setting for Plugins.
prefs->RemoveManagedPref(prefs::kManagedDefaultPluginsSetting);
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
EXPECT_EQ(CONTENT_SETTING_BLOCK,
host_content_settings_map->GetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, NULL));
#endif
......
......@@ -191,9 +191,9 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest {
EXPECT_EQ(CONTENT_SETTING_ALLOW,
map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_JAVASCRIPT, std::string()));
EXPECT_EQ(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_PLUGINS, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
map->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_PLUGINS,
std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_POPUPS, std::string()));
......
......@@ -7,11 +7,14 @@
#include "base/path_service.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/permissions/permissions_browsertest.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/permission_bubble/mock_permission_prompt_factory.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/content_switches.h"
......@@ -61,6 +64,24 @@ class FlashPermissionBrowserTest : public PermissionsBrowserTest {
switches::kOverridePluginPowerSaverForTesting, "never");
}
void SetUpOnMainThread() override {
PermissionsBrowserTest::SetUpOnMainThread();
// This browser test verifies the Flash permission prompt behavior. The
// permission prompt only appears when Flash permission is set to DETECT.
HostContentSettingsMapFactory::GetForProfile(browser()->profile())
->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT);
}
void TearDownOnMainThread() override {
HostContentSettingsMapFactory::GetForProfile(browser()->profile())
->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
CONTENT_SETTING_DEFAULT);
PermissionsBrowserTest::TearDownOnMainThread();
}
void TriggerPrompt() override {
if (prompt_factory()->response_type() ==
PermissionRequestManager::ACCEPT_ALL) {
......
......@@ -254,19 +254,20 @@ TEST_F(PluginInfoHostImplTest, PreferHtmlOverPlugins) {
PluginMetadata::SecurityStatus security_status =
PluginMetadata::SECURITY_STATUS_UP_TO_DATE;
context()->DecidePluginStatus(GURL(), main_frame_origin, plugin,
security_status, content::kFlashPluginName,
&status);
EXPECT_EQ(chrome::mojom::PluginStatus::kFlashHiddenPreferHtml, status);
EXPECT_EQ(chrome::mojom::PluginStatus::kBlockedNoLoading, status);
// Now block plugins.
// Now enable plugins.
host_content_settings_map()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_BLOCK);
CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_DETECT_IMPORTANT_CONTENT);
context()->DecidePluginStatus(GURL(), main_frame_origin, plugin,
security_status, content::kFlashPluginName,
&status);
EXPECT_EQ(chrome::mojom::PluginStatus::kBlockedNoLoading, status);
EXPECT_EQ(chrome::mojom::PluginStatus::kPlayImportantContent, status);
}
TEST_F(PluginInfoHostImplTest, RunAllFlashInAllowMode) {
......@@ -310,7 +311,10 @@ TEST_F(PluginInfoHostImplTest, RunAllFlashInAllowMode) {
EXPECT_THAT(status, Eq(chrome::mojom::PluginStatus::kAllowed));
}
TEST_F(PluginInfoHostImplTest, PluginsAllowedInWhitelistedSchemes) {
TEST_F(PluginInfoHostImplTest, PluginsOnlyAllowedInWhitelistedSchemes) {
host_content_settings_map()->SetDefaultContentSetting(
CONTENT_SETTINGS_TYPE_PLUGINS, CONTENT_SETTING_DETECT_IMPORTANT_CONTENT);
VerifyPluginContentSetting(GURL("http://example.com"), "foo",
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT, true,
false);
......@@ -329,17 +333,6 @@ TEST_F(PluginInfoHostImplTest, PluginsAllowedInWhitelistedSchemes) {
TEST_F(PluginInfoHostImplTest, GetPluginContentSetting) {
HostContentSettingsMap* map = host_content_settings_map();
{
bool is_managed = false;
EXPECT_EQ(
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
PluginUtils::UnsafeGetRawDefaultFlashContentSetting(map, &is_managed));
EXPECT_FALSE(is_managed);
}
// Block plugins by default.
map->SetDefaultContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS,
CONTENT_SETTING_BLOCK);
{
bool is_managed = false;
EXPECT_EQ(
......
......@@ -743,8 +743,8 @@ TEST_F(ContentSettingBubbleModelTest, Plugins) {
EXPECT_FALSE(bubble_content.title.empty());
ASSERT_EQ(0U, bubble_content.list_items.size());
EXPECT_EQ(0U, bubble_content.radio_group.radio_items.size());
EXPECT_FALSE(bubble_content.custom_link.empty());
EXPECT_TRUE(bubble_content.custom_link_enabled);
EXPECT_FALSE(bubble_content.custom_link_enabled);
EXPECT_TRUE(bubble_content.custom_link.empty());
EXPECT_FALSE(bubble_content.manage_text.empty());
EXPECT_TRUE(bubble_content.show_learn_more);
}
......
......@@ -328,7 +328,7 @@ TEST_F(PageInfoTest, OnPermissionsChanged) {
#if BUILDFLAG(ENABLE_PLUGINS)
setting = content_settings->GetContentSetting(
url(), url(), CONTENT_SETTINGS_TYPE_PLUGINS, std::string());
EXPECT_EQ(setting, CONTENT_SETTING_DETECT_IMPORTANT_CONTENT);
EXPECT_EQ(setting, CONTENT_SETTING_BLOCK);
#endif
setting = content_settings->GetContentSetting(
url(), url(), CONTENT_SETTINGS_TYPE_GEOLOCATION, std::string());
......
......@@ -510,7 +510,7 @@ const base::Feature kPrerenderFallbackToPreconnect{
// Show Flash deprecation warning to users who have manually enabled Flash.
// https://crbug.com/918428
const base::Feature kFlashDeprecationWarning{"FlashDeprecationWarning",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
......
......@@ -168,8 +168,7 @@ void ContentSettingsRegistry::Init() {
ContentSettingsInfo::PERSISTENT,
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
Register(CONTENT_SETTINGS_TYPE_PLUGINS, "plugins",
CONTENT_SETTING_DETECT_IMPORTANT_CONTENT,
Register(CONTENT_SETTINGS_TYPE_PLUGINS, "plugins", CONTENT_SETTING_BLOCK,
WebsiteSettingsInfo::SYNCABLE,
WhitelistedSchemes(kChromeUIScheme, kChromeDevToolsScheme),
ValidSettings(CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK,
......
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