[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| 6 | #define CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |
| 7 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 8 | #include <vector> |
| 9 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 10 | #include "base/basictypes.h" |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 11 | #include "base/files/file_path.h" |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 12 | #include "base/gtest_prod_util.h" |
| 13 | #include "base/id_map.h" |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 14 | #include "base/memory/weak_ptr.h" |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 15 | #include "base/observer_list.h" |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 16 | #include "base/process/process_handle.h" |
| 17 | #include "base/strings/string16.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 18 | #include "content/public/renderer/render_frame.h" |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 19 | #include "content/renderer/renderer_webcookiejar_impl.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 20 | #include "ipc/ipc_message.h" |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 21 | #include "third_party/WebKit/public/web/WebDataSource.h" |
| 22 | #include "third_party/WebKit/public/web/WebFrameClient.h" |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 23 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 24 | class TransportDIB; |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 25 | struct FrameMsg_BuffersSwapped_Params; |
| 26 | struct FrameMsg_CompositorFrameSwapped_Params; |
[email protected] | c6bc2033 | 2014-02-28 18:30:39 | [diff] [blame^] | 27 | struct FrameMsg_Navigate_Params; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 28 | |
| 29 | namespace blink { |
[email protected] | 5cdd8fd8 | 2014-02-05 20:12:12 | [diff] [blame] | 30 | class WebInputEvent; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 31 | class WebMouseEvent; |
| 32 | struct WebCompositionUnderline; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 33 | struct WebContextMenuData; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 34 | struct WebCursorInfo; |
| 35 | } |
| 36 | |
| 37 | namespace gfx { |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 38 | class Point; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 39 | class Range; |
| 40 | class Rect; |
| 41 | } |
| 42 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 43 | namespace content { |
| 44 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 45 | class ChildFrameCompositingHelper; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 46 | class PepperPluginInstanceImpl; |
| 47 | class RendererPpapiHost; |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 48 | class RenderFrameObserver; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 49 | class RenderViewImpl; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 50 | class RenderWidget; |
| 51 | class RenderWidgetFullscreenPepper; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 52 | struct CustomContextMenuContext; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 53 | |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 54 | class CONTENT_EXPORT RenderFrameImpl |
| 55 | : public RenderFrame, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 56 | NON_EXPORTED_BASE(public blink::WebFrameClient) { |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 57 | public: |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 58 | // Creates a new RenderFrame. |render_view| is the RenderView object that this |
| 59 | // frame belongs to. |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 60 | // Callers *must* call |SetWebFrame| immediately after creation. |
| 61 | // TODO(creis): We should structure this so that |SetWebFrame| isn't needed. |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 62 | static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id); |
| 63 | |
[email protected] | a5ac6dc | 2014-01-15 07:02:14 | [diff] [blame] | 64 | // Just like RenderFrame::FromWebFrame but returns the implementation. |
| 65 | static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame); |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 66 | |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 67 | // Used by content_layouttest_support to hook into the creation of |
| 68 | // RenderFrameImpls. |
| 69 | static void InstallCreateHook( |
| 70 | RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32)); |
| 71 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 72 | virtual ~RenderFrameImpl(); |
| 73 | |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 74 | bool is_swapped_out() const { |
| 75 | return is_swapped_out_; |
| 76 | } |
| 77 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 78 | // Out-of-process child frames receive a signal from RenderWidgetCompositor |
| 79 | // when a compositor frame has committed. |
| 80 | void DidCommitCompositorFrame(); |
| 81 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 82 | // TODO(jam): this is a temporary getter until all the code is transitioned |
| 83 | // to using RenderFrame instead of RenderView. |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 84 | RenderViewImpl* render_view() { return render_view_.get(); } |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 85 | |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 86 | RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; } |
| 87 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 88 | // Returns the RenderWidget associated with this frame. |
| 89 | RenderWidget* GetRenderWidget(); |
| 90 | |
[email protected] | a5ac6dc | 2014-01-15 07:02:14 | [diff] [blame] | 91 | // This is called right after creation with the WebFrame for this RenderFrame. |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 92 | void SetWebFrame(blink::WebFrame* web_frame); |
| 93 | |
[email protected] | 5815cf5 | 2014-01-29 17:45:05 | [diff] [blame] | 94 | // Notification from RenderView. |
| 95 | virtual void OnStop(); |
| 96 | |
[email protected] | 723971b | 2014-02-12 11:08:25 | [diff] [blame] | 97 | // Start/Stop loading notifications. |
| 98 | // TODO(nasko): Those are page-level methods at this time and come from |
| 99 | // WebViewClient. We should move them to be WebFrameClient calls and put |
| 100 | // logic in the browser side to balance starts/stops. |
| 101 | void didStartLoading(); |
| 102 | void didStopLoading(); |
| 103 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 104 | #if defined(ENABLE_PLUGINS) |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 105 | // Notification that a PPAPI plugin has been created. |
| 106 | void PepperPluginCreated(RendererPpapiHost* host); |
| 107 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 108 | // Notifies that |instance| has changed the cursor. |
| 109 | // This will update the cursor appearance if it is currently over the plugin |
| 110 | // instance. |
| 111 | void PepperDidChangeCursor(PepperPluginInstanceImpl* instance, |
| 112 | const blink::WebCursorInfo& cursor); |
| 113 | |
| 114 | // Notifies that |instance| has received a mouse event. |
| 115 | void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance); |
| 116 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 117 | // Informs the render view that a PPAPI plugin has changed text input status. |
| 118 | void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance); |
| 119 | void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance); |
| 120 | |
| 121 | // Cancels current composition. |
| 122 | void PepperCancelComposition(PepperPluginInstanceImpl* instance); |
| 123 | |
| 124 | // Informs the render view that a PPAPI plugin has changed selection. |
| 125 | void PepperSelectionChanged(PepperPluginInstanceImpl* instance); |
| 126 | |
| 127 | // Creates a fullscreen container for a pepper plugin instance. |
| 128 | RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer( |
| 129 | PepperPluginInstanceImpl* plugin); |
| 130 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 131 | bool IsPepperAcceptingCompositionEvents() const; |
| 132 | |
| 133 | // Notification that the given plugin has crashed. |
| 134 | void PluginCrashed(const base::FilePath& plugin_path, |
| 135 | base::ProcessId plugin_pid); |
| 136 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 137 | // Simulates IME events for testing purpose. |
| 138 | void SimulateImeSetComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 139 | const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 140 | const std::vector<blink::WebCompositionUnderline>& underlines, |
| 141 | int selection_start, |
| 142 | int selection_end); |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 143 | void SimulateImeConfirmComposition(const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 144 | const gfx::Range& replacement_range); |
| 145 | |
| 146 | // TODO(jam): remove these once the IPC handler moves from RenderView to |
| 147 | // RenderFrame. |
| 148 | void OnImeSetComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 149 | const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 150 | const std::vector<blink::WebCompositionUnderline>& underlines, |
| 151 | int selection_start, |
| 152 | int selection_end); |
| 153 | void OnImeConfirmComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 154 | const base::string16& text, |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 155 | const gfx::Range& replacement_range, |
| 156 | bool keep_selection); |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 157 | #endif // ENABLE_PLUGINS |
| 158 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 159 | // IPC::Sender |
| 160 | virtual bool Send(IPC::Message* msg) OVERRIDE; |
| 161 | |
| 162 | // IPC::Listener |
| 163 | virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 164 | |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 165 | // RenderFrame implementation: |
[email protected] | b849847b | 2013-12-10 21:57:58 | [diff] [blame] | 166 | virtual RenderView* GetRenderView() OVERRIDE; |
[email protected] | 60eca4eb | 2013-12-06 00:02:16 | [diff] [blame] | 167 | virtual int GetRoutingID() OVERRIDE; |
[email protected] | a5ac6dc | 2014-01-15 07:02:14 | [diff] [blame] | 168 | virtual blink::WebFrame* GetWebFrame() OVERRIDE; |
[email protected] | d019e1a38 | 2013-12-11 17:52:06 | [diff] [blame] | 169 | virtual WebPreferences& GetWebkitPreferences() OVERRIDE; |
| 170 | virtual int ShowContextMenu(ContextMenuClient* client, |
| 171 | const ContextMenuParams& params) OVERRIDE; |
| 172 | virtual void CancelContextMenu(int request_id) OVERRIDE; |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 173 | virtual blink::WebPlugin* CreatePlugin( |
| 174 | blink::WebFrame* frame, |
| 175 | const WebPluginInfo& info, |
| 176 | const blink::WebPluginParams& params) OVERRIDE; |
[email protected] | d019e1a38 | 2013-12-11 17:52:06 | [diff] [blame] | 177 | virtual void LoadURLExternally( |
| 178 | blink::WebFrame* frame, |
| 179 | const blink::WebURLRequest& request, |
| 180 | blink::WebNavigationPolicy policy) OVERRIDE; |
[email protected] | 271ff579 | 2013-12-04 22:29:31 | [diff] [blame] | 181 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 182 | // blink::WebFrameClient implementation ------------------------------------- |
| 183 | virtual blink::WebPlugin* createPlugin( |
| 184 | blink::WebFrame* frame, |
| 185 | const blink::WebPluginParams& params); |
| 186 | virtual blink::WebMediaPlayer* createMediaPlayer( |
| 187 | blink::WebFrame* frame, |
| 188 | const blink::WebURL& url, |
| 189 | blink::WebMediaPlayerClient* client); |
| 190 | virtual blink::WebApplicationCacheHost* createApplicationCacheHost( |
| 191 | blink::WebFrame* frame, |
| 192 | blink::WebApplicationCacheHostClient* client); |
| 193 | virtual blink::WebWorkerPermissionClientProxy* |
| 194 | createWorkerPermissionClientProxy(blink::WebFrame* frame); |
| 195 | virtual blink::WebCookieJar* cookieJar(blink::WebFrame* frame); |
| 196 | virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider( |
[email protected] | 7e11315 | 2014-02-26 20:01:14 | [diff] [blame] | 197 | blink::WebFrame* frame); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 198 | virtual void didAccessInitialDocument(blink::WebFrame* frame); |
| 199 | virtual blink::WebFrame* createChildFrame(blink::WebFrame* parent, |
| 200 | const blink::WebString& name); |
| 201 | virtual void didDisownOpener(blink::WebFrame* frame); |
| 202 | virtual void frameDetached(blink::WebFrame* frame); |
| 203 | virtual void willClose(blink::WebFrame* frame); |
| 204 | virtual void didChangeName(blink::WebFrame* frame, |
| 205 | const blink::WebString& name); |
[email protected] | f5b6dd112 | 2013-10-04 02:42:50 | [diff] [blame] | 206 | virtual void didMatchCSS( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 207 | blink::WebFrame* frame, |
| 208 | const blink::WebVector<blink::WebString>& newly_matching_selectors, |
| 209 | const blink::WebVector<blink::WebString>& stopped_matching_selectors); |
| 210 | virtual void loadURLExternally(blink::WebFrame* frame, |
| 211 | const blink::WebURLRequest& request, |
| 212 | blink::WebNavigationPolicy policy); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 213 | virtual void loadURLExternally( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 214 | blink::WebFrame* frame, |
| 215 | const blink::WebURLRequest& request, |
| 216 | blink::WebNavigationPolicy policy, |
| 217 | const blink::WebString& suggested_name); |
[email protected] | 1a4e975 | 2013-12-31 20:10:58 | [diff] [blame] | 218 | // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 219 | virtual blink::WebNavigationPolicy decidePolicyForNavigation( |
| 220 | blink::WebFrame* frame, |
| 221 | blink::WebDataSource::ExtraData* extra_data, |
| 222 | const blink::WebURLRequest& request, |
| 223 | blink::WebNavigationType type, |
| 224 | blink::WebNavigationPolicy default_policy, |
[email protected] | f6ae17fc | 2013-08-19 22:56:17 | [diff] [blame] | 225 | bool is_redirect); |
| 226 | // DEPRECATED |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 227 | virtual blink::WebNavigationPolicy decidePolicyForNavigation( |
| 228 | blink::WebFrame* frame, |
| 229 | const blink::WebURLRequest& request, |
| 230 | blink::WebNavigationType type, |
| 231 | blink::WebNavigationPolicy default_policy, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 232 | bool is_redirect); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 233 | virtual void willSendSubmitEvent(blink::WebFrame* frame, |
| 234 | const blink::WebFormElement& form); |
| 235 | virtual void willSubmitForm(blink::WebFrame* frame, |
| 236 | const blink::WebFormElement& form); |
| 237 | virtual void didCreateDataSource(blink::WebFrame* frame, |
| 238 | blink::WebDataSource* datasource); |
| 239 | virtual void didStartProvisionalLoad(blink::WebFrame* frame); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 240 | virtual void didReceiveServerRedirectForProvisionalLoad( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 241 | blink::WebFrame* frame); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 242 | virtual void didFailProvisionalLoad( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 243 | blink::WebFrame* frame, |
| 244 | const blink::WebURLError& error); |
| 245 | virtual void didCommitProvisionalLoad(blink::WebFrame* frame, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 246 | bool is_new_navigation); |
[email protected] | c4f80f7 | 2014-01-13 11:24:12 | [diff] [blame] | 247 | virtual void didClearWindowObject(blink::WebFrame* frame, int world_id); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 248 | virtual void didCreateDocumentElement(blink::WebFrame* frame); |
| 249 | virtual void didReceiveTitle(blink::WebFrame* frame, |
| 250 | const blink::WebString& title, |
| 251 | blink::WebTextDirection direction); |
| 252 | virtual void didChangeIcon(blink::WebFrame* frame, |
| 253 | blink::WebIconURL::Type icon_type); |
| 254 | virtual void didFinishDocumentLoad(blink::WebFrame* frame); |
| 255 | virtual void didHandleOnloadEvents(blink::WebFrame* frame); |
| 256 | virtual void didFailLoad(blink::WebFrame* frame, |
| 257 | const blink::WebURLError& error); |
| 258 | virtual void didFinishLoad(blink::WebFrame* frame); |
| 259 | virtual void didNavigateWithinPage(blink::WebFrame* frame, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 260 | bool is_new_navigation); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 261 | virtual void didUpdateCurrentHistoryItem(blink::WebFrame* frame); |
| 262 | virtual void willRequestAfterPreconnect(blink::WebFrame* frame, |
| 263 | blink::WebURLRequest& request); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 264 | virtual void willSendRequest( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 265 | blink::WebFrame* frame, |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 266 | unsigned identifier, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 267 | blink::WebURLRequest& request, |
| 268 | const blink::WebURLResponse& redirect_response); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 269 | virtual void didReceiveResponse( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 270 | blink::WebFrame* frame, |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 271 | unsigned identifier, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 272 | const blink::WebURLResponse& response); |
| 273 | virtual void didFinishResourceLoad(blink::WebFrame* frame, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 274 | unsigned identifier); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 275 | virtual void didLoadResourceFromMemoryCache( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 276 | blink::WebFrame* frame, |
| 277 | const blink::WebURLRequest& request, |
| 278 | const blink::WebURLResponse& response); |
| 279 | virtual void didDisplayInsecureContent(blink::WebFrame* frame); |
| 280 | virtual void didRunInsecureContent(blink::WebFrame* frame, |
| 281 | const blink::WebSecurityOrigin& origin, |
| 282 | const blink::WebURL& target); |
| 283 | virtual void didAbortLoading(blink::WebFrame* frame); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 284 | virtual void didExhaustMemoryAvailableForScript( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 285 | blink::WebFrame* frame); |
| 286 | virtual void didCreateScriptContext(blink::WebFrame* frame, |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 287 | v8::Handle<v8::Context> context, |
| 288 | int extension_group, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 289 | int world_id); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 290 | virtual void willReleaseScriptContext(blink::WebFrame* frame, |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 291 | v8::Handle<v8::Context> context, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 292 | int world_id); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 293 | virtual void didFirstVisuallyNonEmptyLayout(blink::WebFrame* frame); |
| 294 | virtual void didChangeContentsSize(blink::WebFrame* frame, |
| 295 | const blink::WebSize& size); |
| 296 | virtual void didChangeScrollOffset(blink::WebFrame* frame); |
| 297 | virtual void willInsertBody(blink::WebFrame* frame); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 298 | virtual void reportFindInPageMatchCount(int request_id, |
| 299 | int count, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 300 | bool final_update); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 301 | virtual void reportFindInPageSelection(int request_id, |
| 302 | int active_match_ordinal, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 303 | const blink::WebRect& sel); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 304 | virtual void requestStorageQuota( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 305 | blink::WebFrame* frame, |
| 306 | blink::WebStorageQuotaType type, |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 307 | unsigned long long requested_size, |
[email protected] | 45868f07 | 2014-02-06 11:58:59 | [diff] [blame] | 308 | blink::WebStorageQuotaCallbacks callbacks); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 309 | virtual void willOpenSocketStream( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 310 | blink::WebSocketStreamHandle* handle); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 311 | virtual void willStartUsingPeerConnectionHandler( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 312 | blink::WebFrame* frame, |
| 313 | blink::WebRTCPeerConnectionHandler* handler); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 314 | virtual bool willCheckAndDispatchMessageEvent( |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 315 | blink::WebFrame* sourceFrame, |
| 316 | blink::WebFrame* targetFrame, |
| 317 | blink::WebSecurityOrigin targetOrigin, |
| 318 | blink::WebDOMMessageEvent event); |
| 319 | virtual blink::WebString userAgentOverride( |
| 320 | blink::WebFrame* frame, |
| 321 | const blink::WebURL& url); |
| 322 | virtual blink::WebString doNotTrackValue(blink::WebFrame* frame); |
| 323 | virtual bool allowWebGL(blink::WebFrame* frame, bool default_value); |
| 324 | virtual void didLoseWebGLContext(blink::WebFrame* frame, |
[email protected] | 255eea09 | 2013-06-28 17:19:14 | [diff] [blame] | 325 | int arb_robustness_status_code); |
[email protected] | 5cdd8fd8 | 2014-02-05 20:12:12 | [diff] [blame] | 326 | virtual void forwardInputEvent(const blink::WebInputEvent* event); |
[email protected] | 9ef43adc | 2014-02-19 08:02:15 | [diff] [blame] | 327 | virtual void initializeChildFrame(const blink::WebRect& frame_rect, |
| 328 | float scale_factor); |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 329 | |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 330 | // TODO(jam): move this to WebFrameClient |
| 331 | virtual void showContextMenu(const blink::WebContextMenuData& data); |
| 332 | |
[email protected] | c6bc2033 | 2014-02-28 18:30:39 | [diff] [blame^] | 333 | // TODO(nasko): Make all tests in RenderViewImplTest friends and then move |
| 334 | // this back to private member. |
| 335 | void OnNavigate(const FrameMsg_Navigate_Params& params); |
| 336 | |
[email protected] | 2f61bdd | 2013-07-02 18:38:47 | [diff] [blame] | 337 | protected: |
| 338 | RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id); |
| 339 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 340 | private: |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 341 | friend class RenderFrameObserver; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 342 | FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, |
| 343 | ShouldUpdateSelectionTextFromContextMenuParams); |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 344 | |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 345 | typedef std::map<GURL, double> HostZoomLevels; |
| 346 | |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 347 | // Functions to add and remove observers for this object. |
| 348 | void AddObserver(RenderFrameObserver* observer); |
| 349 | void RemoveObserver(RenderFrameObserver* observer); |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 350 | |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 351 | void UpdateURL(blink::WebFrame* frame); |
| 352 | |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 353 | // IPC message handlers ------------------------------------------------------ |
| 354 | // |
| 355 | // The documentation for these functions should be in |
| 356 | // content/common/*_messages.h for the message that the function is handling. |
| 357 | void OnSwapOut(); |
[email protected] | f49722f | 2014-01-30 17:54:50 | [diff] [blame] | 358 | void OnChildFrameProcessGone(); |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 359 | void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params); |
| 360 | void OnCompositorFrameSwapped(const IPC::Message& message); |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 361 | void OnShowContextMenu(const gfx::Point& location); |
| 362 | void OnContextMenuClosed(const CustomContextMenuContext& custom_context); |
| 363 | void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context, |
| 364 | unsigned action); |
| 365 | |
| 366 | // Returns whether |params.selection_text| should be synchronized to the |
| 367 | // browser before bringing up the context menu. Static for testing. |
| 368 | static bool ShouldUpdateSelectionTextFromContextMenuParams( |
| 369 | const base::string16& selection_text, |
| 370 | size_t selection_text_offset, |
| 371 | const gfx::Range& selection_range, |
| 372 | const ContextMenuParams& params); |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 373 | |
[email protected] | a5ac6dc | 2014-01-15 07:02:14 | [diff] [blame] | 374 | // Stores the WebFrame we are associated with. |
[email protected] | b70da4c | 2014-01-06 19:57:09 | [diff] [blame] | 375 | blink::WebFrame* frame_; |
| 376 | |
[email protected] | abc501e | 2014-01-27 19:27:26 | [diff] [blame] | 377 | base::WeakPtr<RenderViewImpl> render_view_; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 378 | int routing_id_; |
[email protected] | 1c2052f | 2013-08-28 08:24:34 | [diff] [blame] | 379 | bool is_swapped_out_; |
| 380 | bool is_detaching_; |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 381 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 382 | #if defined(ENABLE_PLUGINS) |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 383 | // Current text input composition text. Empty if no composition is in |
| 384 | // progress. |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 385 | base::string16 pepper_composition_text_; |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 386 | #endif |
| 387 | |
[email protected] | f3add92 | 2013-12-20 23:17:16 | [diff] [blame] | 388 | RendererWebCookieJarImpl cookie_jar_; |
| 389 | |
[email protected] | 2e2d963 | 2013-12-03 00:55:26 | [diff] [blame] | 390 | // All the registered observers. |
| 391 | ObserverList<RenderFrameObserver> observers_; |
| 392 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 393 | scoped_refptr<ChildFrameCompositingHelper> compositing_helper_; |
| 394 | |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 395 | // External context menu requests we're waiting for. "Internal" |
| 396 | // (WebKit-originated) context menu events will have an ID of 0 and will not |
| 397 | // be in this map. |
| 398 | // |
| 399 | // We don't want to add internal ones since some of the "special" page |
| 400 | // handlers in the browser process just ignore the context menu requests so |
| 401 | // avoid showing context menus, and so this will cause right clicks to leak |
| 402 | // entries in this map. Most users of the custom context menu (e.g. Pepper |
| 403 | // plugins) are normally only on "regular" pages and the regular pages will |
| 404 | // always respond properly to the request, so we don't have to worry so |
| 405 | // much about leaks. |
| 406 | IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_; |
| 407 | |
[email protected] | 227692c5 | 2013-05-31 22:43:04 | [diff] [blame] | 408 | DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl); |
| 409 | }; |
| 410 | |
| 411 | } // namespace content |
| 412 | |
[email protected] | 85d85fd | 2013-06-19 00:57:41 | [diff] [blame] | 413 | #endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_ |