Commit 5c97af5d authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

[flash] Update placeholder and infobar for deprecated plugin

This CL updates the plugin placeholder and infobar for deprecated
plugins.

https://screenshot.googleplex.com/7PpXfrtEqRsusG9.png

Bug: 1069833
Change-Id: Ie275afd376854a70b97dcba651aa70f8a57feb1e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2466353Reviewed-by: default avatarJoshua Pawlicki <waffles@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816804}
parent 22206a7c
......@@ -5110,6 +5110,9 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_PLUGIN_PREFER_HTML_BY_DEFAULT" desc="The placeholder text for a plugin with no fallback content when Prefer HTML5 By Default is on.">
Click to enable <ph name="PLUGIN_NAME">$1<ex>Flash</ex></ph>
</message>
<message name="IDS_PLUGIN_DEPRECATED" desc="The placeholder text for a deprecated plugin.">
<ph name="PLUGIN_NAME">$1<ex>Adobe Flash Player</ex></ph> is no longer supported
</message>
<!-- Session Crashed Infobar/Bubble-->
<message name="IDS_SESSION_CRASHED_BUBBLE_TITLE" desc="Title of the session crashed bubble view.">
......
1de6928dd25752b406fc66c84830054037834a1a
\ No newline at end of file
......@@ -233,6 +233,15 @@ void PluginInfoHostImpl::Context::DecidePluginStatus(
return;
}
// This block is separate from the outdated check, because the deprecated UI
// must take precedence over any content setting or HTML5 by Default.
#if BUILDFLAG(ENABLE_PLUGINS)
if (security_status == PluginMetadata::SECURITY_STATUS_DEPRECATED) {
*status = chrome::mojom::PluginStatus::kDeprecated;
return;
}
#endif
ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT;
bool uses_default_content_setting = true;
bool is_managed = false;
......
......@@ -123,8 +123,9 @@ base::string16 OutdatedPluginInfoBarDelegate::GetMessageText() const {
}
int OutdatedPluginInfoBarDelegate::GetButtons() const {
// Deprecated plugins cannot be run anymore, not even temporarily.
if (plugin_metadata_->plugin_is_deprecated())
return BUTTON_CANCEL;
return BUTTON_NONE;
return BUTTON_OK | BUTTON_CANCEL;
}
......
......@@ -100,11 +100,8 @@ bool PluginMetadata::ParseSecurityStatus(
PluginMetadata::SecurityStatus PluginMetadata::GetSecurityStatus(
const content::WebPluginInfo& plugin) const {
// Deprecated plugins should be treated as out-of-date by the renderer.
// The browser will show an infobar explaining that it is deprecated without
// the ability to update.
if (plugin_is_deprecated())
return SECURITY_STATUS_OUT_OF_DATE;
return SECURITY_STATUS_DEPRECATED;
if (versions_.empty()) {
// Unknown plugins require authorization.
......
......@@ -27,6 +27,9 @@ class PluginMetadata {
SECURITY_STATUS_OUT_OF_DATE,
SECURITY_STATUS_REQUIRES_AUTHORIZATION,
SECURITY_STATUS_FULLY_TRUSTED,
// Similar to SECURITY_STATUS_OUT_OF_DATE, but with no hope of updating and
// running. This is distinct to allow for separate UI treatment.
SECURITY_STATUS_DEPRECATED,
};
// Used by about:plugins to disable Reader plugin when internal PDF viewer is
......
......@@ -60,9 +60,6 @@ TEST(PluginMetadataTest, SecurityStatus) {
}
TEST(PluginMetadataTest, DeprecatedSecurityStatus) {
const PluginMetadata::SecurityStatus kOutOfDate =
PluginMetadata::SECURITY_STATUS_OUT_OF_DATE;
PluginMetadata plugin_metadata(
"claybrick-writer", base::ASCIIToUTF16("ClayBrick Writer"), true, GURL(),
GURL(), base::ASCIIToUTF16("ClayBrick"), std::string(),
......@@ -77,7 +74,10 @@ TEST(PluginMetadataTest, DeprecatedSecurityStatus) {
EXPECT_TRUE(plugin_metadata.plugin_is_deprecated());
// All versions should be considered out of date for deprecated plugins.
EXPECT_EQ(kOutOfDate, GetSecurityStatus(&plugin_metadata, "foo"));
EXPECT_EQ(kOutOfDate, GetSecurityStatus(&plugin_metadata, "0"));
EXPECT_EQ(kOutOfDate, GetSecurityStatus(&plugin_metadata, "1.2.3"));
EXPECT_EQ(PluginMetadata::SECURITY_STATUS_DEPRECATED,
GetSecurityStatus(&plugin_metadata, "foo"));
EXPECT_EQ(PluginMetadata::SECURITY_STATUS_DEPRECATED,
GetSecurityStatus(&plugin_metadata, "0"));
EXPECT_EQ(PluginMetadata::SECURITY_STATUS_DEPRECATED,
GetSecurityStatus(&plugin_metadata, "1.2.3"));
}
......@@ -54,6 +54,9 @@ enum PluginStatus {
kNotFound,
kOutdatedBlocked,
kOutdatedDisallowed,
// Similar to kOutdatedBlocked or kOutdatedDisallowed, but with no hope of
// updating and running. This is distinct to allow for separate UI treatment.
kDeprecated,
kPlayImportantContent,
kRestartRequired,
kUnauthorized,
......
......@@ -1019,6 +1019,19 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
l10n_util::GetStringFUTF16(IDS_PLUGIN_OUTDATED, group_name));
break;
}
case chrome::mojom::PluginStatus::kDeprecated: {
// kDeprecatedPlugins act similarly to kOutdatedBlocked ones, but do
// not allow for loading. They still show an infobar.
placeholder = create_blocked_plugin(
IDR_BLOCKED_PLUGIN_HTML,
l10n_util::GetStringFUTF16(IDS_PLUGIN_DEPRECATED, group_name));
mojo::AssociatedRemote<chrome::mojom::PluginHost> plugin_host;
render_frame->GetRemoteAssociatedInterfaces()->GetInterface(
plugin_host.BindNewEndpointAndPassReceiver());
plugin_host->BlockedOutdatedPlugin(placeholder->BindPluginRenderer(),
identifier);
break;
}
case chrome::mojom::PluginStatus::kUnauthorized: {
placeholder = create_blocked_plugin(
IDR_BLOCKED_PLUGIN_HTML,
......
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