Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7268)

Unified Diff: chrome/renderer/plugins/chrome_plugin_placeholder.cc

Issue 1126073003: Plugin Placeholders: Refactor for platforms that don't support plugins (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: The version that was reverted. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/plugins/chrome_plugin_placeholder.cc
diff --git a/chrome/renderer/plugins/chrome_plugin_placeholder.cc b/chrome/renderer/plugins/chrome_plugin_placeholder.cc
index 402bfb6f3e87fa1701962e94f540962cd2ba6d6e..3e5fbab6a325a81984786354c77262df8b994a28 100644
--- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc
@@ -16,7 +16,6 @@
#include "chrome/renderer/plugins/plugin_preroller.h"
#include "chrome/renderer/plugins/plugin_uma.h"
#include "components/content_settings/content/common/content_settings_messages.h"
-#include "content/app/strings/grit/content_strings.h"
#include "content/public/common/context_menu_params.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h"
@@ -48,11 +47,6 @@ namespace {
const plugins::PluginPlaceholder* g_last_active_menu = NULL;
} // namespace
-// The placeholder is loaded in normal web renderer processes, so it should not
-// have a chrome:// scheme that might let it be confused with a WebUI page.
-const char ChromePluginPlaceholder::kPluginPlaceholderDataURL[] =
- "data:text/html,pluginplaceholderdata";
-
ChromePluginPlaceholder::ChromePluginPlaceholder(
content::RenderFrame* render_frame,
blink::WebLocalFrame* frame,
@@ -62,8 +56,7 @@ ChromePluginPlaceholder::ChromePluginPlaceholder(
: plugins::LoadablePluginPlaceholder(render_frame,
frame,
params,
- html_data,
- GURL(kPluginPlaceholderDataURL)),
+ html_data),
status_(ChromeViewHostMsg_GetPluginInfo_Status::kAllowed),
title_(title),
#if defined(ENABLE_PLUGIN_INSTALLATION)
@@ -91,7 +84,7 @@ ChromePluginPlaceholder::~ChromePluginPlaceholder() {
}
// static
-ChromePluginPlaceholder* ChromePluginPlaceholder::CreateMissingPlugin(
+ChromePluginPlaceholder* ChromePluginPlaceholder::CreateLoadableMissingPlugin(
content::RenderFrame* render_frame,
WebLocalFrame* frame,
const WebPluginParams& params) {
@@ -105,34 +98,9 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateMissingPlugin(
std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
- // |missing_plugin| will destroy itself when its WebViewPlugin is going away.
- ChromePluginPlaceholder* missing_plugin = new ChromePluginPlaceholder(
- render_frame, frame, params, html_data, params.mimeType);
- missing_plugin->set_allow_loading(true);
- return missing_plugin;
-}
-
-// static
-ChromePluginPlaceholder* ChromePluginPlaceholder::CreateErrorPlugin(
- content::RenderFrame* render_frame,
- const base::FilePath& file_path) {
- base::DictionaryValue values;
- values.SetString("message",
- l10n_util::GetStringUTF8(IDS_PLUGIN_INITIALIZATION_ERROR));
-
- const base::StringPiece template_html(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- IDR_BLOCKED_PLUGIN_HTML));
- std::string html_data = webui::GetI18nTemplateHtml(template_html, &values);
-
- WebPluginParams params;
- // |missing_plugin| will destroy itself when its WebViewPlugin is going away.
- ChromePluginPlaceholder* plugin = new ChromePluginPlaceholder(
- render_frame, NULL, params, html_data, params.mimeType);
-
- RenderThread::Get()->Send(new ChromeViewHostMsg_CouldNotLoadPlugin(
- plugin->routing_id(), file_path));
- return plugin;
+ // Will destroy itself when its WebViewPlugin is going away.
+ return new ChromePluginPlaceholder(render_frame, frame, params, html_data,
+ params.mimeType);
}
// static
@@ -176,10 +144,8 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin(
ChromePluginPlaceholder* blocked_plugin = new ChromePluginPlaceholder(
render_frame, frame, params, html_data, name);
-#if defined(ENABLE_PLUGINS)
if (!poster_info.poster_attribute.empty())
blocked_plugin->BlockForPowerSaverPoster();
-#endif
blocked_plugin->SetPluginInfo(info);
blocked_plugin->SetIdentifier(identifier);
return blocked_plugin;
@@ -305,10 +271,8 @@ void ChromePluginPlaceholder::OnMenuAction(int request_id, unsigned action) {
switch (action) {
case chrome::MENU_COMMAND_PLUGIN_RUN: {
RenderThread::Get()->RecordAction(UserMetricsAction("Plugin_Load_Menu"));
-#if defined(ENABLE_PLUGINS)
MarkPluginEssential(
content::PluginInstanceThrottler::UNTHROTTLE_METHOD_BY_CLICK);
-#endif
LoadPlugin();
break;
}
@@ -328,7 +292,6 @@ void ChromePluginPlaceholder::OnMenuClosed(int request_id) {
}
void ChromePluginPlaceholder::ShowContextMenu(const WebMouseEvent& event) {
-#if !defined(OS_ANDROID) // The context menu is not applicable on Android.
if (context_menu_request_id_)
return; // Don't allow nested context menu requests.
@@ -364,12 +327,10 @@ void ChromePluginPlaceholder::ShowContextMenu(const WebMouseEvent& event) {
context_menu_request_id_ = render_frame()->ShowContextMenu(this, params);
g_last_active_menu = this;
-#endif // OS_ANDROID
}
blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() {
scoped_ptr<content::PluginInstanceThrottler> throttler;
-#if defined(ENABLE_PLUGINS)
// If the plugin has already been marked essential in its placeholder form,
// we shouldn't create a new throttler and start the process all over again.
if (power_saver_enabled()) {
@@ -380,7 +341,6 @@ blink::WebPlugin* ChromePluginPlaceholder::CreatePlugin() {
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, title_),
throttler.get());
}
-#endif
return render_frame()->CreatePlugin(GetFrame(), GetPluginInfo(),
GetPluginParams(), throttler.Pass());
}
« no previous file with comments | « chrome/renderer/plugins/chrome_plugin_placeholder.h ('k') | chrome/renderer/plugins/non_loadable_plugin_placeholder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698