blob: 5e924a2f170d920edcfdb72ea2fc2cd51dbaba89 [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]87de04b02014-04-08 22:14:4917#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1818#include "content/public/common/referrer.h"
[email protected]227692c52013-05-31 22:43:0419#include "content/public/renderer/render_frame.h"
[email protected]f3add922013-12-20 23:17:1620#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0421#include "ipc/ipc_message.h"
[email protected]85d85fd2013-06-19 00:57:4122#include "third_party/WebKit/public/web/WebDataSource.h"
23#include "third_party/WebKit/public/web/WebFrameClient.h"
[email protected]680575542014-04-03 17:12:5224#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
[email protected]4ee64622014-03-21 22:34:1525#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0426
[email protected]7a4e2532013-12-02 21:30:0227class TransportDIB;
[email protected]bffc8302014-01-23 20:52:1628struct FrameMsg_BuffersSwapped_Params;
29struct FrameMsg_CompositorFrameSwapped_Params;
[email protected]c6bc20332014-02-28 18:30:3930struct FrameMsg_Navigate_Params;
[email protected]7a4e2532013-12-02 21:30:0231
32namespace blink {
[email protected]5cdd8fd82014-02-05 20:12:1233class WebInputEvent;
[email protected]7a4e2532013-12-02 21:30:0234class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2635class WebContentDecryptionModule;
[email protected]8538385f2014-04-25 19:45:0436class WebMIDIClient;
[email protected]1c048252014-04-11 23:27:3437class WebNotificationPresenter;
[email protected]82ce5b92014-03-22 05:15:2638class WebSecurityOrigin;
[email protected]bfe45e22014-04-25 16:47:5339class WebUserMediaClient;
[email protected]7a4e2532013-12-02 21:30:0240struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4241struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0242struct WebCursorInfo;
43}
44
45namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4246class Point;
[email protected]7a4e2532013-12-02 21:30:0247class Range;
48class Rect;
49}
50
[email protected]227692c52013-05-31 22:43:0451namespace content {
52
[email protected]bffc8302014-01-23 20:52:1653class ChildFrameCompositingHelper;
[email protected]2626d142014-04-22 17:24:0254class NotificationProvider;
[email protected]7a4e2532013-12-02 21:30:0255class PepperPluginInstanceImpl;
56class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:2657class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:0458class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:0259class RenderWidget;
60class RenderWidgetFullscreenPepper;
[email protected]a09d53ce2014-01-31 00:46:4261struct CustomContextMenuContext;
[email protected]227692c52013-05-31 22:43:0462
[email protected]85d85fd2013-06-19 00:57:4163class CONTENT_EXPORT RenderFrameImpl
64 : public RenderFrame,
[email protected]180ef242013-11-07 06:50:4665 NON_EXPORTED_BASE(public blink::WebFrameClient) {
[email protected]227692c52013-05-31 22:43:0466 public:
[email protected]2f61bdd2013-07-02 18:38:4767 // Creates a new RenderFrame. |render_view| is the RenderView object that this
68 // frame belongs to.
[email protected]b70da4c2014-01-06 19:57:0969 // Callers *must* call |SetWebFrame| immediately after creation.
70 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
[email protected]2f61bdd2013-07-02 18:38:4771 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
72
[email protected]a5ac6dc2014-01-15 07:02:1473 // Just like RenderFrame::FromWebFrame but returns the implementation.
74 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:0975
[email protected]2f61bdd2013-07-02 18:38:4776 // Used by content_layouttest_support to hook into the creation of
77 // RenderFrameImpls.
78 static void InstallCreateHook(
79 RenderFrameImpl* (*create_render_frame_impl)(RenderViewImpl*, int32));
80
[email protected]227692c52013-05-31 22:43:0481 virtual ~RenderFrameImpl();
82
[email protected]b70da4c2014-01-06 19:57:0983 bool is_swapped_out() const {
84 return is_swapped_out_;
85 }
86
[email protected]bffc8302014-01-23 20:52:1687 // Out-of-process child frames receive a signal from RenderWidgetCompositor
88 // when a compositor frame has committed.
89 void DidCommitCompositorFrame();
90
[email protected]7a4e2532013-12-02 21:30:0291 // TODO(jam): this is a temporary getter until all the code is transitioned
92 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:2693 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:0294
[email protected]f3add922013-12-20 23:17:1695 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
96
[email protected]7a4e2532013-12-02 21:30:0297 // Returns the RenderWidget associated with this frame.
98 RenderWidget* GetRenderWidget();
99
[email protected]35b2a972014-04-04 15:50:22100 // This is called right after creation with the WebLocalFrame for this
[email protected]0287e762014-04-11 13:07:58101 // RenderFrame. It must be called before Initialize.
[email protected]35b2a972014-04-04 15:50:22102 void SetWebFrame(blink::WebLocalFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09103
[email protected]0287e762014-04-11 13:07:58104 // This method must be called after the frame has been added to the frame
105 // tree. It creates all objects that depend on the frame being at its proper
106 // spot.
107 void Initialize();
108
[email protected]5815cf52014-01-29 17:45:05109 // Notification from RenderView.
110 virtual void OnStop();
111
[email protected]723971b2014-02-12 11:08:25112 // Start/Stop loading notifications.
113 // TODO(nasko): Those are page-level methods at this time and come from
114 // WebViewClient. We should move them to be WebFrameClient calls and put
115 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09116 // |to_different_document| will be true unless the load is a fragment
117 // navigation, or triggered by history.pushState/replaceState.
[email protected]6dd5c322014-03-12 07:58:46118 virtual void didStartLoading(bool to_different_document);
119 virtual void didStopLoading();
120 virtual void didChangeLoadProgress(double load_progress);
[email protected]723971b2014-02-12 11:08:25121
[email protected]7a4e2532013-12-02 21:30:02122#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31123 // Notification that a PPAPI plugin has been created.
124 void PepperPluginCreated(RendererPpapiHost* host);
125
[email protected]7a4e2532013-12-02 21:30:02126 // Notifies that |instance| has changed the cursor.
127 // This will update the cursor appearance if it is currently over the plugin
128 // instance.
129 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
130 const blink::WebCursorInfo& cursor);
131
132 // Notifies that |instance| has received a mouse event.
133 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
134
[email protected]7a4e2532013-12-02 21:30:02135 // Informs the render view that a PPAPI plugin has changed text input status.
136 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
137 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
138
139 // Cancels current composition.
140 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
141
142 // Informs the render view that a PPAPI plugin has changed selection.
143 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
144
145 // Creates a fullscreen container for a pepper plugin instance.
146 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
147 PepperPluginInstanceImpl* plugin);
148
[email protected]7a4e2532013-12-02 21:30:02149 bool IsPepperAcceptingCompositionEvents() const;
150
151 // Notification that the given plugin has crashed.
152 void PluginCrashed(const base::FilePath& plugin_path,
153 base::ProcessId plugin_pid);
154
[email protected]7a4e2532013-12-02 21:30:02155 // Simulates IME events for testing purpose.
156 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26157 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02158 const std::vector<blink::WebCompositionUnderline>& underlines,
159 int selection_start,
160 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26161 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02162 const gfx::Range& replacement_range);
163
164 // TODO(jam): remove these once the IPC handler moves from RenderView to
165 // RenderFrame.
166 void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26167 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02168 const std::vector<blink::WebCompositionUnderline>& underlines,
169 int selection_start,
170 int selection_end);
171 void OnImeConfirmComposition(
[email protected]fcf75d42013-12-03 20:11:26172 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02173 const gfx::Range& replacement_range,
174 bool keep_selection);
[email protected]7a4e2532013-12-02 21:30:02175#endif // ENABLE_PLUGINS
176
[email protected]227692c52013-05-31 22:43:04177 // IPC::Sender
178 virtual bool Send(IPC::Message* msg) OVERRIDE;
179
180 // IPC::Listener
181 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
182
[email protected]271ff5792013-12-04 22:29:31183 // RenderFrame implementation:
[email protected]b849847b2013-12-10 21:57:58184 virtual RenderView* GetRenderView() OVERRIDE;
[email protected]60eca4eb2013-12-06 00:02:16185 virtual int GetRoutingID() OVERRIDE;
[email protected]a5ac6dc2014-01-15 07:02:14186 virtual blink::WebFrame* GetWebFrame() OVERRIDE;
[email protected]d019e1a382013-12-11 17:52:06187 virtual WebPreferences& GetWebkitPreferences() OVERRIDE;
188 virtual int ShowContextMenu(ContextMenuClient* client,
189 const ContextMenuParams& params) OVERRIDE;
190 virtual void CancelContextMenu(int request_id) OVERRIDE;
[email protected]1a6d0112014-03-10 19:08:41191 virtual blink::WebNode GetContextMenuNode() const OVERRIDE;
[email protected]271ff5792013-12-04 22:29:31192 virtual blink::WebPlugin* CreatePlugin(
193 blink::WebFrame* frame,
194 const WebPluginInfo& info,
195 const blink::WebPluginParams& params) OVERRIDE;
[email protected]35b2a972014-04-04 15:50:22196 virtual void LoadURLExternally(blink::WebLocalFrame* frame,
197 const blink::WebURLRequest& request,
198 blink::WebNavigationPolicy policy) OVERRIDE;
[email protected]db3be76f2014-03-25 02:27:47199 virtual void ExecuteJavaScript(const base::string16& javascript) OVERRIDE;
[email protected]271ff5792013-12-04 22:29:31200
[email protected]180ef242013-11-07 06:50:46201 // blink::WebFrameClient implementation -------------------------------------
[email protected]35b2a972014-04-04 15:50:22202 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
203 const blink::WebPluginParams& params);
[email protected]180ef242013-11-07 06:50:46204 virtual blink::WebMediaPlayer* createMediaPlayer(
[email protected]35b2a972014-04-04 15:50:22205 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46206 const blink::WebURL& url,
207 blink::WebMediaPlayerClient* client);
[email protected]82ce5b92014-03-22 05:15:26208 virtual blink::WebContentDecryptionModule* createContentDecryptionModule(
[email protected]35b2a972014-04-04 15:50:22209 blink::WebLocalFrame* frame,
[email protected]82ce5b92014-03-22 05:15:26210 const blink::WebSecurityOrigin& security_origin,
211 const blink::WebString& key_system);
[email protected]180ef242013-11-07 06:50:46212 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
[email protected]35b2a972014-04-04 15:50:22213 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46214 blink::WebApplicationCacheHostClient* client);
215 virtual blink::WebWorkerPermissionClientProxy*
[email protected]35b2a972014-04-04 15:50:22216 createWorkerPermissionClientProxy(blink::WebLocalFrame* frame);
217 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46218 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
[email protected]35b2a972014-04-04 15:50:22219 blink::WebLocalFrame* frame);
220 virtual void didAccessInitialDocument(blink::WebLocalFrame* frame);
221 virtual blink::WebFrame* createChildFrame(blink::WebLocalFrame* parent,
222 const blink::WebString& name);
223 virtual void didDisownOpener(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46224 virtual void frameDetached(blink::WebFrame* frame);
[email protected]9c9343b2014-03-08 02:56:07225 virtual void frameFocused();
[email protected]180ef242013-11-07 06:50:46226 virtual void willClose(blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22227 virtual void didChangeName(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46228 const blink::WebString& name);
[email protected]f5b6dd1122013-10-04 02:42:50229 virtual void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22230 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46231 const blink::WebVector<blink::WebString>& newly_matching_selectors,
232 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
[email protected]c31a84802014-04-03 15:55:49233 virtual bool shouldReportDetailedMessageForSource(
234 const blink::WebString& source);
235 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
236 const blink::WebString& source_name,
237 unsigned source_line,
238 const blink::WebString& stack_trace);
[email protected]35b2a972014-04-04 15:50:22239 virtual void loadURLExternally(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46240 const blink::WebURLRequest& request,
[email protected]35b2a972014-04-04 15:50:22241 blink::WebNavigationPolicy policy,
242 const blink::WebString& suggested_name);
[email protected]1a4e9752013-12-31 20:10:58243 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
[email protected]180ef242013-11-07 06:50:46244 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
[email protected]35b2a972014-04-04 15:50:22245 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46246 blink::WebDataSource::ExtraData* extra_data,
247 const blink::WebURLRequest& request,
248 blink::WebNavigationType type,
249 blink::WebNavigationPolicy default_policy,
[email protected]f6ae17fc2013-08-19 22:56:17250 bool is_redirect);
[email protected]680575542014-04-03 17:12:52251 virtual blink::WebHistoryItem historyItemForNewChildFrame(
252 blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22253 virtual void willSendSubmitEvent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46254 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22255 virtual void willSubmitForm(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46256 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22257 virtual void didCreateDataSource(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46258 blink::WebDataSource* datasource);
[email protected]35b2a972014-04-04 15:50:22259 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41260 virtual void didReceiveServerRedirectForProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22261 blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41262 virtual void didFailProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22263 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46264 const blink::WebURLError& error);
[email protected]680575542014-04-03 17:12:52265 virtual void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22266 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52267 const blink::WebHistoryItem& item,
268 blink::WebHistoryCommitType commit_type);
[email protected]35b2a972014-04-04 15:50:22269 virtual void didClearWindowObject(blink::WebLocalFrame* frame, int world_id);
270 virtual void didCreateDocumentElement(blink::WebLocalFrame* frame);
271 virtual void didReceiveTitle(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46272 const blink::WebString& title,
273 blink::WebTextDirection direction);
[email protected]35b2a972014-04-04 15:50:22274 virtual void didChangeIcon(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46275 blink::WebIconURL::Type icon_type);
[email protected]35b2a972014-04-04 15:50:22276 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame);
277 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame);
278 virtual void didFailLoad(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46279 const blink::WebURLError& error);
[email protected]45d877f2014-04-05 07:36:22280 virtual void didFinishLoad(blink::WebLocalFrame* frame);
281 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52282 const blink::WebHistoryItem& item,
283 blink::WebHistoryCommitType commit_type);
[email protected]35b2a972014-04-04 15:50:22284 virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
[email protected]1c048252014-04-11 23:27:34285 virtual blink::WebNotificationPresenter* notificationPresenter();
[email protected]c3f2c702014-03-19 23:39:48286 virtual void didChangeSelection(bool is_empty_selection);
[email protected]f3c59d62014-04-09 16:33:55287 virtual blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19288 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55289 const blink::WebColor& initial_color,
290 const blink::WebVector<blink::WebColorSuggestion>& suggestions);
[email protected]87de04b02014-04-08 22:14:49291 virtual void runModalAlertDialog(const blink::WebString& message);
292 virtual bool runModalConfirmDialog(const blink::WebString& message);
293 virtual bool runModalPromptDialog(const blink::WebString& message,
294 const blink::WebString& default_value,
295 blink::WebString* actual_value);
296 virtual bool runModalBeforeUnloadDialog(bool is_reload,
297 const blink::WebString& message);
[email protected]12cc5112014-03-03 17:01:10298 virtual void showContextMenu(const blink::WebContextMenuData& data);
[email protected]91070342014-03-07 00:29:02299 virtual void clearContextMenu();
[email protected]35b2a972014-04-04 15:50:22300 virtual void willRequestAfterPreconnect(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46301 blink::WebURLRequest& request);
[email protected]35b2a972014-04-04 15:50:22302 virtual void willSendRequest(blink::WebLocalFrame* frame,
303 unsigned identifier,
304 blink::WebURLRequest& request,
305 const blink::WebURLResponse& redirect_response);
306 virtual void didReceiveResponse(blink::WebLocalFrame* frame,
307 unsigned identifier,
308 const blink::WebURLResponse& response);
309 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14310 unsigned identifier);
[email protected]85d85fd2013-06-19 00:57:41311 virtual void didLoadResourceFromMemoryCache(
[email protected]35b2a972014-04-04 15:50:22312 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46313 const blink::WebURLRequest& request,
314 const blink::WebURLResponse& response);
[email protected]35b2a972014-04-04 15:50:22315 virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame);
316 virtual void didRunInsecureContent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46317 const blink::WebSecurityOrigin& origin,
318 const blink::WebURL& target);
[email protected]35b2a972014-04-04 15:50:22319 virtual void didAbortLoading(blink::WebLocalFrame* frame);
320 virtual void didCreateScriptContext(blink::WebLocalFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41321 v8::Handle<v8::Context> context,
322 int extension_group,
[email protected]255eea092013-06-28 17:19:14323 int world_id);
[email protected]35b2a972014-04-04 15:50:22324 virtual void willReleaseScriptContext(blink::WebLocalFrame* frame,
[email protected]85d85fd2013-06-19 00:57:41325 v8::Handle<v8::Context> context,
[email protected]255eea092013-06-28 17:19:14326 int world_id);
[email protected]35b2a972014-04-04 15:50:22327 virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame);
328 virtual void didChangeContentsSize(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46329 const blink::WebSize& size);
[email protected]35b2a972014-04-04 15:50:22330 virtual void didChangeScrollOffset(blink::WebLocalFrame* frame);
331 virtual void willInsertBody(blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41332 virtual void reportFindInPageMatchCount(int request_id,
333 int count,
[email protected]255eea092013-06-28 17:19:14334 bool final_update);
[email protected]85d85fd2013-06-19 00:57:41335 virtual void reportFindInPageSelection(int request_id,
336 int active_match_ordinal,
[email protected]180ef242013-11-07 06:50:46337 const blink::WebRect& sel);
[email protected]35b2a972014-04-04 15:50:22338 virtual void requestStorageQuota(blink::WebLocalFrame* frame,
339 blink::WebStorageQuotaType type,
340 unsigned long long requested_size,
341 blink::WebStorageQuotaCallbacks callbacks);
[email protected]85d85fd2013-06-19 00:57:41342 virtual void willOpenSocketStream(
[email protected]180ef242013-11-07 06:50:46343 blink::WebSocketStreamHandle* handle);
[email protected]85d85fd2013-06-19 00:57:41344 virtual void willStartUsingPeerConnectionHandler(
[email protected]35b2a972014-04-04 15:50:22345 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46346 blink::WebRTCPeerConnectionHandler* handler);
[email protected]bfe45e22014-04-25 16:47:53347 virtual blink::WebUserMediaClient* userMediaClient();
[email protected]8538385f2014-04-25 19:45:04348 virtual blink::WebMIDIClient* webMIDIClient();
[email protected]85d85fd2013-06-19 00:57:41349 virtual bool willCheckAndDispatchMessageEvent(
[email protected]35b2a972014-04-04 15:50:22350 blink::WebLocalFrame* sourceFrame,
[email protected]180ef242013-11-07 06:50:46351 blink::WebFrame* targetFrame,
352 blink::WebSecurityOrigin targetOrigin,
353 blink::WebDOMMessageEvent event);
[email protected]35b2a972014-04-04 15:50:22354 virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
355 const blink::WebURL& url);
356 virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame);
357 virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
358 virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14359 int arb_robustness_status_code);
[email protected]5cdd8fd82014-02-05 20:12:12360 virtual void forwardInputEvent(const blink::WebInputEvent* event);
[email protected]9ef43adc2014-02-19 08:02:15361 virtual void initializeChildFrame(const blink::WebRect& frame_rect,
362 float scale_factor);
[email protected]85d85fd2013-06-19 00:57:41363
[email protected]c6bc20332014-02-28 18:30:39364 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
365 // this back to private member.
366 void OnNavigate(const FrameMsg_Navigate_Params& params);
367
[email protected]2f61bdd2013-07-02 18:38:47368 protected:
369 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
370
[email protected]227692c52013-05-31 22:43:04371 private:
[email protected]2e2d9632013-12-03 00:55:26372 friend class RenderFrameObserver;
[email protected]66bbadaf2014-03-28 16:25:54373 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
374 AccessibilityMessagesQueueWhileSwappedOut);
375 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
[email protected]a09d53ce2014-01-31 00:46:42376 ShouldUpdateSelectionTextFromContextMenuParams);
[email protected]4ee64622014-03-21 22:34:15377 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
378 OnExtendSelectionAndDelete);
[email protected]66bbadaf2014-03-28 16:25:54379 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, ReloadWhileSwappedOut);
380 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest, SendSwapOutACK);
[email protected]4ee64622014-03-21 22:34:15381 FRIEND_TEST_ALL_PREFIXES(RenderViewImplTest,
382 SetEditableSelectionAndComposition);
[email protected]2e2d9632013-12-03 00:55:26383
[email protected]37567b432014-02-12 01:12:22384 typedef std::map<GURL, double> HostZoomLevels;
385
[email protected]2e2d9632013-12-03 00:55:26386 // Functions to add and remove observers for this object.
387 void AddObserver(RenderFrameObserver* observer);
388 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34389
[email protected]37567b432014-02-12 01:12:22390 void UpdateURL(blink::WebFrame* frame);
391
[email protected]9c9343b2014-03-08 02:56:07392 // Gets the focused element. If no such element exists then the element will
393 // be NULL.
394 blink::WebElement GetFocusedElement();
395
[email protected]b70da4c2014-01-06 19:57:09396 // IPC message handlers ------------------------------------------------------
397 //
398 // The documentation for these functions should be in
399 // content/common/*_messages.h for the message that the function is handling.
[email protected]f76f32232014-03-11 17:36:17400 void OnBeforeUnload();
[email protected]b70da4c2014-01-06 19:57:09401 void OnSwapOut();
[email protected]f49722f2014-01-30 17:54:50402 void OnChildFrameProcessGone();
[email protected]bffc8302014-01-23 20:52:16403 void OnBuffersSwapped(const FrameMsg_BuffersSwapped_Params& params);
404 void OnCompositorFrameSwapped(const IPC::Message& message);
[email protected]a09d53ce2014-01-31 00:46:42405 void OnShowContextMenu(const gfx::Point& location);
406 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
407 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
408 unsigned action);
[email protected]4ee64622014-03-21 22:34:15409 void OnUndo();
410 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07411 void OnCut();
412 void OnCopy();
413 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15414 void OnPasteAndMatchStyle();
415 void OnDelete();
416 void OnSelectAll();
417 void OnSelectRange(const gfx::Point& start, const gfx::Point& end);
418 void OnUnselect();
[email protected]1f3fc1d2014-04-03 14:50:17419 void OnReplace(const base::string16& text);
420 void OnReplaceMisspelling(const base::string16& text);
[email protected]e31b8ebb2014-03-07 17:59:34421 void OnCSSInsertRequest(const std::string& css);
[email protected]f13ab892014-03-12 06:48:52422 void OnJavaScriptExecuteRequest(const base::string16& javascript,
423 int id,
424 bool notify_result);
[email protected]4ee64622014-03-21 22:34:15425 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16426 void OnSetCompositionFromExistingText(
427 int start, int end,
428 const std::vector<blink::WebCompositionUnderline>& underlines);
429 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00430 void OnReload(bool ignore_cache);
[email protected]4ee64622014-03-21 22:34:15431#if defined(OS_MACOSX)
432 void OnCopyToFindPboard();
433#endif
[email protected]9c9343b2014-03-08 02:56:07434
[email protected]65920f332014-03-04 21:14:18435 // Virtual since overridden by WebTestProxy for layout tests.
436 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
437 RenderFrame* render_frame,
438 blink::WebFrame* frame,
439 blink::WebDataSource::ExtraData* extraData,
440 const blink::WebURLRequest& request,
441 blink::WebNavigationType type,
442 blink::WebNavigationPolicy default_policy,
443 bool is_redirect);
444 void OpenURL(blink::WebFrame* frame,
445 const GURL& url,
446 const Referrer& referrer,
447 blink::WebNavigationPolicy policy);
[email protected]a09d53ce2014-01-31 00:46:42448
[email protected]4ee64622014-03-21 22:34:15449 // Dispatches the current state of selection on the webpage to the browser if
450 // it has changed.
451 // TODO(varunjain): delete this method once we figure out how to keep
452 // selection handles in sync with the webpage.
453 void SyncSelectionIfRequired();
454
[email protected]a09d53ce2014-01-31 00:46:42455 // Returns whether |params.selection_text| should be synchronized to the
456 // browser before bringing up the context menu. Static for testing.
457 static bool ShouldUpdateSelectionTextFromContextMenuParams(
458 const base::string16& selection_text,
459 size_t selection_text_offset,
460 const gfx::Range& selection_range,
461 const ContextMenuParams& params);
[email protected]b70da4c2014-01-06 19:57:09462
[email protected]87de04b02014-04-08 22:14:49463 bool RunJavaScriptMessage(JavaScriptMessageType type,
464 const base::string16& message,
465 const base::string16& default_value,
466 const GURL& frame_url,
467 base::string16* result);
468
[email protected]35b2a972014-04-04 15:50:22469 // Stores the WebLocalFrame we are associated with.
470 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:09471
[email protected]abc501e2014-01-27 19:27:26472 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04473 int routing_id_;
[email protected]1c2052f2013-08-28 08:24:34474 bool is_swapped_out_;
475 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04476
[email protected]7a4e2532013-12-02 21:30:02477#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02478 // Current text input composition text. Empty if no composition is in
479 // progress.
[email protected]fcf75d42013-12-03 20:11:26480 base::string16 pepper_composition_text_;
[email protected]7a4e2532013-12-02 21:30:02481#endif
482
[email protected]f3add922013-12-20 23:17:16483 RendererWebCookieJarImpl cookie_jar_;
484
[email protected]2e2d9632013-12-03 00:55:26485 // All the registered observers.
486 ObserverList<RenderFrameObserver> observers_;
487
[email protected]bffc8302014-01-23 20:52:16488 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
489
[email protected]4ecee352014-03-11 21:12:19490 // The node that the context menu was pressed over.
491 blink::WebNode context_menu_node_;
492
[email protected]a09d53ce2014-01-31 00:46:42493 // External context menu requests we're waiting for. "Internal"
494 // (WebKit-originated) context menu events will have an ID of 0 and will not
495 // be in this map.
496 //
497 // We don't want to add internal ones since some of the "special" page
498 // handlers in the browser process just ignore the context menu requests so
499 // avoid showing context menus, and so this will cause right clicks to leak
500 // entries in this map. Most users of the custom context menu (e.g. Pepper
501 // plugins) are normally only on "regular" pages and the regular pages will
502 // always respond properly to the request, so we don't have to worry so
503 // much about leaks.
504 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
505
[email protected]4ee64622014-03-21 22:34:15506 // The text selection the last time DidChangeSelection got called. May contain
507 // additional characters before and after the selected text, for IMEs. The
508 // portion of this string that is the actual selected text starts at index
509 // |selection_range_.GetMin() - selection_text_offset_| and has length
510 // |selection_range_.length()|.
511 base::string16 selection_text_;
512 // The offset corresponding to the start of |selection_text_| in the document.
513 size_t selection_text_offset_;
514 // Range over the document corresponding to the actual selected text (which
515 // could correspond to a substring of |selection_text_|; see above).
516 gfx::Range selection_range_;
517 // Used to inform didChangeSelection() when it is called in the context
518 // of handling a InputMsg_SelectRange IPC.
519 bool handling_select_range_;
520
[email protected]2626d142014-04-22 17:24:02521 // The next group of objects all implement RenderFrameObserver, so are deleted
522 // along with the RenderFrame automatically. This is why we just store weak
523 // references.
524
525 // Holds a reference to the service which provides desktop notifications.
526 NotificationProvider* notification_provider_;
527
[email protected]227692c52013-05-31 22:43:04528 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
529};
530
531} // namespace content
532
[email protected]85d85fd2013-06-19 00:57:41533#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_