blob: 1a313013bde1f82992208cb8ffe9ccfa09a6a50c [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);
[email protected]180ef242013-11-07 06:50:46239 virtual void willSendSubmitEvent(blink::WebFrame* frame,
240 const blink::WebFormElement& form);
241 virtual void willSubmitForm(blink::WebFrame* frame,
242 const blink::WebFormElement& form);
243 virtual void didCreateDataSource(blink::WebFrame* frame,
244 blink::WebDataSource* datasource);
245 virtual void didStartProvisionalLoad(blink::WebFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41246 virtual void didReceiveServerRedirectForProvisionalLoad(
[email protected]180ef242013-11-07 06:50:46247 blink::WebFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41248 virtual void didFailProvisionalLoad(
[email protected]180ef242013-11-07 06:50:46249 blink::WebFrame* frame,
250 const blink::WebURLError& error);
251 virtual void didCommitProvisionalLoad(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14252 bool is_new_navigation);
[email protected]c4f80f72014-01-13 11:24:12253 virtual void didClearWindowObject(blink::WebFrame* frame, int world_id);
[email protected]180ef242013-11-07 06:50:46254 virtual void didCreateDocumentElement(blink::WebFrame* frame);
255 virtual void didReceiveTitle(blink::WebFrame* frame,
256 const blink::WebString& title,
257 blink::WebTextDirection direction);
258 virtual void didChangeIcon(blink::WebFrame* frame,
259 blink::WebIconURL::Type icon_type);
260 virtual void didFinishDocumentLoad(blink::WebFrame* frame);
261 virtual void didHandleOnloadEvents(blink::WebFrame* frame);
262 virtual void didFailLoad(blink::WebFrame* frame,
263 const blink::WebURLError& error);
264 virtual void didFinishLoad(blink::WebFrame* frame);
265 virtual void didNavigateWithinPage(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14266 bool is_new_navigation);
[email protected]180ef242013-11-07 06:50:46267 virtual void didUpdateCurrentHistoryItem(blink::WebFrame* frame);
[email protected]c3f2c702014-03-19 23:39:48268 virtual void didChangeSelection(bool is_empty_selection);
[email protected]12cc5112014-03-03 17:01:10269 virtual void showContextMenu(const blink::WebContextMenuData& data);
[email protected]91070342014-03-07 00:29:02270 virtual void clearContextMenu();
[email protected]180ef242013-11-07 06:50:46271 virtual void willRequestAfterPreconnect(blink::WebFrame* frame,
272 blink::WebURLRequest& request);
[email protected]85d85fd2013-06-19 00:57:41273 virtual void willSendRequest(
[email protected]180ef242013-11-07 06:50:46274 blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41275 unsigned identifier,
[email protected]180ef242013-11-07 06:50:46276 blink::WebURLRequest& request,
277 const blink::WebURLResponse& redirect_response);
[email protected]85d85fd2013-06-19 00:57:41278 virtual void didReceiveResponse(
[email protected]180ef242013-11-07 06:50:46279 blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41280 unsigned identifier,
[email protected]180ef242013-11-07 06:50:46281 const blink::WebURLResponse& response);
282 virtual void didFinishResourceLoad(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14283 unsigned identifier);
[email protected]85d85fd2013-06-19 00:57:41284 virtual void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46285 blink::WebFrame* frame,
286 const blink::WebURLRequest& request,
287 const blink::WebURLResponse& response);
288 virtual void didDisplayInsecureContent(blink::WebFrame* frame);
289 virtual void didRunInsecureContent(blink::WebFrame* frame,
290 const blink::WebSecurityOrigin& origin,
291 const blink::WebURL& target);
292 virtual void didAbortLoading(blink::WebFrame* frame);
[email protected]180ef242013-11-07 06:50:46293 virtual void didCreateScriptContext(blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41294 v8::Handle<v8::Context> context,
295 int extension_group,
[email protected]255eea092013-06-28 17:19:14296 int world_id);
[email protected]180ef242013-11-07 06:50:46297 virtual void willReleaseScriptContext(blink::WebFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41298 v8::Handle<v8::Context> context,
[email protected]255eea092013-06-28 17:19:14299 int world_id);
[email protected]180ef242013-11-07 06:50:46300 virtual void didFirstVisuallyNonEmptyLayout(blink::WebFrame* frame);
301 virtual void didChangeContentsSize(blink::WebFrame* frame,
302 const blink::WebSize& size);
303 virtual void didChangeScrollOffset(blink::WebFrame* frame);
304 virtual void willInsertBody(blink::WebFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41305 virtual void reportFindInPageMatchCount(int request_id,
306 int count,
[email protected]255eea092013-06-28 17:19:14307 bool final_update);
[email protected]85d85fd2013-06-19 00:57:41308 virtual void reportFindInPageSelection(int request_id,
309 int active_match_ordinal,
[email protected]180ef242013-11-07 06:50:46310 const blink::WebRect& sel);
[email protected]85d85fd2013-06-19 00:57:41311 virtual void requestStorageQuota(
[email protected]180ef242013-11-07 06:50:46312 blink::WebFrame* frame,
313 blink::WebStorageQuotaType type,
[email protected]85d85fd2013-06-19 00:57:41314 unsigned long long requested_size,
[email protected]45868f072014-02-06 11:58:59315 blink::WebStorageQuotaCallbacks callbacks);
[email protected]85d85fd2013-06-19 00:57:41316 virtual void willOpenSocketStream(
[email protected]180ef242013-11-07 06:50:46317 blink::WebSocketStreamHandle* handle);
[email protected]85d85fd2013-06-19 00:57:41318 virtual void willStartUsingPeerConnectionHandler(
[email protected]180ef242013-11-07 06:50:46319 blink::WebFrame* frame,
320 blink::WebRTCPeerConnectionHandler* handler);
[email protected]85d85fd2013-06-19 00:57:41321 virtual bool willCheckAndDispatchMessageEvent(
[email protected]180ef242013-11-07 06:50:46322 blink::WebFrame* sourceFrame,
323 blink::WebFrame* targetFrame,
324 blink::WebSecurityOrigin targetOrigin,
325 blink::WebDOMMessageEvent event);
326 virtual blink::WebString userAgentOverride(
327 blink::WebFrame* frame,
328 const blink::WebURL& url);
329 virtual blink::WebString doNotTrackValue(blink::WebFrame* frame);
330 virtual bool allowWebGL(blink::WebFrame* frame, bool default_value);
331 virtual void didLoseWebGLContext(blink::WebFrame* frame,
[email protected]255eea092013-06-28 17:19:14332 int arb_robustness_status_code);
[email protected]5cdd8fd82014-02-05 20:12:12333 virtual void forwardInputEvent(const blink::WebInputEvent* event);
[email protected]9ef43adc2014-02-19 08:02:15334 virtual void initializeChildFrame(const blink::WebRect& frame_rect,
335 float scale_factor);
[email protected]85d85fd2013-06-19 00:57:41336
[email protected]c6bc20332014-02-28 18:30:39337 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
338 // this back to private member.
339 void OnNavigate(const FrameMsg_Navigate_Params& params);
340
[email protected]2f61bdd2013-07-02 18:38:47341 protected:
342 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
343
[email protected]227692c52013-05-31 22:43:04344 private:
[email protected]2e2d9632013-12-03 00:55:26345 friend class RenderFrameObserver;
[email protected]66bbadaf2014-03-28 16:25:54346 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
347 AccessibilityMessagesQueueWhileSwappedOut);
348 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
[email protected]a09d53ce2014-01-31 00:46:42349 ShouldUpdateSelectionTextFromContextMenuParams);
[email protected]4ee64622014-03-21 22:34:15350 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
351 OnExtendSelectionAndDelete);
[email protected]66bbadaf2014-03-28 16:25:54352 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut);
353 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]4ee64622014-03-21 22:34:15354 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
355 SetEditableSelectionAndComposition);
[email protected]2e2d9632013-12-03 00:55:26356
[email protected]37567b432014-02-12 01:12:22357 typedef std::map<GURL, double> HostZoomLevels;
358
[email protected]2e2d9632013-12-03 00:55:26359 // Functions to add and remove observers for this object.
360 void AddObserver(RenderFrameObserver* observer);
361 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34362
[email protected]37567b432014-02-12 01:12:22363 void UpdateURL(blink::WebFrame* frame);
364
[email protected]9c9343b2014-03-08 02:56:07365 // Gets the focused element. If no such element exists then the element will
366 // be NULL.
367 blink::WebElement GetFocusedElement();
368
[email protected]b70da4c2014-01-06 19:57:09369 // IPC message handlers ------------------------------------------------------
370 //
371 // The documentation for these functions should be in
372 // content/common/*_messages.h for the message that the function is handling.
[email protected]f76f32232014-03-11 17:36:17373 void OnBeforeUnload();
[email protected]b70da4c2014-01-06 19:57:09374 void OnSwapOut();
[email protected]f49722f2014-01-30 17:54:50375 void OnChildFrameProcessGone();
[email protected]bffc8302014-01-23 20:52:16376 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params);
377 void OnCompositorFrameSwapped(const IPC::Message& message);
[email protected]a09d53ce2014-01-31 00:46:42378 void OnShowContextMenu(const gfx::Point& location);
379 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
380 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
381 unsigned action);
[email protected]4ee64622014-03-21 22:34:15382 void OnUndo();
383 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07384 void OnCut();
385 void OnCopy();
386 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15387 void OnPasteAndMatchStyle();
388 void OnDelete();
389 void OnSelectAll();
390 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
391 void OnUnselect();
[email protected]e31b8ebb2014-03-07 17:59:34392 void OnCSSInsertRequest(const std::string& css);
[email protected]f13ab892014-03-12 06:48:52393 void OnJavaScriptExecuteRequest(const base::string16& javascript,
394 int id,
395 bool notify_result);
[email protected]4ee64622014-03-21 22:34:15396 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16397 void OnSetCompositionFromExistingText(
398 int start, int end,
399 const std::vector<blink::WebCompositionUnderline>& underlines);
400 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00401 void OnReload(bool ignore_cache);
[email protected]4ee64622014-03-21 22:34:15402#if defined(OS_MACOSX)
403 void OnCopyToFindPboard();
404#endif
[email protected]9c9343b2014-03-08 02:56:07405
[email protected]65920f332014-03-04 21:14:18406 // Virtual since overridden by WebTestProxy for layout tests.
407 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
408 RenderFrame* render_frame,
409 blink::WebFrame* frame,
410 blink::WebDataSource::ExtraData* extraData,
411 const blink::WebURLRequest& request,
412 blink::WebNavigationType type,
413 blink::WebNavigationPolicy default_policy,
414 bool is_redirect);
415 void OpenURL(blink::WebFrame* frame,
416 const GURL& url,
417 const Referrer& referrer,
418 blink::WebNavigationPolicy policy);
[email protected]a09d53ce2014-01-31 00:46:42419
[email protected]4ee64622014-03-21 22:34:15420 // Dispatches the current state of selection on the webpage to the browser if
421 // it has changed.
422 // TODO(varunjain): delete this method once we figure out how to keep
423 // selection handles in sync with the webpage.
424 void SyncSelectionIfRequired();
425
[email protected]a09d53ce2014-01-31 00:46:42426 // Returns whether |params.selection_text| should be synchronized to the
427 // browser before bringing up the context menu. Static for testing.
428 static bool ShouldUpdateSelectionTextFromContextMenuParams(
429 const base::string16& selection_text,
430 size_t selection_text_offset,
431 const gfx::Range& selection_range,
432 const ContextMenuParams& params);
[email protected]b70da4c2014-01-06 19:57:09433
[email protected]a5ac6dc2014-01-15 07:02:14434 // Stores the WebFrame we are associated with.
[email protected]b70da4c2014-01-06 19:57:09435 blink::WebFrame* frame_;
436
[email protected]abc501e2014-01-27 19:27:26437 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04438 int routing_id_;
[email protected]6dd5c322014-03-12 07:58:46439 bool is_loading_;
[email protected]1c2052f2013-08-28 08:24:34440 bool is_swapped_out_;
441 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04442
[email protected]7a4e2532013-12-02 21:30:02443#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02444 // Current text input composition text. Empty if no composition is in
445 // progress.
[email protected]fcf75d42013-12-03 20:11:26446 base::string16 pepper_composition_text_;
[email protected]7a4e2532013-12-02 21:30:02447#endif
448
[email protected]f3add922013-12-20 23:17:16449 RendererWebCookieJarImpl cookie_jar_;
450
[email protected]2e2d9632013-12-03 00:55:26451 // All the registered observers.
452 ObserverList<RenderFrameObserver> observers_;
453
[email protected]bffc8302014-01-23 20:52:16454 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
455
[email protected]4ecee352014-03-11 21:12:19456 // The node that the context menu was pressed over.
457 blink::WebNode context_menu_node_;
458
[email protected]a09d53ce2014-01-31 00:46:42459 // External context menu requests we're waiting for. "Internal"
460 // (WebKit-originated) context menu events will have an ID of 0 and will not
461 // be in this map.
462 //
463 // We don't want to add internal ones since some of the "special" page
464 // handlers in the browser process just ignore the context menu requests so
465 // avoid showing context menus, and so this will cause right clicks to leak
466 // entries in this map. Most users of the custom context menu (e.g. Pepper
467 // plugins) are normally only on "regular" pages and the regular pages will
468 // always respond properly to the request, so we don't have to worry so
469 // much about leaks.
470 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
471
[email protected]4ee64622014-03-21 22:34:15472 // The text selection the last time DidChangeSelection got called. May contain
473 // additional characters before and after the selected text, for IMEs. The
474 // portion of this string that is the actual selected text starts at index
475 // |selection_range_.GetMin() - selection_text_offset_| and has length
476 // |selection_range_.length()|.
477 base::string16 selection_text_;
478 // The offset corresponding to the start of |selection_text_| in the document.
479 size_t selection_text_offset_;
480 // Range over the document corresponding to the actual selected text (which
481 // could correspond to a substring of |selection_text_|; see above).
482 gfx::Range selection_range_;
483 // Used to inform didChangeSelection() when it is called in the context
484 // of handling a InputMsg_SelectRange IPC.
485 bool handling_select_range_;
486
[email protected]227692c52013-05-31 22:43:04487 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
488};
489
490} // namespace content
491
[email protected]85d85fd2013-06-19 00:57:41492#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_