| OLD | NEW |
| 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 Loading... |
| 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 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 |
| 59 // Returns the RenderFrame given a WebFrame. | 78 // Returns the RenderFrame given a WebFrame. |
| 60 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame); | 79 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame); |
| 61 | 80 |
| 62 // Returns the RenderFrame given a routing id. | 81 // Returns the RenderFrame given a routing id. |
| 63 static RenderFrame* FromRoutingID(int routing_id); | 82 static RenderFrame* FromRoutingID(int routing_id); |
| 64 | 83 |
| 65 // Returns the RenderView associated with this frame. | 84 // Returns the RenderView associated with this frame. |
| 66 virtual RenderView* GetRenderView() = 0; | 85 virtual RenderView* GetRenderView() = 0; |
| 67 | 86 |
| 68 // Get the routing ID of the frame. | 87 // Get the routing ID of the frame. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 virtual ServiceRegistry* GetServiceRegistry() = 0; | 143 virtual ServiceRegistry* GetServiceRegistry() = 0; |
| 125 | 144 |
| 126 #if defined(ENABLE_PLUGINS) | 145 #if defined(ENABLE_PLUGINS) |
| 127 // Registers a plugin that has been marked peripheral. If the origin | 146 // Registers a plugin that has been marked peripheral. If the origin |
| 128 // whitelist is later updated and includes |content_origin|, then | 147 // whitelist is later updated and includes |content_origin|, then |
| 129 // |unthrottle_callback| will be called. | 148 // |unthrottle_callback| will be called. |
| 130 virtual void RegisterPeripheralPlugin( | 149 virtual void RegisterPeripheralPlugin( |
| 131 const url::Origin& content_origin, | 150 const url::Origin& content_origin, |
| 132 const base::Closure& unthrottle_callback) = 0; | 151 const base::Closure& unthrottle_callback) = 0; |
| 133 | 152 |
| 134 // Returns true if this plugin should have power saver enabled. | 153 // Returns the peripheral content heuristic decision. |
| 135 // | 154 // |
| 136 // Power Saver is enabled for plugin content that are cross-origin and | 155 // Power Saver is enabled for plugin content that are cross-origin and |
| 137 // heuristically determined to be not essential to the web page content. | 156 // heuristically determined to be not essential to the web page content. |
| 138 // | 157 // |
| 139 // Plugin content is defined to be cross-origin when the plugin source's | 158 // 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: | 159 // origin differs from the top level frame's origin. For example: |
| 141 // - Cross-origin: a.com -> b.com/plugin.swf | 160 // - Cross-origin: a.com -> b.com/plugin.swf |
| 142 // - Cross-origin: a.com -> b.com/iframe.html -> b.com/plugin.swf | 161 // - 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 | 162 // - Same-origin: a.com -> b.com/iframe-to-a.html -> a.com/plugin.swf |
| 144 // | 163 // |
| 145 // |main_frame_origin| is the origin of the main frame. | 164 // |main_frame_origin| is the origin of the main frame. |
| 146 // | 165 // |
| 147 // |content_origin| is the origin of the plugin content. | 166 // |content_origin| is the origin of the plugin content. |
| 148 // | 167 // |
| 149 // |width| and |height| are zoom and device scale independent logical pixels. | 168 // |unobscured_size| are zoom and device scale independent logical pixels. |
| 150 // | 169 virtual PeripheralContentStatus GetPeripheralContentStatus( |
| 151 // |cross_origin_main_content| may be NULL. It is set to true if the | 170 const url::Origin& main_frame_origin, |
| 152 // plugin content is cross-origin but still the "main attraction" of the page. | 171 const url::Origin& content_origin, |
| 153 virtual bool ShouldThrottleContent(const url::Origin& main_frame_origin, | 172 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 | 173 |
| 159 // Whitelists a |content_origin| so its content will never be throttled in | 174 // Whitelists a |content_origin| so its content will never be throttled in |
| 160 // this RenderFrame. Whitelist is cleared by top level navigation. | 175 // this RenderFrame. Whitelist is cleared by top level navigation. |
| 161 virtual void WhitelistContentOrigin(const url::Origin& content_origin) = 0; | 176 virtual void WhitelistContentOrigin(const url::Origin& content_origin) = 0; |
| 162 #endif | 177 #endif |
| 163 | 178 |
| 164 // Returns true if this frame is a FTP directory listing. | 179 // Returns true if this frame is a FTP directory listing. |
| 165 virtual bool IsFTPDirectoryListing() = 0; | 180 virtual bool IsFTPDirectoryListing() = 0; |
| 166 | 181 |
| 167 // Attaches the browser plugin identified by |element_instance_id| to guest | 182 // Attaches the browser plugin identified by |element_instance_id| to guest |
| (...skipping 29 matching lines...) Expand all Loading... |
| 197 | 212 |
| 198 private: | 213 private: |
| 199 // This interface should only be implemented inside content. | 214 // This interface should only be implemented inside content. |
| 200 friend class RenderFrameImpl; | 215 friend class RenderFrameImpl; |
| 201 RenderFrame() {} | 216 RenderFrame() {} |
| 202 }; | 217 }; |
| 203 | 218 |
| 204 } // namespace content | 219 } // namespace content |
| 205 | 220 |
| 206 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ | 221 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ |
| OLD | NEW |