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

Side by Side Diff: content/public/renderer/render_frame.h

Issue 1497623002: Plugin Power Saver: Improve Poster behavior for essential plugins. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ 5 #ifndef CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_
6 #define CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ 6 #define CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_
7 7
8 #include "base/callback_forward.h" 8 #include "base/callback_forward.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 11 matching lines...) Expand all
22 class WebLocalFrame; 22 class WebLocalFrame;
23 class WebNode; 23 class WebNode;
24 class WebPlugin; 24 class WebPlugin;
25 class WebURLRequest; 25 class WebURLRequest;
26 class WebURLResponse; 26 class WebURLResponse;
27 struct WebPluginParams; 27 struct WebPluginParams;
28 } 28 }
29 29
30 namespace gfx { 30 namespace gfx {
31 class Range; 31 class Range;
32 class Size;
32 } 33 }
33 34
34 namespace url { 35 namespace url {
35 class Origin; 36 class Origin;
36 } 37 }
37 38
38 namespace v8 { 39 namespace v8 {
39 template <typename T> class Local; 40 template <typename T> class Local;
40 class Context; 41 class Context;
41 class Isolate; 42 class Isolate;
42 } 43 }
43 44
44 namespace content { 45 namespace content {
45 class ContextMenuClient; 46 class ContextMenuClient;
46 class PluginInstanceThrottler; 47 class PluginInstanceThrottler;
47 class RenderView; 48 class RenderView;
48 class ServiceRegistry; 49 class ServiceRegistry;
49 struct ContextMenuParams; 50 struct ContextMenuParams;
50 struct WebPluginInfo; 51 struct WebPluginInfo;
51 struct WebPreferences; 52 struct WebPreferences;
52 53
53 // This interface wraps functionality, which is specific to frames, such as 54 // This interface wraps functionality, which is specific to frames, such as
54 // navigation. It provides communication with a corresponding RenderFrameHost 55 // navigation. It provides communication with a corresponding RenderFrameHost
55 // in the browser process. 56 // in the browser process.
56 class CONTENT_EXPORT RenderFrame : public IPC::Listener, 57 class CONTENT_EXPORT RenderFrame : public IPC::Listener,
57 public IPC::Sender { 58 public IPC::Sender {
58 public: 59 public:
60 // These numeric values are used in UMA logs; do not change them.
61 enum PeripheralContentStatus {
62 CONTENT_STATUS_PERIPHERAL = 0,
Lei Zhang 2015/12/10 23:22:56 Add some comments to describe what these are. Pret
tommycli 2015/12/10 23:30:32 Done.
63 CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN = 1,
64 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG = 2,
65 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED = 3,
66 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY = 4,
67 CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE = 5,
68 CONTENT_STATUS_NUM_ITEMS
Lei Zhang 2015/12/10 23:22:56 Add a comment saying "must be last"
tommycli 2015/12/10 23:30:32 Done.
69 };
70
59 // Returns the RenderFrame given a WebFrame. 71 // Returns the RenderFrame given a WebFrame.
60 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame); 72 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame);
61 73
62 // Returns the RenderFrame given a routing id. 74 // Returns the RenderFrame given a routing id.
63 static RenderFrame* FromRoutingID(int routing_id); 75 static RenderFrame* FromRoutingID(int routing_id);
64 76
65 // Returns the RenderView associated with this frame. 77 // Returns the RenderView associated with this frame.
66 virtual RenderView* GetRenderView() = 0; 78 virtual RenderView* GetRenderView() = 0;
67 79
68 // Get the routing ID of the frame. 80 // Get the routing ID of the frame.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 virtual ServiceRegistry* GetServiceRegistry() = 0; 136 virtual ServiceRegistry* GetServiceRegistry() = 0;
125 137
126 #if defined(ENABLE_PLUGINS) 138 #if defined(ENABLE_PLUGINS)
127 // Registers a plugin that has been marked peripheral. If the origin 139 // Registers a plugin that has been marked peripheral. If the origin
128 // whitelist is later updated and includes |content_origin|, then 140 // whitelist is later updated and includes |content_origin|, then
129 // |unthrottle_callback| will be called. 141 // |unthrottle_callback| will be called.
130 virtual void RegisterPeripheralPlugin( 142 virtual void RegisterPeripheralPlugin(
131 const url::Origin& content_origin, 143 const url::Origin& content_origin,
132 const base::Closure& unthrottle_callback) = 0; 144 const base::Closure& unthrottle_callback) = 0;
133 145
134 // Returns true if this plugin should have power saver enabled. 146 // Returns the peripheral content heuristic decision.
135 // 147 //
136 // Power Saver is enabled for plugin content that are cross-origin and 148 // Power Saver is enabled for plugin content that are cross-origin and
137 // heuristically determined to be not essential to the web page content. 149 // heuristically determined to be not essential to the web page content.
138 // 150 //
139 // Plugin content is defined to be cross-origin when the plugin source's 151 // Plugin content is defined to be cross-origin when the plugin source's
140 // origin differs from the top level frame's origin. For example: 152 // origin differs from the top level frame's origin. For example:
141 // - Cross-origin: a.com -> b.com/plugin.swf 153 // - Cross-origin: a.com -> b.com/plugin.swf
142 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf 154 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf
143 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf 155 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf
144 // 156 //
145 // |main_frame_origin| is the origin of the main frame. 157 // |main_frame_origin| is the origin of the main frame.
146 // 158 //
147 // |content_origin| is the origin of the plugin content. 159 // |content_origin| is the origin of the plugin content.
148 // 160 //
149 // |width| and |height| are zoom and device scale independent logical pixels. 161 // |unobscured_size| are zoom and device scale independent logical pixels.
150 // 162 virtual PeripheralContentStatus GetPeripheralContentStatus(
151 // |cross_origin_main_content| may be NULL. It is set to true if the 163 const url::Origin& main_frame_origin,
152 // plugin content is cross-origin but still the "main attraction" of the page. 164 const url::Origin& content_origin,
153 virtual bool ShouldThrottleContent(const url::Origin& main_frame_origin, 165 const gfx::Size& unobscured_size) const = 0;
154 const url::Origin& content_origin,
155 int width,
156 int height,
157 bool* cross_origin_main_content) const = 0;
158 166
159 // Whitelists a |content_origin| so its content will never be throttled in 167 // Whitelists a |content_origin| so its content will never be throttled in
160 // this RenderFrame. Whitelist is cleared by top level navigation. 168 // this RenderFrame. Whitelist is cleared by top level navigation.
161 virtual void WhitelistContentOrigin(const url::Origin& content_origin) = 0; 169 virtual void WhitelistContentOrigin(const url::Origin& content_origin) = 0;
162 #endif 170 #endif
163 171
164 // Returns true if this frame is a FTP directory listing. 172 // Returns true if this frame is a FTP directory listing.
165 virtual bool IsFTPDirectoryListing() = 0; 173 virtual bool IsFTPDirectoryListing() = 0;
166 174
167 // Attaches the browser plugin identified by |element_instance_id| to guest 175 // Attaches the browser plugin identified by |element_instance_id| to guest
(...skipping 29 matching lines...) Expand all
197 205
198 private: 206 private:
199 // This interface should only be implemented inside content. 207 // This interface should only be implemented inside content.
200 friend class RenderFrameImpl; 208 friend class RenderFrameImpl;
201 RenderFrame() {} 209 RenderFrame() {}
202 }; 210 };
203 211
204 } // namespace content 212 } // namespace content
205 213
206 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ 214 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_
OLDNEW
« no previous file with comments | « components/plugins/renderer/loadable_plugin_placeholder.cc ('k') | content/renderer/pepper/plugin_instance_throttler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698