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

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

Issue 1528653002: Revert of 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;
33 } 32 }
34 33
35 namespace url { 34 namespace url {
36 class Origin; 35 class Origin;
37 } 36 }
38 37
39 namespace v8 { 38 namespace v8 {
40 template <typename T> class Local; 39 template <typename T> class Local;
41 class Context; 40 class Context;
42 class Isolate; 41 class Isolate;
43 } 42 }
44 43
45 namespace content { 44 namespace content {
46 class ContextMenuClient; 45 class ContextMenuClient;
47 class PluginInstanceThrottler; 46 class PluginInstanceThrottler;
48 class RenderView; 47 class RenderView;
49 class ServiceRegistry; 48 class ServiceRegistry;
50 struct ContextMenuParams; 49 struct ContextMenuParams;
51 struct WebPluginInfo; 50 struct WebPluginInfo;
52 struct WebPreferences; 51 struct WebPreferences;
53 52
54 // This interface wraps functionality, which is specific to frames, such as 53 // This interface wraps functionality, which is specific to frames, such as
55 // navigation. It provides communication with a corresponding RenderFrameHost 54 // navigation. It provides communication with a corresponding RenderFrameHost
56 // in the browser process. 55 // in the browser process.
57 class CONTENT_EXPORT RenderFrame : public IPC::Listener, 56 class CONTENT_EXPORT RenderFrame : public IPC::Listener,
58 public IPC::Sender { 57 public IPC::Sender {
59 public: 58 public:
60 // These numeric values are used in UMA logs; do not change them.
61 enum PeripheralContentStatus {
62 // Content is peripheral because it doesn't meet any of the below criteria.
63 CONTENT_STATUS_PERIPHERAL = 0,
64 // Content is essential because it's same-origin with the top-level frame.
65 CONTENT_STATUS_ESSENTIAL_SAME_ORIGIN = 1,
66 // Content is essential even though it's cross-origin, because it's large.
67 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_BIG = 2,
68 // Content is essential because there's large content from the same origin.
69 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_WHITELISTED = 3,
70 // Content is essential because it's tiny in size.
71 CONTENT_STATUS_ESSENTIAL_CROSS_ORIGIN_TINY = 4,
72 // Content is essential because it has an unknown size.
73 CONTENT_STATUS_ESSENTIAL_UNKNOWN_SIZE = 5,
74 // Must be last.
75 CONTENT_STATUS_NUM_ITEMS
76 };
77
78 // Returns the RenderFrame given a WebFrame. 59 // Returns the RenderFrame given a WebFrame.
79 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame); 60 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame);
80 61
81 // Returns the RenderFrame given a routing id. 62 // Returns the RenderFrame given a routing id.
82 static RenderFrame* FromRoutingID(int routing_id); 63 static RenderFrame* FromRoutingID(int routing_id);
83 64
84 // Returns the RenderView associated with this frame. 65 // Returns the RenderView associated with this frame.
85 virtual RenderView* GetRenderView() = 0; 66 virtual RenderView* GetRenderView() = 0;
86 67
87 // Get the routing ID of the frame. 68 // Get the routing ID of the frame.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 virtual ServiceRegistry* GetServiceRegistry() = 0; 124 virtual ServiceRegistry* GetServiceRegistry() = 0;
144 125
145 #if defined(ENABLE_PLUGINS) 126 #if defined(ENABLE_PLUGINS)
146 // Registers a plugin that has been marked peripheral. If the origin 127 // Registers a plugin that has been marked peripheral. If the origin
147 // whitelist is later updated and includes |content_origin|, then 128 // whitelist is later updated and includes |content_origin|, then
148 // |unthrottle_callback| will be called. 129 // |unthrottle_callback| will be called.
149 virtual void RegisterPeripheralPlugin( 130 virtual void RegisterPeripheralPlugin(
150 const url::Origin& content_origin, 131 const url::Origin& content_origin,
151 const base::Closure& unthrottle_callback) = 0; 132 const base::Closure& unthrottle_callback) = 0;
152 133
153 // Returns the peripheral content heuristic decision. 134 // Returns true if this plugin should have power saver enabled.
154 // 135 //
155 // Power Saver is enabled for plugin content that are cross-origin and 136 // Power Saver is enabled for plugin content that are cross-origin and
156 // heuristically determined to be not essential to the web page content. 137 // heuristically determined to be not essential to the web page content.
157 // 138 //
158 // Plugin content is defined to be cross-origin when the plugin source's 139 // Plugin content is defined to be cross-origin when the plugin source's
159 // origin differs from the top level frame's origin. For example: 140 // origin differs from the top level frame's origin. For example:
160 // - Cross-origin: a.com -> b.com/plugin.swf 141 // - Cross-origin: a.com -> b.com/plugin.swf
161 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf 142 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf
162 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf 143 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf
163 // 144 //
164 // |main_frame_origin| is the origin of the main frame. 145 // |main_frame_origin| is the origin of the main frame.
165 // 146 //
166 // |content_origin| is the origin of the plugin content. 147 // |content_origin| is the origin of the plugin content.
167 // 148 //
168 // |unobscured_size| are zoom and device scale independent logical pixels. 149 // |width| and |height| are zoom and device scale independent logical pixels.
169 virtual PeripheralContentStatus GetPeripheralContentStatus( 150 //
170 const url::Origin& main_frame_origin, 151 // |cross_origin_main_content| may be NULL. It is set to true if the
171 const url::Origin& content_origin, 152 // plugin content is cross-origin but still the "main attraction" of the page.
172 const gfx::Size& unobscured_size) const = 0; 153 virtual bool ShouldThrottleContent(const url::Origin& main_frame_origin,
154 const url::Origin& content_origin,
155 int width,
156 int height,
157 bool* cross_origin_main_content) const = 0;
173 158
174 // Whitelists a |content_origin| so its content will never be throttled in 159 // Whitelists a |content_origin| so its content will never be throttled in
175 // this RenderFrame. Whitelist is cleared by top level navigation. 160 // this RenderFrame. Whitelist is cleared by top level navigation.
176 virtual void WhitelistContentOrigin(const url::Origin& content_origin) = 0; 161 virtual void WhitelistContentOrigin(const url::Origin& content_origin) = 0;
177 #endif 162 #endif
178 163
179 // Returns true if this frame is a FTP directory listing. 164 // Returns true if this frame is a FTP directory listing.
180 virtual bool IsFTPDirectoryListing() = 0; 165 virtual bool IsFTPDirectoryListing() = 0;
181 166
182 // Attaches the browser plugin identified by |element_instance_id| to guest 167 // Attaches the browser plugin identified by |element_instance_id| to guest
(...skipping 29 matching lines...) Expand all
212 197
213 private: 198 private:
214 // This interface should only be implemented inside content. 199 // This interface should only be implemented inside content.
215 friend class RenderFrameImpl; 200 friend class RenderFrameImpl;
216 RenderFrame() {} 201 RenderFrame() {}
217 }; 202 };
218 203
219 } // namespace content 204 } // namespace content
220 205
221 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ 206 #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