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

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

Issue 1015023002: Plugin Power Saver: Throttle 'large' plugins that appear small. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove keyframe size tracking. Unnecessary. Created 5 years, 9 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 c1788a3d2695e4085cdc40514894aea64a148b2c..c2ecfa10efe95ffab34d3ad03bd8d59faa090cf4 100644
--- a/chrome/renderer/plugins/chrome_plugin_placeholder.cc
+++ b/chrome/renderer/plugins/chrome_plugin_placeholder.cc
@@ -4,6 +4,7 @@
#include "chrome/renderer/plugins/chrome_plugin_placeholder.h"
+#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/prerender_messages.h"
@@ -27,6 +28,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
+#include "ui/gfx/geometry/size.h"
#include "url/url_util.h"
using base::UserMetricsAction;
@@ -144,7 +146,8 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin(
int template_id,
const base::string16& message,
const std::string& poster_attribute,
- const GURL& base_url) {
+ const GURL& base_url,
+ const gfx::Size& custom_poster_size) {
base::DictionaryValue values;
values.SetString("message", message);
values.SetString("name", name);
@@ -153,6 +156,13 @@ ChromePluginPlaceholder* ChromePluginPlaceholder::CreateBlockedPlugin(
if (!poster_attribute.empty()) {
values.SetString("poster", poster_attribute);
values.SetString("baseurl", base_url.spec());
+
+ if (!custom_poster_size.IsEmpty()) {
+ values.SetString("visibleWidth",
+ base::Int64ToString(custom_poster_size.width()) + "px");
+ values.SetString("visibleHeight",
+ base::Int64ToString(custom_poster_size.height()) + "px");
+ }
}
const base::StringPiece template_html(

Powered by Google App Engine
This is Rietveld 408576698