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