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

Unified Diff: content/renderer/pepper/plugin_power_saver_helper.h

Issue 904913003: Plugin Power Saver: Fix implicitly sized and below the fold plugins. (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: content/renderer/pepper/plugin_power_saver_helper.h
diff --git a/content/renderer/pepper/plugin_power_saver_helper.h b/content/renderer/pepper/plugin_power_saver_helper.h
index 67a9471adce033d4ebfcd36c2bded025fe85ec04..bc88cf5d04a735559fb2ad2d9351acfcd97d44b7 100644
--- a/content/renderer/pepper/plugin_power_saver_helper.h
+++ b/content/renderer/pepper/plugin_power_saver_helper.h
@@ -15,6 +15,7 @@
namespace blink {
struct WebPluginParams;
+struct WebRect;
}
namespace content {
@@ -27,10 +28,34 @@ class CONTENT_EXPORT PluginPowerSaverHelper : public RenderFrameObserver {
// See RenderFrame for documentation.
void RegisterPeripheralPlugin(const GURL& content_origin,
const base::Closure& unthrottle_callback);
- bool ShouldThrottleContent(const blink::WebPluginParams& params,
- const GURL& plugin_frame_url,
- GURL* poster_image,
+
+ // Returns true if this plugin should have power saver enabled.
+ //
+ // Power Saver is enabled for plugin content that are cross-origin and
+ // heuristically determined to be not essential to the web page content.
+ //
+ // Plugin content is defined to be cross-origin when the plugin source's
+ // origin differs from the top level frame's origin. For example:
+ // - Cross-origin: a.com -> b.com/plugin.swf
+ // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf
+ // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf
+ //
+ // |page_frame_url| is the URL of the frame containing the plugin, which may
+ // be different from the URL of the top level document.
+ //
+ // |poster_image| may be NULL. It is set to the absolute URL of the poster
+ // image if it exists and this method returns true. Otherwise, an empty GURL.
+ //
+ // |cross_origin_main_content| may be NULL. It is set to true if the
+ // plugin content is cross-origin but still the "main attraction" of the page.
+ bool ShouldThrottleContent(const GURL& content_origin,
+ const std::string& plugin_module_name,
+ int width,
+ int height,
bool* cross_origin_main_content) const;
+
+ // Whitelists a |content_origin| so its content will never be throttled in
+ // this RenderFrame. Whitelist is cleared by top level navigation.
void WhitelistContentOrigin(const GURL& content_origin);
private:

Powered by Google App Engine
This is Rietveld 408576698