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

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

Issue 981623003: Plugin Power Saver: Implement srcset syntax for posters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 375c3da5e934246d9157761de07e99cb7c93cd51..78c69202c367092f6e3dbe24eac93b2ca8af7fe8 100644
--- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc
@@ -56,12 +56,13 @@ ChromePluginPlaceholder::ChromePluginPlaceholder(
blink::WebLocalFrame* frame,
const blink::WebPluginParams& params,
const std::string& html_data,
- const base::string16& title)
+ const base::string16& title,
+ const GURL& placeholder_url)
: plugins::LoadablePluginPlaceholder(render_frame,
frame,
params,
html_data,
- GURL(kPluginPlaceholderDataURL)),
+ placeholder_url),
status_(new ChromeViewHostMsg_GetPluginInfo_Status),
title_(title),
#if defined(ENABLE_PLUGIN_INSTALLATION)
@@ -109,7 +110,8 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateMissingPlugin(
// |missing_plugin| will destroy itself when its WebViewPlugin is going away.
ChromePluginPlaceholder* missing_plugin = new ChromePluginPlaceholder(
- render_frame, frame, params, html_data, params.mimeType);
+ render_frame, frame, params, html_data, params.mimeType,
+ GURL(kPluginPlaceholderDataURL));
missing_plugin->set_allow_loading(true);
#if defined(ENABLE_PLUGIN_INSTALLATION)
RenderThread::Get()->Send(
@@ -136,7 +138,8 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateErrorPlugin(
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);
+ render_frame, NULL, params, html_data, params.mimeType,
+ GURL(kPluginPlaceholderDataURL));
RenderThread::Get()->Send(new ChromeViewHostMsg_CouldNotLoadPlugin(
plugin->routing_id(), file_path));
@@ -153,14 +156,15 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin(
const base::string16& name,
int template_id,
const base::string16& message,
- const GURL& poster_url) {
+ const std::string& poster_attribute,
+ const GURL& placeholder_url) {
base::DictionaryValue values;
values.SetString("message", message);
values.SetString("name", name);
values.SetString("hide", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE));
- if (poster_url.is_valid())
- values.SetString("background", "url('" + poster_url.spec() + "')");
+ if (!poster_attribute.empty())
+ values.SetString("poster", poster_attribute);
const base::StringPiece template_html(
ResourceBundle::GetSharedInstance().GetRawDataResource(template_id));
@@ -171,10 +175,12 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin(
// |blocked_plugin| will destroy itself when its WebViewPlugin is going away.
ChromePluginPlaceholder* blocked_plugin = new ChromePluginPlaceholder(
- render_frame, frame, params, html_data, name);
+ render_frame, frame, params, html_data, name,
+ placeholder_url.is_valid() ? placeholder_url
tommycli 2015/03/04 19:55:17 Needs some security scrutiny: In order to allow r
Bernhard Bauer 2015/03/05 09:12:51 Could you just set a <base> tag in the header? Tha
tommycli 2015/03/05 19:49:12 That totally worked! You guys are smarter than me!
+ : GURL(kPluginPlaceholderDataURL));
#if defined(ENABLE_PLUGINS)
- if (poster_url.is_valid())
+ if (!poster_attribute.empty())
blocked_plugin->BlockForPowerSaverPoster();
#endif
blocked_plugin->SetPluginInfo(info);

Powered by Google App Engine
This is Rietveld 408576698