blob: a032b57aee2bd689a35671ec66fc894c9a740b10 [file] [log] [blame]
[email protected]227692c52013-05-31 22:43:041// 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]7a4e2532013-12-02 21:30:028#include <vector>
9
[email protected]227692c52013-05-31 22:43:0410#include "base/basictypes.h"
[email protected]7a4e2532013-12-02 21:30:0211#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4212#include "base/gtest_prod_util.h"
13#include "base/id_map.h"
[email protected]abc501e2014-01-27 19:27:2614#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2615#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0216#include "base/process/process_handle.h"
[email protected]65920f332014-03-04 21:14:1817#include "content/public/common/referrer.h"
[email protected]227692c52013-05-31 22:43:0418#include "content/public/renderer/render_frame.h"
[email protected]f3add922013-12-20 23:17:1619#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0420#include "ipc/ipc_message.h"
[email protected]85d85fd2013-06-19 00:57:4121#include "third_party/WebKit/public/web/WebDataSource.h"
22#include "third_party/WebKit/public/web/WebFrameClient.h"
[email protected]4ee64622014-03-21 22:34:1523#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0424
[email protected]7a4e2532013-12-02 21:30:0225class TransportDIB;
[email protected]bffc8302014-01-23 20:52:1626struct FrameMsg_BuffersSwapped_Params;
27struct FrameMsg_CompositorFrameSwapped_Params;
[email protected]c6bc20332014-02-28 18:30:3928struct FrameMsg_Navigate_Params;
[email protected]7a4e2532013-12-02 21:30:0229
30namespace blink {
[email protected]5cdd8fd82014-02-05 20:12:1231class WebInputEvent;
[email protected]7a4e2532013-12-02 21:30:0232class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2633class WebContentDecryptionModule;
34class WebSecurityOrigin;
[email protected]7a4e2532013-12-02 21:30:0235struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4236struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0237struct WebCursorInfo;
38}
39
40namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4241class Point;
[email protected]7a4e2532013-12-02 21:30:0242class Range;
43class Rect;
44}
45
[email protected]227692c52013-05-31 22:43:0446namespace content {
47
[email protected]bffc8302014-01-23 20:52:1648class ChildFrameCompositingHelper;
[email protected]7a4e2532013-12-02 21:30:0249class PepperPluginInstanceImpl;
50class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:2651class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:0452class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:0253class RenderWidget;
54class RenderWidgetFullscreenPepper;
[email protected]a09d53ce2014-01-31 00:46:4255struct CustomContextMenuContext;
[email protected]227692c52013-05-31 22:43:0456
[email protected]85d85fd2013-06-19 00:57:4157class CONTENT_EXPORT RenderFrameImpl
58 : public RenderFrame,
[email protected]180ef242013-11-07 06:50:4659 NON_EXPORTED_BASE(public blink::WebFrameClient) {
[email protected]227692c52013-05-31 22:43:0460 public:
[email protected]2f61bdd2013-07-02 18:38:4761 // Creates a new RenderFrame. |render_view| is the RenderView object that this
62 // frame belongs to.
[email protected]b70da4c2014-01-06 19:57:0963 // Callers *must* call |SetWebFrame| immediately after creation.
64 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
[email protected]2f61bdd2013-07-02 18:38:4765 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
66
[email protected]a5ac6dc2014-01-15 07:02:1467 // Just like RenderFrame::FromWebFrame but returns the implementation.
68 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:0969
[email protected]2f61bdd2013-07-02 18:38:4770 // Used by content_layouttest_support to hook into the creation of
71 // RenderFrameImpls.
72 static void InstallCreateHook(
73 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32));
74
[email protected]227692c52013-05-31 22:43:0475 virtual ~RenderFrameImpl();
76
[email protected]b70da4c2014-01-06 19:57:0977 bool is_swapped_out() const {
78 return is_swapped_out_;
79 }
80
[email protected]bffc8302014-01-23 20:52:1681 // Out-of-process child frames receive a signal from RenderWidgetCompositor
82 // when a compositor frame has committed.
83 void DidCommitCompositorFrame();
84
[email protected]7a4e2532013-12-02 21:30:0285 // TODO(jam): this is a temporary getter until all the code is transitioned
86 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:2687 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:0288
[email protected]f3add922013-12-20 23:17:1689 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
90
[email protected]7a4e2532013-12-02 21:30:0291 // Returns the RenderWidget associated with this frame.
92 RenderWidget* GetRenderWidget();
93
[email protected]a5ac6dc2014-01-15 07:02:1494 // This is called right after creation with the WebFrame for this RenderFrame.
[email protected]b70da4c2014-01-06 19:57:0995 void SetWebFrame(blink::WebFrame* web_frame);
96
[email protected]5815cf52014-01-29 17:45:0597 // Notification from RenderView.
98 virtual void OnStop();
99
[email protected]723971b2014-02-12 11:08:25100 // Start/Stop loading notifications.
101 // TODO(nasko): Those are page-level methods at this time and come from
102 // WebViewClient. We should move them to be WebFrameClient calls and put
103 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09104 // |to_different_document| will be true unless the load is a fragment
105 // navigation, or triggered by history.pushState/replaceState.
[email protected]6dd5c322014-03-12 07:58:46106 virtual void didStartLoading(bool to_different_document);
107 virtual void didStopLoading();
108 virtual void didChangeLoadProgress(double load_progress);
[email protected]723971b2014-02-12 11:08:25109
[email protected]7a4e2532013-12-02 21:30:02110#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31111 // Notification that a PPAPI plugin has been created.
112 void PepperPluginCreated(RendererPpapiHost* host);
113
[email protected]7a4e2532013-12-02 21:30:02114 // Notifies that |instance| has changed the cursor.
115 // This will update the cursor appearance if it is currently over the plugin
116 // instance.
117 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
118 const blink::WebCursorInfo& cursor);
119
120 // Notifies that |instance| has received a mouse event.
121 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
122
[email protected]7a4e2532013-12-02 21:30:02123 // Informs the render view that a PPAPI plugin has changed text input status.
124 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
125 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
126
127 // Cancels current composition.
128 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
129
130 // Informs the render view that a PPAPI plugin has changed selection.
131 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
132
133 // Creates a fullscreen container for a pepper plugin instance.
134 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
135 PepperPluginInstanceImpl* plugin);
136
[email protected]7a4e2532013-12-02 21:30:02137 bool IsPepperAcceptingCompositionEvents() const;
138
139 // Notification that the given plugin has crashed.
140 void PluginCrashed(const base::FilePath& plugin_path,
141 base::ProcessId plugin_pid);
142
[email protected]7a4e2532013-12-02 21:30:02143 // Simulates IME events for testing purpose.
144 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26145 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02146 const std::vector<blink::WebCompositionUnderline>& underlines,
147 int selection_start,
148 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26149 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02150 const gfx::Range& replacement_range);
151
152 // TODO(jam): remove these once the IPC handler moves from RenderView to
153 // RenderFrame.
154 void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26155 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02156 const std::vector<blink::WebCompositionUnderline>& underlines,
157 int selection_start,
158 int selection_end);
159 void OnImeConfirmComposition(
[email protected]fcf75d42013-12-03 20:11:26160 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02161 const gfx::Range& replacement_range,
162 bool keep_selection);
[email protected]7a4e2532013-12-02 21:30:02163#endif // ENABLE_PLUGINS
164
[email protected]227692c52013-05-31 22:43:04165 // IPC::Sender
166 virtual bool Send(IPC::Message* msg) OVERRIDE;
167
168 // IPC::Listener
169 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
170
[email protected]271ff5792013-12-04 22:29:31171 // RenderFrame implementation:
[email protected]b849847b2013-12-10 21:57:58172 virtual RenderView* GetRenderView() OVERRIDE;
[email protected]60eca4eb2013-12-06 00:02:16173 virtual int GetRoutingID() OVERRIDE;
[email protected]a5ac6dc2014-01-15 07:02:14174 virtual blink::WebFrame* GetWebFrame() OVERRIDE;
[email protected]d019e1a382013-12-11 17:52:06175 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
176 virtual int ShowContextMenu(ContextMenuClient* client,
177 const ContextMenuParams& params) OVERRIDE;
178 virtual void CancelContextMenu(int request_id) OVERRIDE;
[email protected]1a6d0112014-03-10 19:08:41179 virtual blink::WebNode GetContextMenuNode() const OVERRIDE;
[email protected]271ff5792013-12-04 22:29:31180 virtual blink::WebPlugin* CreatePlugin(
181 blink::WebFrame* frame,
182 const WebPluginInfo& info,
183 const blink::WebPluginParams& params) OVERRIDE;
[email protected]d019e1a382013-12-11 17:52:06184 virtual void LoadURLExternally(
185 blink::WebFrame* frame,
186 const blink::WebURLRequest& request,
187 blink::WebNavigationPolicy policy) OVERRIDE;
[email protected]db3be76f2014-03-25 02:27:47188 virtual void ExecuteJavaScript(const base::string16& javascript) OVERRIDE;
[email protected]271ff5792013-12-04 22:29:31189
[email protected]180ef242013-11-07 06:50:46190 // blink::WebFrameClient implementation -------------------------------------
191 virtual blink::WebPlugin* createPlugin(
192 blink::WebFrame* frame,
193 const blink::WebPluginParams& params);
194 virtual blink::WebMediaPlayer* createMediaPlayer(
195 blink::WebFrame* frame,
196 const blink::WebURL& url,
197 blink::WebMediaPlayerClient* client);
[email protected]82ce5b92014-03-22 05:15:26198 virtual blink::WebContentDecryptionModule* createContentDecryptionModule(
199 blink::WebFrame* frame,
200 const blink::WebSecurityOrigin& security_origin,
201 const blink::WebString& key_system);
[email protected]180ef242013-11-07 06:50:46202 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
203 blink::WebFrame* frame,
204 blink::WebApplicationCacheHostClient* client);
205 virtual blink::WebWorkerPermissionClientProxy*
206 createWorkerPermissionClientProxy(blink::WebFrame* frame);
207 virtual blink::WebCookieJar* cookieJar(blink::WebFrame* frame);
208 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
[email protected]7e113152014-02-26 20:01:14209 blink::WebFrame* frame);
[email protected]180ef242013-11-07 06:50:46210 virtual void didAccessInitialDocument(blink::WebFrame* frame);
211 virtual blink::WebFrame* createChildFrame(blink::WebFrame* parent,
212 const blink::WebString& name);
213 virtual void didDisownOpener(blink::WebFrame* frame);
214 virtual void frameDetached(blink::WebFrame* frame);
[email protected]9c9343b2014-03-08 02:56:07215 virtual void frameFocused();
[email protected]180ef242013-11-07 06:50:46216 virtual void willClose(blink::WebFrame* frame);
217 virtual void didChangeName(blink::WebFrame* frame,
218 const blink::WebString& name);
[email protected]f5b6dd1122013-10-04 02:42:50219 virtual void didMatchCSS(
[email protected]180ef242013-11-07 06:50:46220 blink::WebFrame* frame,
221 const blink::WebVector<blink::WebString>& newly_matching_selectors,
222 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
223 virtual void loadURLExternally(blink::WebFrame* frame,
224 const blink::WebURLRequest& request,
225 blink::WebNavigationPolicy policy);
[email protected]85d85fd2013-06-19 00:57:41226 virtual void loadURLExternally(
[email protected]180ef242013-11-07 06:50:46227 blink::WebFrame* frame,
228 const blink::WebURLRequest& request,
229 blink::WebNavigationPolicy policy,
230 const blink::WebString& suggested_name);
[email protected]1a4e9752013-12-31 20:10:58231 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
[email protected]180ef242013-11-07 06:50:46232 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
233 blink::WebFrame* frame,
234 blink::WebDataSource::ExtraData* extra_data,
235 const blink::WebURLRequest& request,
236 blink::WebNavigationType type,
237 blink::WebNavigationPolicy default_policy,
[email protected]f6ae17fc2013-08-19 22:56:17238 bool is_redirect);
239 // DEPRECATED
[email protected]180ef242013-11-07 06:50:46240 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
241 blink::WebFrame* frame,
242 const blink::WebURLRequest& request,
243 blink::WebNavigationType type,
244 blink::WebNavigationPolicy default_policy,
[email protected]255eea092013-06-28 17:19:14245 bool is_redirect);
[email protected]180ef242013-11-07 06:50:46246 virtual void willSendSubmitEvent(blink::WebFrame* frame,
247 const blink::WebFormElement& form);
248 virtual void willSubmitForm(blink::WebFrame* frame,
249 const blink::WebFormElement& form);
250 virtual void didCreateDataSource(blink::WebFrame* frame,
251 blink::WebDataSource* datasource);
252 virtual void didStartProvisionalLoad(blink::WebFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41253 virtual void didReceiveServerRedirectForProvisionalLoad(
[email protected]180ef242013-11-07 06:50:46254 blink::WebFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41255 virtual void didFailProvisionalLoad(
[email protected]180ef242013-11-07 06:50:46256 blink::WebFrame* frame,
257 const blink::WebURLError& error);
258 virtual void didCommitProvisionalLoad(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14259 bool is_new_navigation);
[email protected]c4f80f72014-01-13 11:24:12260 virtual void didClearWindowObject(blink::WebFrame* frame, int world_id);
[email protected]180ef242013-11-07 06:50:46261 virtual void didCreateDocumentElement(blink::WebFrame* frame);
262 virtual void didReceiveTitle(blink::WebFrame* frame,
263 const blink::WebString& title,
264 blink::WebTextDirection direction);
265 virtual void didChangeIcon(blink::WebFrame* frame,
266 blink::WebIconURL::Type icon_type);
267 virtual void didFinishDocumentLoad(blink::WebFrame* frame);
268 virtual void didHandleOnloadEvents(blink::WebFrame* frame);
269 virtual void didFailLoad(blink::WebFrame* frame,
270 const blink::WebURLError& error);
271 virtual void didFinishLoad(blink::WebFrame* frame);
272 virtual void didNavigateWithinPage(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14273 bool is_new_navigation);
[email protected]180ef242013-11-07 06:50:46274 virtual void didUpdateCurrentHistoryItem(blink::WebFrame* frame);
[email protected]c3f2c702014-03-19 23:39:48275 virtual void didChangeSelection(bool is_empty_selection);
[email protected]12cc5112014-03-03 17:01:10276 virtual void showContextMenu(const blink::WebContextMenuData& data);
[email protected]91070342014-03-07 00:29:02277 virtual void clearContextMenu();
[email protected]180ef242013-11-07 06:50:46278 virtual void willRequestAfterPreconnect(blink::WebFrame* frame,
279 blink::WebURLRequest& request);
[email protected]85d85fd2013-06-19 00:57:41280 virtual void willSendRequest(
[email protected]180ef242013-11-07 06:50:46281 blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41282 unsigned identifier,
[email protected]180ef242013-11-07 06:50:46283 blink::WebURLRequest& request,
284 const blink::WebURLResponse& redirect_response);
[email protected]85d85fd2013-06-19 00:57:41285 virtual void didReceiveResponse(
[email protected]180ef242013-11-07 06:50:46286 blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41287 unsigned identifier,
[email protected]180ef242013-11-07 06:50:46288 const blink::WebURLResponse& response);
289 virtual void didFinishResourceLoad(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14290 unsigned identifier);
[email protected]85d85fd2013-06-19 00:57:41291 virtual void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46292 blink::WebFrame* frame,
293 const blink::WebURLRequest& request,
294 const blink::WebURLResponse& response);
295 virtual void didDisplayInsecureContent(blink::WebFrame* frame);
296 virtual void didRunInsecureContent(blink::WebFrame* frame,
297 const blink::WebSecurityOrigin& origin,
298 const blink::WebURL& target);
299 virtual void didAbortLoading(blink::WebFrame* frame);
[email protected]180ef242013-11-07 06:50:46300 virtual void didCreateScriptContext(blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41301 v8::Handle<v8::Context> context,
302 int extension_group,
[email protected]255eea092013-06-28 17:19:14303 int world_id);
[email protected]180ef242013-11-07 06:50:46304 virtual void willReleaseScriptContext(blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41305 v8::Handle<v8::Context> context,
[email protected]255eea092013-06-28 17:19:14306 int world_id);
[email protected]180ef242013-11-07 06:50:46307 virtual void didFirstVisuallyNonEmptyLayout(blink::WebFrame* frame);
308 virtual void didChangeContentsSize(blink::WebFrame* frame,
309 const blink::WebSize& size);
310 virtual void didChangeScrollOffset(blink::WebFrame* frame);
311 virtual void willInsertBody(blink::WebFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41312 virtual void reportFindInPageMatchCount(int request_id,
313 int count,
[email protected]255eea092013-06-28 17:19:14314 bool final_update);
[email protected]85d85fd2013-06-19 00:57:41315 virtual void reportFindInPageSelection(int request_id,
316 int active_match_ordinal,
[email protected]180ef242013-11-07 06:50:46317 const blink::WebRect& sel);
[email protected]85d85fd2013-06-19 00:57:41318 virtual void requestStorageQuota(
[email protected]180ef242013-11-07 06:50:46319 blink::WebFrame* frame,
320 blink::WebStorageQuotaType type,
[email protected]85d85fd2013-06-19 00:57:41321 unsigned long long requested_size,
[email protected]45868f072014-02-06 11:58:59322 blink::WebStorageQuotaCallbacks callbacks);
[email protected]85d85fd2013-06-19 00:57:41323 virtual void willOpenSocketStream(
[email protected]180ef242013-11-07 06:50:46324 blink::WebSocketStreamHandle* handle);
[email protected]85d85fd2013-06-19 00:57:41325 virtual void willStartUsingPeerConnectionHandler(
[email protected]180ef242013-11-07 06:50:46326 blink::WebFrame* frame,
327 blink::WebRTCPeerConnectionHandler* handler);
[email protected]85d85fd2013-06-19 00:57:41328 virtual bool willCheckAndDispatchMessageEvent(
[email protected]180ef242013-11-07 06:50:46329 blink::WebFrame* sourceFrame,
330 blink::WebFrame* targetFrame,
331 blink::WebSecurityOrigin targetOrigin,
332 blink::WebDOMMessageEvent event);
333 virtual blink::WebString userAgentOverride(
334 blink::WebFrame* frame,
335 const blink::WebURL& url);
336 virtual blink::WebString doNotTrackValue(blink::WebFrame* frame);
337 virtual bool allowWebGL(blink::WebFrame* frame, bool default_value);
338 virtual void didLoseWebGLContext(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14339 int arb_robustness_status_code);
[email protected]5cdd8fd82014-02-05 20:12:12340 virtual void forwardInputEvent(const blink::WebInputEvent* event);
[email protected]9ef43adc2014-02-19 08:02:15341 virtual void initializeChildFrame(const blink::WebRect& frame_rect,
342 float scale_factor);
[email protected]85d85fd2013-06-19 00:57:41343
[email protected]c6bc20332014-02-28 18:30:39344 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
345 // this back to private member.
346 void OnNavigate(const FrameMsg_Navigate_Params& params);
347
[email protected]2f61bdd2013-07-02 18:38:47348 protected:
349 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
350
[email protected]227692c52013-05-31 22:43:04351 private:
[email protected]2e2d9632013-12-03 00:55:26352 friend class RenderFrameObserver;
[email protected]a09d53ce2014-01-31 00:46:42353 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
354 ShouldUpdateSelectionTextFromContextMenuParams);
[email protected]4ee64622014-03-21 22:34:15355 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
356 OnExtendSelectionAndDelete);
357 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
358 SetEditableSelectionAndComposition);
[email protected]2e2d9632013-12-03 00:55:26359
[email protected]37567b432014-02-12 01:12:22360 typedef std::map<GURL, double> HostZoomLevels;
361
[email protected]2e2d9632013-12-03 00:55:26362 // Functions to add and remove observers for this object.
363 void AddObserver(RenderFrameObserver* observer);
364 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34365
[email protected]37567b432014-02-12 01:12:22366 void UpdateURL(blink::WebFrame* frame);
367
[email protected]9c9343b2014-03-08 02:56:07368 // Gets the focused element. If no such element exists then the element will
369 // be NULL.
370 blink::WebElement GetFocusedElement();
371
[email protected]b70da4c2014-01-06 19:57:09372 // IPC message handlers ------------------------------------------------------
373 //
374 // The documentation for these functions should be in
375 // content/common/*_messages.h for the message that the function is handling.
[email protected]f76f32232014-03-11 17:36:17376 void OnBeforeUnload();
[email protected]b70da4c2014-01-06 19:57:09377 void OnSwapOut();
[email protected]f49722f2014-01-30 17:54:50378 void OnChildFrameProcessGone();
[email protected]bffc8302014-01-23 20:52:16379 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params);
380 void OnCompositorFrameSwapped(const IPC::Message& message);
[email protected]a09d53ce2014-01-31 00:46:42381 void OnShowContextMenu(const gfx::Point& location);
382 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
383 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
384 unsigned action);
[email protected]4ee64622014-03-21 22:34:15385 void OnUndo();
386 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07387 void OnCut();
388 void OnCopy();
389 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15390 void OnPasteAndMatchStyle();
391 void OnDelete();
392 void OnSelectAll();
393 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
394 void OnUnselect();
[email protected]e31b8ebb2014-03-07 17:59:34395 void OnCSSInsertRequest(const std::string& css);
[email protected]f13ab892014-03-12 06:48:52396 void OnJavaScriptExecuteRequest(const base::string16& javascript,
397 int id,
398 bool notify_result);
[email protected]4ee64622014-03-21 22:34:15399 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16400 void OnSetCompositionFromExistingText(
401 int start, int end,
402 const std::vector<blink::WebCompositionUnderline>& underlines);
403 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4ee64622014-03-21 22:34:15404#if defined(OS_MACOSX)
405 void OnCopyToFindPboard();
406#endif
[email protected]9c9343b2014-03-08 02:56:07407
[email protected]65920f332014-03-04 21:14:18408 // Virtual since overridden by WebTestProxy for layout tests.
409 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
410 RenderFrame* render_frame,
411 blink::WebFrame* frame,
412 blink::WebDataSource::ExtraData* extraData,
413 const blink::WebURLRequest& request,
414 blink::WebNavigationType type,
415 blink::WebNavigationPolicy default_policy,
416 bool is_redirect);
417 void OpenURL(blink::WebFrame* frame,
418 const GURL& url,
419 const Referrer& referrer,
420 blink::WebNavigationPolicy policy);
[email protected]a09d53ce2014-01-31 00:46:42421
[email protected]4ee64622014-03-21 22:34:15422 // Dispatches the current state of selection on the webpage to the browser if
423 // it has changed.
424 // TODO(varunjain): delete this method once we figure out how to keep
425 // selection handles in sync with the webpage.
426 void SyncSelectionIfRequired();
427
[email protected]a09d53ce2014-01-31 00:46:42428 // Returns whether |params.selection_text| should be synchronized to the
429 // browser before bringing up the context menu. Static for testing.
430 static bool ShouldUpdateSelectionTextFromContextMenuParams(
431 const base::string16& selection_text,
432 size_t selection_text_offset,
433 const gfx::Range& selection_range,
434 const ContextMenuParams& params);
[email protected]b70da4c2014-01-06 19:57:09435
[email protected]a5ac6dc2014-01-15 07:02:14436 // Stores the WebFrame we are associated with.
[email protected]b70da4c2014-01-06 19:57:09437 blink::WebFrame* frame_;
438
[email protected]abc501e2014-01-27 19:27:26439 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04440 int routing_id_;
[email protected]6dd5c322014-03-12 07:58:46441 bool is_loading_;
[email protected]1c2052f2013-08-28 08:24:34442 bool is_swapped_out_;
443 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04444
[email protected]7a4e2532013-12-02 21:30:02445#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02446 // Current text input composition text. Empty if no composition is in
447 // progress.
[email protected]fcf75d42013-12-03 20:11:26448 base::string16 pepper_composition_text_;
[email protected]7a4e2532013-12-02 21:30:02449#endif
450
[email protected]f3add922013-12-20 23:17:16451 RendererWebCookieJarImpl cookie_jar_;
452
[email protected]2e2d9632013-12-03 00:55:26453 // All the registered observers.
454 ObserverList<RenderFrameObserver> observers_;
455
[email protected]bffc8302014-01-23 20:52:16456 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
457
[email protected]4ecee352014-03-11 21:12:19458 // The node that the context menu was pressed over.
459 blink::WebNode context_menu_node_;
460
[email protected]a09d53ce2014-01-31 00:46:42461 // External context menu requests we're waiting for. "Internal"
462 // (WebKit-originated) context menu events will have an ID of 0 and will not
463 // be in this map.
464 //
465 // We don't want to add internal ones since some of the "special" page
466 // handlers in the browser process just ignore the context menu requests so
467 // avoid showing context menus, and so this will cause right clicks to leak
468 // entries in this map. Most users of the custom context menu (e.g. Pepper
469 // plugins) are normally only on "regular" pages and the regular pages will
470 // always respond properly to the request, so we don't have to worry so
471 // much about leaks.
472 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
473
[email protected]4ee64622014-03-21 22:34:15474 // The text selection the last time DidChangeSelection got called. May contain
475 // additional characters before and after the selected text, for IMEs. The
476 // portion of this string that is the actual selected text starts at index
477 // |selection_range_.GetMin() - selection_text_offset_| and has length
478 // |selection_range_.length()|.
479 base::string16 selection_text_;
480 // The offset corresponding to the start of |selection_text_| in the document.
481 size_t selection_text_offset_;
482 // Range over the document corresponding to the actual selected text (which
483 // could correspond to a substring of |selection_text_|; see above).
484 gfx::Range selection_range_;
485 // Used to inform didChangeSelection() when it is called in the context
486 // of handling a InputMsg_SelectRange IPC.
487 bool handling_select_range_;
488
[email protected]227692c52013-05-31 22:43:04489 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
490};
491
492} // namespace content
493
[email protected]85d85fd2013-06-19 00:57:41494#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_