Commit 901c1335 authored by Tommy Li's avatar Tommy Li Committed by Commit Bot

[flash] Restore the deprecated plugin placeholder for M88+

Since the actual Flash binary has been removed from Chrome, our old code
path to display the Flash is deprecated placeholder no longer works.

This CL adds an alternate code path that directly checks the requested
MIME type instead of looking for the plugin metadata (which is no
loaded since the plugin is missing).

This CL doesn't restore the infobar to show that Flash is deprecated
for M88+. That's working as intended.

TEST=I manually tested it on Linux with the official build.

Bug: 1069833
Change-Id: I4c1758c5c7d4ed2026c59ae1407689468d85c1bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2532862Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Commit-Queue: Tommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826465}
parent a4f57bf1
......@@ -788,9 +788,20 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
// OverrideCreatePlugin.
if (status == chrome::mojom::PluginStatus::kNotFound ||
orig_mime_type == content::kBrowserPluginMimeType) {
PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type, url);
// Flash has been thoroughly removed in M88+, so we need to have a special
// case here to display a deprecated message instead of a generic
// plugin-missing message.
if (orig_mime_type == "application/x-shockwave-flash" ||
orig_mime_type == "application/futuresplash") {
return NonLoadablePluginPlaceholder::CreateFlashDeprecatedPlaceholder(
render_frame, original_params)
->plugin();
} else {
PluginUMAReporter::GetInstance()->ReportPluginMissing(orig_mime_type,
url);
placeholder = ChromePluginPlaceholder::CreateLoadableMissingPlugin(
render_frame, original_params);
}
} else {
// TODO(bauerb): This should be in content/.
WebPluginParams params(original_params);
......
......@@ -5,8 +5,10 @@
#include "chrome/renderer/plugins/non_loadable_plugin_placeholder.h"
#include "base/files/file_path.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/plugin.mojom.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/renderer_resources.h"
#include "components/plugins/renderer/plugin_placeholder.h"
#include "components/strings/grit/components_strings.h"
......@@ -17,19 +19,19 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
// static
plugins::PluginPlaceholder*
NonLoadablePluginPlaceholder::CreateNotSupportedPlugin(
namespace {
plugins::PluginPlaceholder* CreateNonLoadablePlaceholderHelper(
content::RenderFrame* render_frame,
const blink::WebPluginParams& params) {
const blink::WebPluginParams& params,
const std::string& message) {
std::string template_html =
ui::ResourceBundle::GetSharedInstance().LoadDataResourceString(
IDR_BLOCKED_PLUGIN_HTML);
base::DictionaryValue values;
values.SetString("name", "");
values.SetString("message",
l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED));
values.SetString("message", message);
std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
......@@ -37,6 +39,28 @@ NonLoadablePluginPlaceholder::CreateNotSupportedPlugin(
return new plugins::PluginPlaceholder(render_frame, params, html_data);
}
} // namespace
// static
plugins::PluginPlaceholder*
NonLoadablePluginPlaceholder::CreateNotSupportedPlugin(
content::RenderFrame* render_frame,
const blink::WebPluginParams& params) {
return CreateNonLoadablePlaceholderHelper(
render_frame, params, l10n_util::GetStringUTF8(IDS_PLUGIN_NOT_SUPPORTED));
}
// static
plugins::PluginPlaceholder*
NonLoadablePluginPlaceholder::CreateFlashDeprecatedPlaceholder(
content::RenderFrame* render_frame,
const blink::WebPluginParams& params) {
return CreateNonLoadablePlaceholderHelper(
render_frame, params,
l10n_util::GetStringFUTF8(IDS_PLUGIN_DEPRECATED,
base::ASCIIToUTF16("Adobe Flash Player")));
}
// static
plugins::PluginPlaceholder* NonLoadablePluginPlaceholder::CreateErrorPlugin(
content::RenderFrame* render_frame,
......
......@@ -30,6 +30,10 @@ class NonLoadablePluginPlaceholder {
content::RenderFrame* render_frame,
const blink::WebPluginParams& params);
static plugins::PluginPlaceholder* CreateFlashDeprecatedPlaceholder(
content::RenderFrame* render_frame,
const blink::WebPluginParams& params);
static plugins::PluginPlaceholder* CreateErrorPlugin(
content::RenderFrame* render_frame,
const base::FilePath& file_path);
......
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