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/strings/string16.h" | 10 #include "base/strings/string16.h" |
10 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
11 #include "ipc/ipc_listener.h" | 12 #include "ipc/ipc_listener.h" |
12 #include "ipc/ipc_sender.h" | 13 #include "ipc/ipc_sender.h" |
13 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 14 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 class WebFrame; | 19 class WebFrame; |
(...skipping 10 matching lines...) Expand all Loading... |
29 } | 30 } |
30 | 31 |
31 namespace v8 { | 32 namespace v8 { |
32 template <typename T> class Handle; | 33 template <typename T> class Handle; |
33 class Context; | 34 class Context; |
34 class Isolate; | 35 class Isolate; |
35 } | 36 } |
36 | 37 |
37 namespace content { | 38 namespace content { |
38 class ContextMenuClient; | 39 class ContextMenuClient; |
| 40 class PluginInstanceThrottler; |
39 class RenderView; | 41 class RenderView; |
40 class ServiceRegistry; | 42 class ServiceRegistry; |
41 struct ContextMenuParams; | 43 struct ContextMenuParams; |
42 struct WebPluginInfo; | 44 struct WebPluginInfo; |
43 struct WebPreferences; | 45 struct WebPreferences; |
44 | 46 |
45 // This interface wraps functionality, which is specific to frames, such as | 47 // This interface wraps functionality, which is specific to frames, such as |
46 // navigation. It provides communication with a corresponding RenderFrameHost | 48 // navigation. It provides communication with a corresponding RenderFrameHost |
47 // in the browser process. | 49 // in the browser process. |
48 class CONTENT_EXPORT RenderFrame : public IPC::Listener, | 50 class CONTENT_EXPORT RenderFrame : public IPC::Listener, |
49 public IPC::Sender { | 51 public IPC::Sender { |
50 public: | 52 public: |
51 enum PluginPowerSaverMode { | |
52 // Plugin content is main content, and therefore never throttled. | |
53 POWER_SAVER_MODE_ESSENTIAL = 0, | |
54 // Plugin content is peripheral, but throttling is disabled. | |
55 POWER_SAVER_MODE_PERIPHERAL_UNTHROTTLED = 1, | |
56 // Plugin content is peripheral, and throttling is enabled. | |
57 POWER_SAVER_MODE_PERIPHERAL_THROTTLED = 2 | |
58 }; | |
59 | |
60 // Returns the RenderFrame given a WebFrame. | 53 // Returns the RenderFrame given a WebFrame. |
61 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame); | 54 static RenderFrame* FromWebFrame(blink::WebFrame* web_frame); |
62 | 55 |
63 // Returns the RenderView associated with this frame. | 56 // Returns the RenderView associated with this frame. |
64 virtual RenderView* GetRenderView() = 0; | 57 virtual RenderView* GetRenderView() = 0; |
65 | 58 |
66 // Get the routing ID of the frame. | 59 // Get the routing ID of the frame. |
67 virtual int GetRoutingID() = 0; | 60 virtual int GetRoutingID() = 0; |
68 | 61 |
69 // Returns the associated WebFrame. | 62 // Returns the associated WebFrame. |
(...skipping 17 matching lines...) Expand all Loading... |
87 const ContextMenuParams& params) = 0; | 80 const ContextMenuParams& params) = 0; |
88 | 81 |
89 // Cancels a context menu in the event that the client is destroyed before the | 82 // Cancels a context menu in the event that the client is destroyed before the |
90 // menu is closed. | 83 // menu is closed. |
91 virtual void CancelContextMenu(int request_id) = 0; | 84 virtual void CancelContextMenu(int request_id) = 0; |
92 | 85 |
93 // Gets the node that the context menu was pressed over. | 86 // Gets the node that the context menu was pressed over. |
94 virtual blink::WebNode GetContextMenuNode() const = 0; | 87 virtual blink::WebNode GetContextMenuNode() const = 0; |
95 | 88 |
96 // Create a new NPAPI/Pepper plugin depending on |info|. Returns NULL if no | 89 // Create a new NPAPI/Pepper plugin depending on |info|. Returns NULL if no |
97 // plugin was found. | 90 // plugin was found. |throttler| may be empty. |
98 virtual blink::WebPlugin* CreatePlugin( | 91 virtual blink::WebPlugin* CreatePlugin( |
99 blink::WebFrame* frame, | 92 blink::WebFrame* frame, |
100 const WebPluginInfo& info, | 93 const WebPluginInfo& info, |
101 const blink::WebPluginParams& params, | 94 const blink::WebPluginParams& params, |
102 PluginPowerSaverMode power_saver_mode) = 0; | 95 scoped_ptr<PluginInstanceThrottler> throttler) = 0; |
103 | 96 |
104 // The client should handle the navigation externally. | 97 // The client should handle the navigation externally. |
105 virtual void LoadURLExternally(blink::WebLocalFrame* frame, | 98 virtual void LoadURLExternally(blink::WebLocalFrame* frame, |
106 const blink::WebURLRequest& request, | 99 const blink::WebURLRequest& request, |
107 blink::WebNavigationPolicy policy) = 0; | 100 blink::WebNavigationPolicy policy) = 0; |
108 | 101 |
109 // Execute a string of JavaScript in this frame's context. | 102 // Execute a string of JavaScript in this frame's context. |
110 virtual void ExecuteJavaScript(const base::string16& javascript) = 0; | 103 virtual void ExecuteJavaScript(const base::string16& javascript) = 0; |
111 | 104 |
112 // Return true if this frame is hidden. | 105 // Return true if this frame is hidden. |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 171 |
179 private: | 172 private: |
180 // This interface should only be implemented inside content. | 173 // This interface should only be implemented inside content. |
181 friend class RenderFrameImpl; | 174 friend class RenderFrameImpl; |
182 RenderFrame() {} | 175 RenderFrame() {} |
183 }; | 176 }; |
184 | 177 |
185 } // namespace content | 178 } // namespace content |
186 | 179 |
187 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ | 180 #endif // CONTENT_PUBLIC_RENDERER_RENDER_FRAME_H_ |
OLD | NEW |