diff options
author | tommycli <tommycli@chromium.org> | 2015-12-18 15:34:34 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-18 23:35:36 +0000 |
commit | 9c7cbd939c735a69c551cfbf397f6cf707f8d22e (patch) | |
tree | c206987dd649a0bef3815975d10c7079b822a1a0 /content/public/renderer | |
parent | 338e8f77bbd62098c8db8e59eba132ce39137be9 (diff) | |
download | chromium_src-9c7cbd939c735a69c551cfbf397f6cf707f8d22e.zip chromium_src-9c7cbd939c735a69c551cfbf397f6cf707f8d22e.tar.gz chromium_src-9c7cbd939c735a69c551cfbf397f6cf707f8d22e.tar.bz2 |
Reland: Plugin Power Saver: Improve Poster behavior for essential plugins.
Reland of https://codereview.chromium.org/1497623002/
TBR=
BUG=560590,569198
Review URL: https://codereview.chromium.org/1522173002
Cr-Commit-Position: refs/heads/master@{#366210}
Diffstat (limited to 'content/public/renderer')
-rw-r--r-- | content/public/renderer/render_frame.h | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/content/public/renderer/render_frame.h b/content/public/renderer/render_frame.h index 2011c4e..dc055ef 100644 --- a/content/public/renderer/render_frame.h +++ b/content/public/renderer/render_frame.h @@ -29,6 +29,7 @@ struct WebPluginParams; namespace gfx { class Range; +class Size; } namespace url { @@ -56,6 +57,24 @@ struct WebPreferences; class CONTENT_EXPORT RenderFrame : public IPC::Listener, public IPC::Sender { public: + // These numeric values are used in UMA logs; do not change them. + enum PeripheralContentStatus { + // Content is peripheral because it doesn't meet any of the below criteria. + CONTENT_STATUS_PERIPHERAL = 0, + // Content is essential because it's same-origin with the top-level frame. + CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN = 1, + // Content is essential even though it's cross-origin, because it's large. + CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG = 2, + // Content is essential because there's large content from the same origin. + CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED = 3, + // Content is essential because it's tiny in size. + CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY = 4, + // Content is essential because it has an unknown size. + CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE = 5, + // Must be last. + CONTENT_STATUS_NUM_ITEMS + }; + // Returns the RenderFrame given a WebFrame. static RenderFrame* FromWebFrame(blink::WebFrame* web_frame); @@ -131,7 +150,7 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener, const url::Origin& content_origin, const base::Closure& unthrottle_callback) = 0; - // Returns true if this plugin should have power saver enabled. + // Returns the peripheral content heuristic decision. // // Power Saver is enabled for plugin content that are cross-origin and // heuristically determined to be not essential to the web page content. @@ -146,15 +165,11 @@ class CONTENT_EXPORT RenderFrame : public IPC::Listener, // // |content_origin| is the origin of the plugin content. // - // |width| and |height| are zoom and device scale independent logical pixels. - // - // |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. - virtual bool ShouldThrottleContent(const url::Origin& main_frame_origin, - const url::Origin& content_origin, - int width, - int height, - bool* cross_origin_main_content) const = 0; + // |unobscured_size| are zoom and device scale independent logical pixels. + virtual PeripheralContentStatus GetPeripheralContentStatus( + const url::Origin& main_frame_origin, + const url::Origin& content_origin, + const gfx::Size& unobscured_size) const = 0; // Whitelists a |content_origin| so its content will never be throttled in // this RenderFrame. Whitelist is cleared by top level navigation. |