blob: 004cffa7203d7923b42632cdb8dc2b9ef3eefd13 [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"
xhwang430baee2015-01-22 05:46:2014#include "base/memory/scoped_ptr.h"
[email protected]abc501e2014-01-27 19:27:2615#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2616#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0217#include "base/process/process_handle.h"
[email protected]95640212014-07-26 18:14:3018#include "content/common/accessibility_mode_enums.h"
clamyda97e8322014-10-07 21:57:2519#include "content/common/frame_message_enums.h"
[email protected]c52a1412014-06-25 06:09:2520#include "content/common/mojo/service_registry_impl.h"
peter4eb242002015-06-02 12:45:1321#include "content/public/common/console_message_level.h"
[email protected]87de04b02014-04-08 22:14:4922#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1823#include "content/public/common/referrer.h"
[email protected]227692c52013-05-31 22:43:0424#include "content/public/renderer/render_frame.h"
[email protected]5a7100d2014-05-19 01:29:0425#include "content/renderer/render_frame_proxy.h"
[email protected]f3add922013-12-20 23:17:1626#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0427#include "ipc/ipc_message.h"
acolwell9e0840d2014-09-06 19:01:3228#include "media/blink/webmediaplayer_delegate.h"
benwells04ab5b962015-05-06 08:29:4029#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3030#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4131#include "third_party/WebKit/public/web/WebDataSource.h"
32#include "third_party/WebKit/public/web/WebFrameClient.h"
[email protected]680575542014-04-03 17:12:5233#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
twellington376424ad2015-05-04 18:57:2534#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1535#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0436
tommyclid481c482014-12-03 01:50:4137#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3838#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4139#endif
40
[email protected]a017938b2014-05-27 21:17:1741#if defined(OS_ANDROID)
42#include "content/renderer/media/android/renderer_media_player_manager.h"
43#endif
44
clamy9bfeef42014-09-30 20:50:4245class GURL;
[email protected]7a4e2532013-12-02 21:30:0246class TransportDIB;
kenrba7199832015-01-22 23:44:5947struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1648struct FrameMsg_PostMessage_Params;
dspelle736c9db2015-04-03 04:53:1649struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0250
51namespace blink {
[email protected]5ee7f182014-04-25 19:45:2652class WebGeolocationClient;
[email protected]7a4e2532013-12-02 21:30:0253class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2654class WebContentDecryptionModule;
[email protected]96307312014-05-04 01:00:1955class WebMediaPlayer;
avayvodbca35fad2015-01-29 20:20:5756class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0257class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2658class WebSecurityOrigin;
[email protected]7a4e2532013-12-02 21:30:0259struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4260struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0261struct WebCursorInfo;
62}
63
64namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4265class Point;
[email protected]7a4e2532013-12-02 21:30:0266class Range;
67class Rect;
68}
69
jrummell109c3a602014-12-18 01:08:5070namespace media {
xhwangd7180832015-04-03 05:38:1571class CdmFactory;
xhwang60b430a2015-02-01 05:20:4672class MediaPermission;
jrummell109c3a602014-12-18 01:08:5073class WebEncryptedMediaClientImpl;
74}
75
xhwang33f939e2015-06-23 04:33:4276namespace mojo {
77class ServiceProvider;
78}
79
[email protected]227692c52013-05-31 22:43:0480namespace content {
81
[email protected]bffc8302014-01-23 20:52:1682class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:5983class CompositorDependencies;
dgozman358ba322015-03-26 15:05:3084class DevToolsAgent;
avi0392dbf52015-03-25 16:55:4585class DocumentState;
avi485e5fd62014-08-25 23:26:1486class ExternalPopupMenu;
[email protected]8eae0802014-06-02 21:35:5587class GeolocationDispatcher;
mlamouriefdca9d2014-09-16 16:55:4088class ManifestManager;
[email protected]977db4a42014-07-17 08:04:3289class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:0890class MediaStreamRendererFactory;
xhwang36b1f3b2015-01-27 17:54:0191class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:0292class MidiDispatcher;
avi0392dbf52015-03-25 16:55:4593class NavigationState;
[email protected]4459599e2014-07-29 22:40:0994class NotificationPermissionDispatcher;
clamyda97e8322014-10-07 21:57:2595class PageState;
[email protected]7a4e2532013-12-02 21:30:0296class PepperPluginInstanceImpl;
mlamouric6d31db2015-03-28 17:48:1497class PermissionDispatcher;
avayvodbca35fad2015-01-29 20:20:5798class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:0299class PushMessagingDispatcher;
xhwangd7180832015-04-03 05:38:15100class RenderCdmFactory;
[email protected]95640212014-07-26 18:14:30101class RendererAccessibility;
[email protected]4b556cf2014-06-10 23:21:53102class RendererCdmManager;
103class RendererMediaPlayerManager;
[email protected]7a4e2532013-12-02 21:30:02104class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:26105class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04106class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02107class RenderWidget;
108class RenderWidgetFullscreenPepper;
[email protected]cf78eda2014-06-13 16:57:41109class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:33110class UserMediaClientImpl;
clamy9bfeef42014-09-30 20:50:42111struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42112struct CustomContextMenuContext;
alexmosbc7eafa2014-12-06 01:38:09113struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45114struct NavigationParams;
clamy79b3da62014-10-14 08:50:37115struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04116struct ResourceResponseHead;
clamy34e12782015-03-12 11:26:13117struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12118struct StreamOverrideParameters;
bajones02443532015-06-22 21:17:40119class VRDispatcher;
[email protected]227692c52013-05-31 22:43:04120
[email protected]85d85fd2013-06-19 00:57:41121class CONTENT_EXPORT RenderFrameImpl
122 : public RenderFrame,
[email protected]96307312014-05-04 01:00:19123 NON_EXPORTED_BASE(public blink::WebFrameClient),
acolwell9e0840d2014-09-06 19:01:32124 NON_EXPORTED_BASE(public media::WebMediaPlayerDelegate) {
[email protected]227692c52013-05-31 22:43:04125 public:
[email protected]2f61bdd2013-07-02 18:38:47126 // Creates a new RenderFrame. |render_view| is the RenderView object that this
127 // frame belongs to.
[email protected]b70da4c2014-01-06 19:57:09128 // Callers *must* call |SetWebFrame| immediately after creation.
[email protected]82307f6b2014-08-07 03:30:12129 // Note: This is called only when RenderFrame is created by Blink through
130 // createChildFrame.
[email protected]b70da4c2014-01-06 19:57:09131 // TODO(creis): We should structure this so that |SetWebFrame| isn't needed.
[email protected]2f61bdd2013-07-02 18:38:47132 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
133
[email protected]82307f6b2014-08-07 03:30:12134 // Creates a new RenderFrame with |routing_id| as a child of the RenderFrame
135 // identified by |parent_routing_id| or as the top-level frame if the latter
japhete6adf142014-10-31 00:01:49136 // is MSG_ROUTING_NONE. If |proxy_routing_id| is MSG_ROUTING_NONE, it creates
alexmos9f8705a2015-05-06 19:58:59137 // the Blink WebLocalFrame and inserts it into the frame tree after the frame
138 // identified by |previous_sibling_routing_id|, or as the first child if
139 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
140 // semi-orphaned until it commits, at which point it replaces the proxy
141 // identified by |proxy_routing_id|. Note: This is called only when
142 // RenderFrame is being created in response to IPC message from the browser
143 // process. All other frame creation is driven through Blink and Create.
japhete6adf142014-10-31 00:01:49144 static void CreateFrame(int routing_id,
145 int parent_routing_id,
alexmos9f8705a2015-05-06 19:58:59146 int previous_sibling_routing_id,
alexmose48b1df932015-01-16 01:34:17147 int proxy_routing_id,
kenrba7199832015-01-22 23:44:59148 const FrameReplicationState& replicated_state,
149 CompositorDependencies* compositor_deps,
150 const FrameMsg_NewFrame_WidgetParams& params);
[email protected]82307f6b2014-08-07 03:30:12151
[email protected]5a7100d2014-05-19 01:29:04152 // Returns the RenderFrameImpl for the given routing ID.
153 static RenderFrameImpl* FromRoutingID(int routing_id);
154
[email protected]a5ac6dc2014-01-15 07:02:14155 // Just like RenderFrame::FromWebFrame but returns the implementation.
156 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09157
[email protected]2f61bdd2013-07-02 18:38:47158 // Used by content_layouttest_support to hook into the creation of
159 // RenderFrameImpls.
dongseong.hwangb721ddf2014-12-10 21:22:50160 using CreateRenderFrameImplFunction = RenderFrameImpl* (*)(RenderViewImpl*,
161 int32);
[email protected]2f61bdd2013-07-02 18:38:47162 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50163 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47164
[email protected]227692c52013-05-31 22:43:04165 virtual ~RenderFrameImpl();
166
[email protected]b70da4c2014-01-06 19:57:09167 bool is_swapped_out() const {
168 return is_swapped_out_;
169 }
170
[email protected]5a7100d2014-05-19 01:29:04171 // TODO(nasko): This can be removed once we don't have a swapped out state on
172 // RenderFrames. See https://crbug.com/357747.
173 void set_render_frame_proxy(RenderFrameProxy* proxy) {
174 render_frame_proxy_ = proxy;
175 }
176
[email protected]bffc8302014-01-23 20:52:16177 // Out-of-process child frames receive a signal from RenderWidgetCompositor
178 // when a compositor frame has committed.
179 void DidCommitCompositorFrame();
180
[email protected]7a4e2532013-12-02 21:30:02181 // TODO(jam): this is a temporary getter until all the code is transitioned
182 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26183 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02184
[email protected]f3add922013-12-20 23:17:16185 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
186
[email protected]7a4e2532013-12-02 21:30:02187 // Returns the RenderWidget associated with this frame.
188 RenderWidget* GetRenderWidget();
189
dgozmancf9039cd2015-04-06 12:01:31190 DevToolsAgent* devtools_agent() { return devtools_agent_; }
191
[email protected]35b2a972014-04-04 15:50:22192 // This is called right after creation with the WebLocalFrame for this
[email protected]0287e762014-04-11 13:07:58193 // RenderFrame. It must be called before Initialize.
[email protected]35b2a972014-04-04 15:50:22194 void SetWebFrame(blink::WebLocalFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09195
[email protected]0287e762014-04-11 13:07:58196 // This method must be called after the frame has been added to the frame
197 // tree. It creates all objects that depend on the frame being at its proper
198 // spot.
199 void Initialize();
200
[email protected]de3c5d82014-05-28 22:12:59201 // Notifications from RenderWidget.
202 void WasHidden();
203 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31204 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59205
[email protected]723971b2014-02-12 11:08:25206 // Start/Stop loading notifications.
207 // TODO(nasko): Those are page-level methods at this time and come from
208 // WebViewClient. We should move them to be WebFrameClient calls and put
209 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09210 // |to_different_document| will be true unless the load is a fragment
211 // navigation, or triggered by history.pushState/replaceState.
[email protected]6dd5c322014-03-12 07:58:46212 virtual void didStartLoading(bool to_different_document);
213 virtual void didStopLoading();
214 virtual void didChangeLoadProgress(double load_progress);
[email protected]723971b2014-02-12 11:08:25215
[email protected]95640212014-07-26 18:14:30216 AccessibilityMode accessibility_mode() {
217 return accessibility_mode_;
218 }
219
220 RendererAccessibility* renderer_accessibility() {
221 return renderer_accessibility_;
222 }
223
224 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
225 blink::WebAXEvent event);
226
estade31c54342015-01-23 03:34:36227 // The focused node changed to |node|. If focus was lost from this frame,
228 // |node| will be null.
[email protected]95640212014-07-26 18:14:30229 void FocusedNodeChanged(const blink::WebNode& node);
230
estade31c54342015-01-23 03:34:36231 // TODO(dmazzoni): the only reason this is here is to plumb it through to
232 // RendererAccessibility. It should use the RenderFrameObserver method, once
233 // blink has a separate accessibility tree per frame.
234 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
235
[email protected]7a4e2532013-12-02 21:30:02236#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31237 // Notification that a PPAPI plugin has been created.
238 void PepperPluginCreated(RendererPpapiHost* host);
239
[email protected]7a4e2532013-12-02 21:30:02240 // Notifies that |instance| has changed the cursor.
241 // This will update the cursor appearance if it is currently over the plugin
242 // instance.
243 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
244 const blink::WebCursorInfo& cursor);
245
246 // Notifies that |instance| has received a mouse event.
247 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
248
[email protected]7a4e2532013-12-02 21:30:02249 // Informs the render view that a PPAPI plugin has changed text input status.
250 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
251 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
252
253 // Cancels current composition.
254 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
255
256 // Informs the render view that a PPAPI plugin has changed selection.
257 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
258
259 // Creates a fullscreen container for a pepper plugin instance.
260 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
261 PepperPluginInstanceImpl* plugin);
262
[email protected]7a4e2532013-12-02 21:30:02263 bool IsPepperAcceptingCompositionEvents() const;
264
265 // Notification that the given plugin has crashed.
266 void PluginCrashed(const base::FilePath& plugin_path,
267 base::ProcessId plugin_pid);
268
[email protected]7a4e2532013-12-02 21:30:02269 // Simulates IME events for testing purpose.
270 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26271 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02272 const std::vector<blink::WebCompositionUnderline>& underlines,
273 int selection_start,
274 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26275 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02276 const gfx::Range& replacement_range);
277
278 // TODO(jam): remove these once the IPC handler moves from RenderView to
279 // RenderFrame.
280 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42281 const base::string16& text,
282 const std::vector<blink::WebCompositionUnderline>& underlines,
283 int selection_start,
284 int selection_end);
285 void OnImeConfirmComposition(const base::string16& text,
286 const gfx::Range& replacement_range,
287 bool keep_selection);
288#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02289
[email protected]977db4a42014-07-17 08:04:32290 // May return NULL in some cases, especially if userMediaClient() returns
291 // NULL.
292 MediaStreamDispatcher* GetMediaStreamDispatcher();
293
avi485e5fd62014-08-25 23:26:14294#if defined(OS_MACOSX) || defined(OS_ANDROID)
295 void DidHideExternalPopupMenu();
296#endif
297
[email protected]227692c52013-05-31 22:43:04298 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52299 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04300
301 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52302 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]227692c52013-05-31 22:43:04303
[email protected]271ff5792013-12-04 22:29:31304 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52305 RenderView* GetRenderView() override;
306 int GetRoutingID() override;
307 blink::WebLocalFrame* GetWebFrame() override;
estade78d655f82015-01-30 01:55:08308 blink::WebElement GetFocusedElement() const override;
dcheng6d18e402014-10-21 12:32:52309 WebPreferences& GetWebkitPreferences() override;
310 int ShowContextMenu(ContextMenuClient* client,
311 const ContextMenuParams& params) override;
312 void CancelContextMenu(int request_id) override;
313 blink::WebNode GetContextMenuNode() const override;
tommycli59bd86c2014-12-10 02:09:38314 blink::WebPlugin* CreatePlugin(
315 blink::WebFrame* frame,
316 const WebPluginInfo& info,
317 const blink::WebPluginParams& params,
tommyclie8722702015-01-16 11:40:41318 scoped_ptr<PluginInstanceThrottler> throttler) override;
dcheng6d18e402014-10-21 12:32:52319 void LoadURLExternally(blink::WebLocalFrame* frame,
320 const blink::WebURLRequest& request,
321 blink::WebNavigationPolicy policy) override;
322 void ExecuteJavaScript(const base::string16& javascript) override;
323 bool IsHidden() override;
324 ServiceRegistry* GetServiceRegistry() override;
tommyclid481c482014-12-03 01:50:41325#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38326 void RegisterPeripheralPlugin(
327 const GURL& content_origin,
328 const base::Closure& unthrottle_callback) override;
tommyclid7798e12015-02-09 21:08:56329 PluginPowerSaverHelper* plugin_power_saver_helper() {
330 return plugin_power_saver_helper_;
331 }
tommyclid481c482014-12-03 01:50:41332#endif
dcheng6d18e402014-10-21 12:32:52333 bool IsFTPDirectoryListing() override;
334 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52335 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52336 void SetSelectedText(const base::string16& selection_text,
337 size_t offset,
338 const gfx::Range& range) override;
339 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19340 v8::Local<v8::Context> context) override;
[email protected]271ff5792013-12-04 22:29:31341
[email protected]96307312014-05-04 01:00:19342 // blink::WebFrameClient implementation:
jbroman73e9f7962014-10-30 00:43:45343 blink::WebPluginPlaceholder* createPluginPlaceholder(
344 blink::WebLocalFrame*,
345 const blink::WebPluginParams&) override;
[email protected]35b2a972014-04-04 15:50:22346 virtual blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
347 const blink::WebPluginParams& params);
jrummell65b7d272014-09-24 20:49:27348 virtual blink::WebMediaPlayer* createMediaPlayer(
349 blink::WebLocalFrame* frame,
350 const blink::WebURL& url,
351 blink::WebMediaPlayerClient* client,
352 blink::WebContentDecryptionModule* initial_cdm);
[email protected]180ef242013-11-07 06:50:46353 virtual blink::WebApplicationCacheHost* createApplicationCacheHost(
[email protected]35b2a972014-04-04 15:50:22354 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46355 blink::WebApplicationCacheHostClient* client);
mlamouria5b294552015-03-09 16:16:36356 virtual blink::WebWorkerContentSettingsClientProxy*
357 createWorkerContentSettingsClientProxy(blink::WebLocalFrame* frame);
[email protected]b20c3222014-08-22 00:50:22358 virtual blink::WebExternalPopupMenu* createExternalPopupMenu(
359 const blink::WebPopupMenuInfo& popup_menu_info,
360 blink::WebExternalPopupMenuClient* popup_menu_client);
[email protected]35b2a972014-04-04 15:50:22361 virtual blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame);
[email protected]180ef242013-11-07 06:50:46362 virtual blink::WebServiceWorkerProvider* createServiceWorkerProvider(
[email protected]35b2a972014-04-04 15:50:22363 blink::WebLocalFrame* frame);
364 virtual void didAccessInitialDocument(blink::WebLocalFrame* frame);
alexmose48b1df932015-01-16 01:34:17365 virtual blink::WebFrame* createChildFrame(
366 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56367 blink::WebTreeScopeType scope,
368 const blink::WebString& name,
369 blink::WebSandboxFlags sandboxFlags);
370 virtual blink::WebFrame* createChildFrame(
371 blink::WebLocalFrame* parent,
alexmose48b1df932015-01-16 01:34:17372 const blink::WebString& name,
373 blink::WebSandboxFlags sandboxFlags);
[email protected]35b2a972014-04-04 15:50:22374 virtual void didDisownOpener(blink::WebLocalFrame* frame);
lfg7984f01c2015-06-03 15:58:30375 // TODO(lfg): Remove this method once the blink patch lands.
[email protected]180ef242013-11-07 06:50:46376 virtual void frameDetached(blink::WebFrame* frame);
lfg7984f01c2015-06-03 15:58:30377 virtual void frameDetached(blink::WebFrame* frame, DetachType type);
[email protected]9c9343b2014-03-08 02:56:07378 virtual void frameFocused();
[email protected]180ef242013-11-07 06:50:46379 virtual void willClose(blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22380 virtual void didChangeName(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46381 const blink::WebString& name);
alexmos6b294562015-03-05 19:24:10382 virtual void didChangeSandboxFlags(blink::WebFrame* child_frame,
383 blink::WebSandboxFlags flags);
[email protected]f5b6dd1122013-10-04 02:42:50384 virtual void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22385 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46386 const blink::WebVector<blink::WebString>& newly_matching_selectors,
387 const blink::WebVector<blink::WebString>& stopped_matching_selectors);
[email protected]c31a84802014-04-03 15:55:49388 virtual bool shouldReportDetailedMessageForSource(
389 const blink::WebString& source);
390 virtual void didAddMessageToConsole(const blink::WebConsoleMessage& message,
391 const blink::WebString& source_name,
392 unsigned source_line,
393 const blink::WebString& stack_trace);
[email protected]35b2a972014-04-04 15:50:22394 virtual void loadURLExternally(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46395 const blink::WebURLRequest& request,
[email protected]35b2a972014-04-04 15:50:22396 blink::WebNavigationPolicy policy,
397 const blink::WebString& suggested_name);
[email protected]1a4e9752013-12-31 20:10:58398 // The WebDataSource::ExtraData* is assumed to be a DocumentState* subclass.
[email protected]180ef242013-11-07 06:50:46399 virtual blink::WebNavigationPolicy decidePolicyForNavigation(
[email protected]0c3c54f2014-07-31 01:29:00400 const NavigationPolicyInfo& info);
[email protected]680575542014-04-03 17:12:52401 virtual blink::WebHistoryItem historyItemForNewChildFrame(
402 blink::WebFrame* frame);
[email protected]35b2a972014-04-04 15:50:22403 virtual void willSendSubmitEvent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46404 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22405 virtual void willSubmitForm(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46406 const blink::WebFormElement& form);
[email protected]35b2a972014-04-04 15:50:22407 virtual void didCreateDataSource(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46408 blink::WebDataSource* datasource);
[email protected]0c3c54f2014-07-31 01:29:00409 virtual void didStartProvisionalLoad(blink::WebLocalFrame* frame,
dglazkovcd24f7e2015-05-18 20:00:00410 double triggering_event_time);
[email protected]85d85fd2013-06-19 00:57:41411 virtual void didReceiveServerRedirectForProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22412 blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41413 virtual void didFailProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22414 blink::WebLocalFrame* frame,
avibe2d51d2015-03-31 00:21:17415 const blink::WebURLError& error,
416 blink::WebHistoryCommitType commit_type);
[email protected]680575542014-04-03 17:12:52417 virtual void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22418 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52419 const blink::WebHistoryItem& item,
420 blink::WebHistoryCommitType commit_type);
rob5ef11ff2014-11-17 23:56:20421 virtual void didCreateNewDocument(blink::WebLocalFrame* frame);
[email protected]06181e52014-05-10 11:59:09422 virtual void didClearWindowObject(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22423 virtual void didCreateDocumentElement(blink::WebLocalFrame* frame);
424 virtual void didReceiveTitle(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46425 const blink::WebString& title,
426 blink::WebTextDirection direction);
[email protected]35b2a972014-04-04 15:50:22427 virtual void didChangeIcon(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46428 blink::WebIconURL::Type icon_type);
[email protected]35b2a972014-04-04 15:50:22429 virtual void didFinishDocumentLoad(blink::WebLocalFrame* frame);
430 virtual void didHandleOnloadEvents(blink::WebLocalFrame* frame);
431 virtual void didFailLoad(blink::WebLocalFrame* frame,
avibe2d51d2015-03-31 00:21:17432 const blink::WebURLError& error,
433 blink::WebHistoryCommitType commit_type);
[email protected]45d877f2014-04-05 07:36:22434 virtual void didFinishLoad(blink::WebLocalFrame* frame);
435 virtual void didNavigateWithinPage(blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52436 const blink::WebHistoryItem& item,
437 blink::WebHistoryCommitType commit_type);
[email protected]35b2a972014-04-04 15:50:22438 virtual void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame);
[email protected]37b64c52014-07-11 21:14:05439 virtual void didChangeThemeColor();
alexmosf40ce5b02015-02-25 20:19:56440 virtual void dispatchLoad();
[email protected]4459599e2014-07-29 22:40:09441 virtual void requestNotificationPermission(
442 const blink::WebSecurityOrigin& origin,
443 blink::WebNotificationPermissionCallback* callback);
[email protected]c3f2c702014-03-19 23:39:48444 virtual void didChangeSelection(bool is_empty_selection);
[email protected]f3c59d62014-04-09 16:33:55445 virtual blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19446 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55447 const blink::WebColor& initial_color,
448 const blink::WebVector<blink::WebColorSuggestion>& suggestions);
[email protected]87de04b02014-04-08 22:14:49449 virtual void runModalAlertDialog(const blink::WebString& message);
450 virtual bool runModalConfirmDialog(const blink::WebString& message);
451 virtual bool runModalPromptDialog(const blink::WebString& message,
452 const blink::WebString& default_value,
453 blink::WebString* actual_value);
454 virtual bool runModalBeforeUnloadDialog(bool is_reload,
455 const blink::WebString& message);
[email protected]12cc5112014-03-03 17:01:10456 virtual void showContextMenu(const blink::WebContextMenuData& data);
[email protected]91070342014-03-07 00:29:02457 virtual void clearContextMenu();
[email protected]35b2a972014-04-04 15:50:22458 virtual void willSendRequest(blink::WebLocalFrame* frame,
459 unsigned identifier,
460 blink::WebURLRequest& request,
461 const blink::WebURLResponse& redirect_response);
462 virtual void didReceiveResponse(blink::WebLocalFrame* frame,
463 unsigned identifier,
464 const blink::WebURLResponse& response);
465 virtual void didFinishResourceLoad(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14466 unsigned identifier);
[email protected]85d85fd2013-06-19 00:57:41467 virtual void didLoadResourceFromMemoryCache(
[email protected]35b2a972014-04-04 15:50:22468 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46469 const blink::WebURLRequest& request,
470 const blink::WebURLResponse& response);
[email protected]35b2a972014-04-04 15:50:22471 virtual void didDisplayInsecureContent(blink::WebLocalFrame* frame);
472 virtual void didRunInsecureContent(blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46473 const blink::WebSecurityOrigin& origin,
474 const blink::WebURL& target);
[email protected]35b2a972014-04-04 15:50:22475 virtual void didAbortLoading(blink::WebLocalFrame* frame);
476 virtual void didCreateScriptContext(blink::WebLocalFrame* frame,
deepak.s750d68f2015-04-30 07:32:41477 v8::Local<v8::Context> context,
[email protected]85d85fd2013-06-19 00:57:41478 int extension_group,
[email protected]255eea092013-06-28 17:19:14479 int world_id);
[email protected]35b2a972014-04-04 15:50:22480 virtual void willReleaseScriptContext(blink::WebLocalFrame* frame,
deepak.s750d68f2015-04-30 07:32:41481 v8::Local<v8::Context> context,
[email protected]255eea092013-06-28 17:19:14482 int world_id);
[email protected]35b2a972014-04-04 15:50:22483 virtual void didFirstVisuallyNonEmptyLayout(blink::WebLocalFrame* frame);
[email protected]35b2a972014-04-04 15:50:22484 virtual void didChangeScrollOffset(blink::WebLocalFrame* frame);
485 virtual void willInsertBody(blink::WebLocalFrame* frame);
[email protected]85d85fd2013-06-19 00:57:41486 virtual void reportFindInPageMatchCount(int request_id,
487 int count,
[email protected]255eea092013-06-28 17:19:14488 bool final_update);
[email protected]85d85fd2013-06-19 00:57:41489 virtual void reportFindInPageSelection(int request_id,
490 int active_match_ordinal,
[email protected]180ef242013-11-07 06:50:46491 const blink::WebRect& sel);
[email protected]35b2a972014-04-04 15:50:22492 virtual void requestStorageQuota(blink::WebLocalFrame* frame,
493 blink::WebStorageQuotaType type,
494 unsigned long long requested_size,
495 blink::WebStorageQuotaCallbacks callbacks);
[email protected]a14903e02014-06-02 07:35:12496 virtual void willOpenWebSocket(blink::WebSocketHandle* handle);
[email protected]5ee7f182014-04-25 19:45:26497 virtual blink::WebGeolocationClient* geolocationClient();
[email protected]45920862014-07-02 12:53:02498 virtual blink::WebPushClient* pushClient();
avayvodbca35fad2015-01-29 20:20:57499 virtual blink::WebPresentationClient* presentationClient();
[email protected]85d85fd2013-06-19 00:57:41500 virtual void willStartUsingPeerConnectionHandler(
[email protected]35b2a972014-04-04 15:50:22501 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46502 blink::WebRTCPeerConnectionHandler* handler);
[email protected]bfe45e22014-04-25 16:47:53503 virtual blink::WebUserMediaClient* userMediaClient();
jrummell109c3a602014-12-18 01:08:50504 virtual blink::WebEncryptedMediaClient* encryptedMediaClient();
[email protected]8538385f2014-04-25 19:45:04505 virtual blink::WebMIDIClient* webMIDIClient();
[email protected]85d85fd2013-06-19 00:57:41506 virtual bool willCheckAndDispatchMessageEvent(
[email protected]ce5064f2014-05-07 22:49:20507 blink::WebLocalFrame* source_frame,
508 blink::WebFrame* target_frame,
509 blink::WebSecurityOrigin target_origin,
[email protected]180ef242013-11-07 06:50:46510 blink::WebDOMMessageEvent event);
[email protected]35b2a972014-04-04 15:50:22511 virtual blink::WebString userAgentOverride(blink::WebLocalFrame* frame,
512 const blink::WebURL& url);
513 virtual blink::WebString doNotTrackValue(blink::WebLocalFrame* frame);
514 virtual bool allowWebGL(blink::WebLocalFrame* frame, bool default_value);
515 virtual void didLoseWebGLContext(blink::WebLocalFrame* frame,
[email protected]255eea092013-06-28 17:19:14516 int arb_robustness_status_code);
[email protected]cf78eda2014-06-13 16:57:41517 virtual blink::WebScreenOrientationClient* webScreenOrientationClient();
nhirokifebadeed2014-10-29 04:02:47518 virtual bool isControlledByServiceWorker(blink::WebDataSource& data_source);
519 virtual int64_t serviceWorkerID(blink::WebDataSource& data_source);
dmazzoni0b5d2482014-09-10 19:45:57520 virtual void postAccessibilityEvent(const blink::WebAXObject& obj,
521 blink::WebAXEvent event);
dmazzoni1a69e2b32014-11-06 20:34:28522 virtual void handleAccessibilityFindInPageResult(
523 int identifier,
524 int match_index,
525 const blink::WebAXObject& start_object,
526 int start_offset,
527 const blink::WebAXObject& end_object,
528 int end_offset);
mlamouriefdca9d2014-09-16 16:55:40529 virtual void didChangeManifest(blink::WebLocalFrame*);
avayvod5efd9a922015-03-13 15:41:02530 virtual void didChangeDefaultPresentation(blink::WebLocalFrame*);
mlamouri7a78d6fd2015-01-17 13:23:53531 virtual bool enterFullscreen();
532 virtual bool exitFullscreen();
mlamouri670a86d2015-03-17 16:06:25533 virtual blink::WebPermissionClient* permissionClient();
benwells04ab5b962015-05-06 08:29:40534 virtual blink::WebAppBannerClient* appBannerClient();
[email protected]85d85fd2013-06-19 00:57:41535
bajones02443532015-06-22 21:17:40536#if defined(ENABLE_WEBVR)
537 blink::WebVRClient* webVRClient() override;
538#endif
539
[email protected]96307312014-05-04 01:00:19540 // WebMediaPlayerDelegate implementation:
dcheng6d18e402014-10-21 12:32:52541 void DidPlay(blink::WebMediaPlayer* player) override;
542 void DidPause(blink::WebMediaPlayer* player) override;
543 void PlayerGone(blink::WebMediaPlayer* player) override;
[email protected]96307312014-05-04 01:00:19544
[email protected]c6bc20332014-02-28 18:30:39545 // TODO(nasko): Make all tests in RenderViewImplTest friends and then move
546 // this back to private member.
clamy34e12782015-03-12 11:26:13547 void OnNavigate(const CommonNavigationParams& common_params,
548 const StartNavigationParams& start_params,
clamy57b4b8e2015-03-24 13:32:11549 const RequestNavigationParams& request_params);
[email protected]c6bc20332014-02-28 18:30:39550
nasko78f06bc2014-11-18 18:18:57551 // Make this frame show an empty, unscriptable page.
552 // TODO(nasko): Remove this method once swapped out state is no longer used.
553 void NavigateToSwappedOutURL();
554
rockot775ce0d2015-01-27 18:35:01555 // Binds this render frame's service registry.
[email protected]c52a1412014-06-25 06:09:25556 void BindServiceRegistry(
rockot775ce0d2015-01-27 18:35:01557 mojo::InterfaceRequest<mojo::ServiceProvider> services,
558 mojo::ServiceProviderPtr exposed_services);
[email protected]c52a1412014-06-25 06:09:25559
mlamouri4fff1992014-09-30 11:22:46560 ManifestManager* manifest_manager();
561
avi0392dbf52015-03-25 16:55:45562 // TODO(creis): Remove when the only caller, the HistoryController, is no
563 // more.
564 void SetPendingNavigationParams(
565 scoped_ptr<NavigationParams> navigation_params);
566
[email protected]2f61bdd2013-07-02 18:38:47567 protected:
568 RenderFrameImpl(RenderViewImpl* render_view, int32 routing_id);
569
[email protected]227692c52013-05-31 22:43:04570 private:
kenrbf98a4d22015-04-01 21:59:35571 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26572 friend class RenderFrameObserver;
clamy5c7ede52015-04-09 11:32:24573 friend class RenderViewImplTest;
[email protected]95640212014-07-26 18:14:30574 friend class RendererAccessibilityTest;
avi485e5fd62014-08-25 23:26:14575 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
576 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
577 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
578 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]66bbadaf2014-03-28 16:25:54579 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
580 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26581
twellington376424ad2015-05-04 18:57:25582 // A wrapper class used as the callback for JavaScript executed
583 // in an isolated world.
584 class JavaScriptIsolatedWorldRequest
585 : public blink::WebScriptExecutionCallback {
586 public:
587 JavaScriptIsolatedWorldRequest(
588 int id,
589 bool notify_result,
590 int routing_id,
591 base::WeakPtr<RenderFrameImpl> render_frame_impl);
592 void completed(
593 const blink::WebVector<v8::Local<v8::Value>>& result) override;
594
595 private:
596 ~JavaScriptIsolatedWorldRequest();
597
598 int id_;
599 bool notify_result_;
600 int routing_id_;
601 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
602
603 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
604 };
605
[email protected]37567b432014-02-12 01:12:22606 typedef std::map<GURL, double> HostZoomLevels;
607
[email protected]2e2d9632013-12-03 00:55:26608 // Functions to add and remove observers for this object.
609 void AddObserver(RenderFrameObserver* observer);
610 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34611
[email protected]f0906a02014-08-07 07:18:55612 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35613 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08614 blink::WebHistoryCommitType commit_type,
615 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22616
[email protected]b70da4c2014-01-06 19:57:09617 // IPC message handlers ------------------------------------------------------
618 //
619 // The documentation for these functions should be in
620 // content/common/*_messages.h for the message that the function is handling.
[email protected]f76f32232014-03-11 17:36:17621 void OnBeforeUnload();
alexmosbc7eafa2014-12-06 01:38:09622 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56623 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09624 const FrameReplicationState& replicated_frame_state);
Nasko Oskov85f60222014-08-28 22:53:30625 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42626 void OnShowContextMenu(const gfx::Point& location);
627 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
628 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
629 unsigned action);
[email protected]4ee64622014-03-21 22:34:15630 void OnUndo();
631 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07632 void OnCut();
633 void OnCopy();
634 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15635 void OnPasteAndMatchStyle();
636 void OnDelete();
637 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14638 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
[email protected]4ee64622014-03-21 22:34:15639 void OnUnselect();
christiankaeed9862014-11-05 10:49:14640 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17641 void OnReplace(const base::string16& text);
642 void OnReplaceMisspelling(const base::string16& text);
[email protected]e31b8ebb2014-03-07 17:59:34643 void OnCSSInsertRequest(const std::string& css);
peter4eb242002015-06-02 12:45:13644 void OnAddMessageToConsole(ConsoleMessageLevel level,
645 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52646 void OnJavaScriptExecuteRequest(const base::string16& javascript,
647 int id,
648 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28649 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
650 int id,
jochen2e7d95b2015-05-04 15:28:50651 bool notify_result,
652 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25653 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
654 int id,
655 bool notify_result,
656 int world_id);
igsolla1cea67b72015-02-11 16:25:04657 void OnVisualStateRequest(uint64 key);
[email protected]4ee64622014-03-21 22:34:15658 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16659 void OnSetCompositionFromExistingText(
660 int start, int end,
661 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24662 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16663 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00664 void OnReload(bool ignore_cache);
[email protected]96bb6132014-06-16 17:22:19665 void OnTextSurroundingSelectionRequest(size_t max_length);
[email protected]95640212014-07-26 18:14:30666 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51667 void OnSnapshotAccessibilityTree(int callback_id);
creisbbbeb062014-08-25 18:20:31668 void OnDisownOpener();
dcheng5f60abb2015-05-28 01:39:36669 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
dspelle736c9db2015-04-03 04:53:16670 void OnTextTrackSettingsChanged(
671 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16672 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
avi485e5fd62014-08-25 23:26:14673#if defined(OS_ANDROID)
674 void OnSelectPopupMenuItems(bool canceled,
675 const std::vector<int>& selected_indices);
676#elif defined(OS_MACOSX)
677 void OnSelectPopupMenuItem(int selected_index);
[email protected]4ee64622014-03-21 22:34:15678 void OnCopyToFindPboard();
679#endif
[email protected]9c9343b2014-03-08 02:56:07680
davidbena5496d62014-10-07 18:52:04681 void OnCommitNavigation(const ResourceResponseHead& response,
682 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42683 const CommonNavigationParams& common_params,
clamy57b4b8e2015-03-24 13:32:11684 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57685 void OnFailedNavigation(const CommonNavigationParams& common_params,
686 const RequestNavigationParams& request_params,
687 bool has_stale_copy_in_cache,
688 int error_code);
clamy9bfeef42014-09-30 20:50:42689
[email protected]65920f332014-03-04 21:14:18690 // Virtual since overridden by WebTestProxy for layout tests.
691 virtual blink::WebNavigationPolicy DecidePolicyForNavigation(
692 RenderFrame* render_frame,
[email protected]0c3c54f2014-07-31 01:29:00693 const NavigationPolicyInfo& info);
[email protected]65920f332014-03-04 21:14:18694 void OpenURL(blink::WebFrame* frame,
695 const GURL& url,
696 const Referrer& referrer,
697 blink::WebNavigationPolicy policy);
[email protected]a09d53ce2014-01-31 00:46:42698
clamyd6983032015-04-29 14:48:12699 // Performs a navigation in the frame. This provides a unified function for
700 // the current code path and the browser-side navigation path (in
701 // development). Currently used by OnNavigate, with all *NavigationParams
702 // provided by the browser. |stream_params| should be null.
703 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
704 // |request_params| received by the browser. |stream_params| should be non
705 // null and created from the information provided by the browser.
706 // |start_params| is not used.
707 void NavigateInternal(const CommonNavigationParams& common_params,
708 const StartNavigationParams& start_params,
709 const RequestNavigationParams& request_params,
710 scoped_ptr<StreamOverrideParameters> stream_params);
711
[email protected]ef3adfc2014-05-11 00:04:54712 // Update current main frame's encoding and send it to browser window.
713 // Since we want to let users see the right encoding info from menu
714 // before finishing loading, we call the UpdateEncoding in
715 // a) function:DidCommitLoadForFrame. When this function is called,
716 // that means we have got first data. In here we try to get encoding
717 // of page if it has been specified in http header.
718 // b) function:DidReceiveTitle. When this function is called,
719 // that means we have got specified title. Because in most of webpages,
720 // title tags will follow meta tags. In here we try to get encoding of
721 // page if it has been specified in meta tag.
722 // c) function:DidFinishDocumentLoadForFrame. When this function is
723 // called, that means we have got whole html page. In here we should
724 // finally get right encoding of page.
725 void UpdateEncoding(blink::WebFrame* frame,
726 const std::string& encoding_name);
727
[email protected]4ee64622014-03-21 22:34:15728 // Dispatches the current state of selection on the webpage to the browser if
729 // it has changed.
730 // TODO(varunjain): delete this method once we figure out how to keep
731 // selection handles in sync with the webpage.
732 void SyncSelectionIfRequired();
733
[email protected]87de04b02014-04-08 22:14:49734 bool RunJavaScriptMessage(JavaScriptMessageType type,
735 const base::string16& message,
736 const base::string16& default_value,
737 const GURL& frame_url,
738 base::string16* result);
739
[email protected]457736d2014-04-30 15:54:27740 // Loads the appropriate error page for the specified failure into the frame.
741 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
742 const blink::WebURLError& error,
743 bool replace);
744
zeeshanq3454e9c2014-09-04 21:30:28745 void HandleJavascriptExecutionResult(const base::string16& javascript,
746 int id,
747 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41748 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28749
[email protected]977db4a42014-07-17 08:04:32750 // Initializes |web_user_media_client_|. If this fails, because it wasn't
751 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
752 // |web_user_media_client_| will remain NULL.
753 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19754
755 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
[email protected]96307312014-05-04 01:00:19756 blink::WebMediaPlayerClient* client);
757
[email protected]ae2477e2014-05-27 23:47:08758 // Creates a factory object used for creating audio and video renderers.
jochen51265132015-05-28 07:33:45759 scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08760
avi5cad4912015-06-19 05:25:44761 // Does preparation for the navigation to |url|.
762 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25763 const GURL& url,
clamy57b4b8e2015-03-24 13:32:11764 const RequestNavigationParams& request_params,
clamyda97e8322014-10-07 21:57:25765 bool* is_reload,
766 blink::WebURLRequest::CachePolicy* cache_policy);
767
clamyece38882014-11-19 15:00:20768 // PlzNavigate
769 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents
770 // of the WebURLRequest.
771 void BeginNavigation(blink::WebURLRequest* request);
772
clamy4cc9b8202015-03-02 13:51:36773 // Loads a data url.
774 void LoadDataURL(const CommonNavigationParams& params,
775 blink::WebFrame* frame);
776
clamy62b271d2015-04-16 11:54:57777 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
778 // the failed request |request|.
779 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
780 const blink::WebURLError& error,
781 blink::WebLocalFrame* frame);
782
783 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
784 const GURL& unreachable_url);
785
[email protected]f3a95312014-06-12 16:46:58786 // Returns the URL being loaded by the |frame_|'s request.
787 GURL GetLoadingUrl() const;
788
avi0392dbf52015-03-25 16:55:45789 // If we initiated a navigation, this function will populate |document_state|
790 // with the navigation information saved in OnNavigate().
791 void PopulateDocumentStateFromPending(DocumentState* document_state);
792
793 // Returns a new NavigationState populated with the navigation information
794 // saved in OnNavigate().
795 NavigationState* CreateNavigationStateFromPending();
796
[email protected]96307312014-05-04 01:00:19797#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:00798 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:27799 blink::WebMediaPlayerClient* client,
xhwang60b430a2015-02-01 05:20:46800 media::MediaPermission* media_permission,
jrummell65b7d272014-09-24 20:49:27801 blink::WebContentDecryptionModule* initial_cdm);
[email protected]a017938b2014-05-27 21:17:17802
[email protected]65f3d1aa2014-05-29 01:57:00803 RendererMediaPlayerManager* GetMediaPlayerManager();
[email protected]4b556cf2014-06-10 23:21:53804#endif
805
sandersd02d9aea2015-05-12 02:29:26806 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:42807
xhwangd7180832015-04-03 05:38:15808 media::MediaPermission* GetMediaPermission();
xhwang33f939e2015-06-23 04:33:42809
810#if defined(ENABLE_MEDIA_MOJO_RENDERER)
811 mojo::ServiceProvider* GetMediaServiceProvider();
812
813 // Called when a connection error happened on |media_service_provider_|.
814 void OnMediaServiceProviderConnectionError();
815#endif
816
xhwangd7180832015-04-03 05:38:15817 media::CdmFactory* GetCdmFactory();
[email protected]96307312014-05-04 01:00:19818
creiscfaa4462015-03-16 19:27:18819 // Stores the WebLocalFrame we are associated with. This is null from the
820 // constructor until SetWebFrame is called, and it is null after
821 // frameDetached is called until destruction (which is asynchronous in the
822 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:22823 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:09824
nasko8b9d9bd2015-05-06 19:23:19825 // Boolean value indicating whether this RenderFrameImpl object is for a
826 // subframe or not. It remains accurate during destruction, even when |frame_|
827 // has been invalidated.
828 bool is_subframe_;
829
dgozman358ba322015-03-26 15:05:30830 // Frame is a local root if it is rendered in a process different than parent
831 // or it is a main frame.
832 bool is_local_root_;
833
[email protected]abc501e2014-01-27 19:27:26834 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04835 int routing_id_;
[email protected]1c2052f2013-08-28 08:24:34836 bool is_swapped_out_;
nasko8b9d9bd2015-05-06 19:23:19837
[email protected]5a7100d2014-05-19 01:29:04838 // RenderFrameProxy exists only when is_swapped_out_ is true.
839 // TODO(nasko): This can be removed once we don't have a swapped out state on
840 // RenderFrame. See https://crbug.com/357747.
841 RenderFrameProxy* render_frame_proxy_;
[email protected]1c2052f2013-08-28 08:24:34842 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04843
japhete6adf142014-10-31 00:01:49844 // If this frame was created to replace a proxy, this will store the routing
845 // id of the proxy to replace at commit-time, at which time it will be
846 // cleared.
847 // TODO(creis): Remove this after switching to PlzNavigate.
848 int proxy_routing_id_;
849
kenrba7199832015-01-22 23:44:59850 // Used when the RenderFrame is a local root. For now, RenderWidgets are
851 // added only when a child frame is in a different process from its parent
852 // frame, but eventually this will also apply to top-level frames.
853 // TODO(kenrb): Correct the above statement when top-level frames have their
854 // own RenderWidgets.
855 scoped_refptr<RenderWidget> render_widget_;
856
avi0392dbf52015-03-25 16:55:45857 // Temporarily holds state pertaining to a navigation that has been initiated
858 // until the NavigationState corresponding to the new navigation is created in
859 // didCreateDataSource().
860 scoped_ptr<NavigationParams> pending_navigation_params_;
861
[email protected]7a4e2532013-12-02 21:30:02862#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02863 // Current text input composition text. Empty if no composition is in
864 // progress.
[email protected]fcf75d42013-12-03 20:11:26865 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:09866
tommycli59bd86c2014-12-10 02:09:38867 PluginPowerSaverHelper* plugin_power_saver_helper_;
[email protected]7a4e2532013-12-02 21:30:02868#endif
869
[email protected]f3add922013-12-20 23:17:16870 RendererWebCookieJarImpl cookie_jar_;
871
[email protected]2e2d9632013-12-03 00:55:26872 // All the registered observers.
brettw236d3172015-06-03 16:31:43873 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:26874
[email protected]bffc8302014-01-23 20:52:16875 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
876
[email protected]4ecee352014-03-11 21:12:19877 // The node that the context menu was pressed over.
878 blink::WebNode context_menu_node_;
879
[email protected]a09d53ce2014-01-31 00:46:42880 // External context menu requests we're waiting for. "Internal"
881 // (WebKit-originated) context menu events will have an ID of 0 and will not
882 // be in this map.
883 //
884 // We don't want to add internal ones since some of the "special" page
885 // handlers in the browser process just ignore the context menu requests so
886 // avoid showing context menus, and so this will cause right clicks to leak
887 // entries in this map. Most users of the custom context menu (e.g. Pepper
888 // plugins) are normally only on "regular" pages and the regular pages will
889 // always respond properly to the request, so we don't have to worry so
890 // much about leaks.
891 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
892
[email protected]4ee64622014-03-21 22:34:15893 // The text selection the last time DidChangeSelection got called. May contain
894 // additional characters before and after the selected text, for IMEs. The
895 // portion of this string that is the actual selected text starts at index
896 // |selection_range_.GetMin() - selection_text_offset_| and has length
897 // |selection_range_.length()|.
898 base::string16 selection_text_;
899 // The offset corresponding to the start of |selection_text_| in the document.
900 size_t selection_text_offset_;
901 // Range over the document corresponding to the actual selected text (which
902 // could correspond to a substring of |selection_text_|; see above).
903 gfx::Range selection_range_;
904 // Used to inform didChangeSelection() when it is called in the context
905 // of handling a InputMsg_SelectRange IPC.
906 bool handling_select_range_;
907
[email protected]2626d142014-04-22 17:24:02908 // The next group of objects all implement RenderFrameObserver, so are deleted
909 // along with the RenderFrame automatically. This is why we just store weak
910 // references.
911
[email protected]4459599e2014-07-29 22:40:09912 // Dispatches permission requests for Web Notifications.
913 NotificationPermissionDispatcher* notification_permission_dispatcher_;
914
[email protected]977db4a42014-07-17 08:04:32915 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:33916 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:19917
jrummell109c3a602014-12-18 01:08:50918 // EncryptedMediaClient attached to this frame; lazily initialized.
xhwang430baee2015-01-22 05:46:20919 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:50920
xhwang36b1f3b2015-01-27 17:54:01921 // The media permission dispatcher attached to this frame, lazily initialized.
922 MediaPermissionDispatcher* media_permission_dispatcher_;
923
xhwang065b54b2015-06-03 22:25:55924#if defined(ENABLE_MEDIA_MOJO_RENDERER)
925 // The media service provider attached to this frame, lazily initialized.
xhwang33f939e2015-06-23 04:33:42926 mojo::ServiceProviderPtr media_service_provider_;
xhwang065b54b2015-06-03 22:25:55927#endif
928
[email protected]52d3e172014-06-16 16:57:02929 // MidiClient attached to this frame; lazily initialized.
930 MidiDispatcher* midi_dispatcher_;
931
[email protected]a017938b2014-05-27 21:17:17932#if defined(OS_ANDROID)
[email protected]4b556cf2014-06-10 23:21:53933 // Manages all media players in this render frame for communicating with the
934 // real media player in the browser process. It's okay to use a raw pointer
935 // since it's a RenderFrameObserver.
[email protected]a017938b2014-05-27 21:17:17936 RendererMediaPlayerManager* media_player_manager_;
[email protected]4b556cf2014-06-10 23:21:53937#endif
938
939#if defined(ENABLE_BROWSER_CDMS)
940 // Manage all CDMs in this render frame for communicating with the real CDM in
941 // the browser process. It's okay to use a raw pointer since it's a
942 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:00943 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:17944#endif
945
xhwangd7180832015-04-03 05:38:15946 // The CDM factory attached to this frame, lazily initialized.
947 RenderCdmFactory* cdm_factory_;
948
[email protected]a6e21c372014-07-12 02:27:21949#if defined(VIDEO_HOLE)
950 // Whether or not this RenderFrameImpl contains a media player. Used to
951 // register as an observer for video-hole-specific events.
952 bool contains_media_player_;
953#endif
954
dgozman358ba322015-03-26 15:05:30955 // The devtools agent for this frame; only created for main frame and
956 // local roots.
957 DevToolsAgent* devtools_agent_;
958
[email protected]45920862014-07-02 12:53:02959 // The geolocation dispatcher attached to this frame, lazily initialized.
[email protected]8eae0802014-06-02 21:35:55960 GeolocationDispatcher* geolocation_dispatcher_;
961
[email protected]45920862014-07-02 12:53:02962 // The push messaging dispatcher attached to this frame, lazily initialized.
963 PushMessagingDispatcher* push_messaging_dispatcher_;
964
avayvodbca35fad2015-01-29 20:20:57965 // The presentation dispatcher implementation attached to this frame, lazily
966 // initialized.
967 PresentationDispatcher* presentation_dispatcher_;
968
[email protected]c52a1412014-06-25 06:09:25969 ServiceRegistryImpl service_registry_;
970
[email protected]45920862014-07-02 12:53:02971 // The screen orientation dispatcher attached to the frame, lazily
972 // initialized.
[email protected]cf78eda2014-06-13 16:57:41973 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
974
mlamouriefdca9d2014-09-16 16:55:40975 // The Manifest Manager handles the manifest requests from the browser
976 // process.
977 ManifestManager* manifest_manager_;
978
[email protected]95640212014-07-26 18:14:30979 // The current accessibility mode.
980 AccessibilityMode accessibility_mode_;
981
982 // Only valid if |accessibility_mode_| is anything other than
983 // AccessibilityModeOff.
984 RendererAccessibility* renderer_accessibility_;
985
mlamouric6d31db2015-03-28 17:48:14986 scoped_ptr<PermissionDispatcher> permission_client_;
mlamouri670a86d2015-03-17 16:06:25987
benwells04ab5b962015-05-06 08:29:40988 scoped_ptr<blink::WebAppBannerClient> app_banner_client_;
989
bajones02443532015-06-22 21:17:40990#if defined(ENABLE_WEBVR)
991 // The VR dispatcher attached to the frame, lazily initialized.
992 scoped_ptr<VRDispatcher> vr_dispatcher_;
993#endif
994
avi485e5fd62014-08-25 23:26:14995#if defined(OS_MACOSX) || defined(OS_ANDROID)
996 // The external popup for the currently showing select popup.
997 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
998#endif
999
[email protected]96307312014-05-04 01:00:191000 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1001
[email protected]227692c52013-05-31 22:43:041002 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1003};
1004
1005} // namespace content
1006
[email protected]85d85fd2013-06-19 00:57:411007#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_