blob: 80cafda2b42b3828793c29bf011329fc653baf80 [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
guidou3906a722015-11-12 22:14:428#include <string>
[email protected]7a4e2532013-12-02 21:30:029#include <vector>
10
[email protected]227692c52013-05-31 22:43:0411#include "base/basictypes.h"
[email protected]7a4e2532013-12-02 21:30:0212#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4213#include "base/gtest_prod_util.h"
14#include "base/id_map.h"
xhwang430baee2015-01-22 05:46:2015#include "base/memory/scoped_ptr.h"
[email protected]abc501e2014-01-27 19:27:2616#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2617#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0218#include "base/process/process_handle.h"
[email protected]95640212014-07-26 18:14:3019#include "content/common/accessibility_mode_enums.h"
clamyda97e8322014-10-07 21:57:2520#include "content/common/frame_message_enums.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"
dalecurtis49f363882015-08-25 21:05:3829#include "media/blink/webmediaplayer_params.h"
rockotd9260982015-08-21 22:26:3030#include "mojo/application/public/interfaces/service_provider.mojom.h"
31#include "mojo/application/public/interfaces/shell.mojom.h"
benwells04ab5b962015-05-06 08:29:4032#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3033#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4134#include "third_party/WebKit/public/web/WebDataSource.h"
35#include "third_party/WebKit/public/web/WebFrameClient.h"
boliu15890e42015-11-24 23:08:0536#include "third_party/WebKit/public/web/WebFrameLoadType.h"
lazyboy70605c32015-11-03 01:27:3137#include "third_party/WebKit/public/web/WebFrameOwnerProperties.h"
[email protected]680575542014-04-03 17:12:5238#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4639#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
lukasza2e296c32015-09-28 23:29:4840#include "third_party/WebKit/public/web/WebPageSerializerClient.h"
twellington376424ad2015-05-04 18:57:2541#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1542#include "ui/gfx/range/range.h"
[email protected]227692c52013-05-31 22:43:0443
tommyclid481c482014-12-03 01:50:4144#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3845#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4146#endif
47
[email protected]a017938b2014-05-27 21:17:1748#if defined(OS_ANDROID)
49#include "content/renderer/media/android/renderer_media_player_manager.h"
50#endif
51
xhwangc0299ae32015-07-21 23:39:5052#if defined(ENABLE_MOJO_MEDIA)
53#include "media/mojo/interfaces/service_factory.mojom.h"
54#endif
55
clamy9bfeef42014-09-30 20:50:4256class GURL;
[email protected]7a4e2532013-12-02 21:30:0257class TransportDIB;
kenrba7199832015-01-22 23:44:5958struct FrameMsg_NewFrame_WidgetParams;
alexmose7da5a12015-04-09 02:22:1659struct FrameMsg_PostMessage_Params;
dspelle736c9db2015-04-03 04:53:1660struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0261
62namespace blink {
[email protected]5ee7f182014-04-25 19:45:2663class WebGeolocationClient;
[email protected]7a4e2532013-12-02 21:30:0264class WebMouseEvent;
[email protected]82ce5b92014-03-22 05:15:2665class WebContentDecryptionModule;
[email protected]96307312014-05-04 01:00:1966class WebMediaPlayer;
avayvodbca35fad2015-01-29 20:20:5767class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0268class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2669class WebSecurityOrigin;
alogvinovf50445a2015-10-30 13:00:1270class WebWakeLockClient;
[email protected]7a4e2532013-12-02 21:30:0271struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4272struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0273struct WebCursorInfo;
dcheng3ce04b62015-10-26 23:30:5574struct WebScreenInfo;
[email protected]7a4e2532013-12-02 21:30:0275}
76
77namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4278class Point;
[email protected]7a4e2532013-12-02 21:30:0279class Range;
80class Rect;
81}
82
jrummell109c3a602014-12-18 01:08:5083namespace media {
xhwangd7180832015-04-03 05:38:1584class CdmFactory;
xhwang60b430a2015-02-01 05:20:4685class MediaPermission;
dalecurtisa12e6062015-11-10 23:13:1486class RendererWebMediaPlayerDelegate;
jrummell109c3a602014-12-18 01:08:5087class WebEncryptedMediaClientImpl;
88}
89
xhwang33f939e2015-06-23 04:33:4290namespace mojo {
91class ServiceProvider;
92}
93
tommycli58e3172c2015-09-15 18:18:2694namespace url {
95class Origin;
96}
97
[email protected]227692c52013-05-31 22:43:0498namespace content {
99
[email protected]bffc8302014-01-23 20:52:16100class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:59101class CompositorDependencies;
dgozman358ba322015-03-26 15:05:30102class DevToolsAgent;
avi0392dbf52015-03-25 16:55:45103class DocumentState;
avi485e5fd62014-08-25 23:26:14104class ExternalPopupMenu;
[email protected]8eae0802014-06-02 21:35:55105class GeolocationDispatcher;
mlamouriefdca9d2014-09-16 16:55:40106class ManifestManager;
[email protected]977db4a42014-07-17 08:04:32107class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:08108class MediaStreamRendererFactory;
guoweisf4282b02015-09-24 23:05:22109class MediaPermissionDispatcherImpl;
[email protected]52d3e172014-06-16 16:57:02110class MidiDispatcher;
avi0392dbf52015-03-25 16:55:45111class NavigationState;
[email protected]4459599e2014-07-29 22:40:09112class NotificationPermissionDispatcher;
clamyda97e8322014-10-07 21:57:25113class PageState;
[email protected]7a4e2532013-12-02 21:30:02114class PepperPluginInstanceImpl;
mlamouric6d31db2015-03-28 17:48:14115class PermissionDispatcher;
avayvodbca35fad2015-01-29 20:20:57116class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:02117class PushMessagingDispatcher;
[email protected]95640212014-07-26 18:14:30118class RendererAccessibility;
[email protected]4b556cf2014-06-10 23:21:53119class RendererCdmManager;
120class RendererMediaPlayerManager;
[email protected]7a4e2532013-12-02 21:30:02121class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:26122class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04123class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02124class RenderWidget;
125class RenderWidgetFullscreenPepper;
[email protected]cf78eda2014-06-13 16:57:41126class ScreenOrientationDispatcher;
rockotac2a36e2015-11-20 17:56:54127class ServiceRegistry;
perkj1a2d0432014-09-03 13:52:33128class UserMediaClientImpl;
alogvinovf50445a2015-10-30 13:00:12129class WakeLockDispatcher;
clamy9bfeef42014-09-30 20:50:42130struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42131struct CustomContextMenuContext;
alexmosbc7eafa2014-12-06 01:38:09132struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45133struct NavigationParams;
clamy79b3da62014-10-14 08:50:37134struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04135struct ResourceResponseHead;
clamy34e12782015-03-12 11:26:13136struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12137struct StreamOverrideParameters;
bajones02443532015-06-22 21:17:40138class VRDispatcher;
[email protected]227692c52013-05-31 22:43:04139
[email protected]85d85fd2013-06-19 00:57:41140class CONTENT_EXPORT RenderFrameImpl
141 : public RenderFrame,
[email protected]96307312014-05-04 01:00:19142 NON_EXPORTED_BASE(public blink::WebFrameClient),
lukasza2e296c32015-09-28 23:29:48143 NON_EXPORTED_BASE(public blink::WebPageSerializerClient) {
[email protected]227692c52013-05-31 22:43:04144 public:
dchengc5ef1a52015-08-26 20:58:30145 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55146 static RenderFrameImpl* CreateMainFrame(
147 RenderViewImpl* render_view,
148 int32_t routing_id,
149 int32_t widget_routing_id,
150 bool hidden,
151 const blink::WebScreenInfo& screen_info,
152 CompositorDependencies* compositor_deps);
[email protected]2f61bdd2013-07-02 18:38:47153
alexmosa181efc2015-09-03 00:39:04154 // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is
155 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
156 // the frame tree after the frame identified by
157 // |previous_sibling_routing_id|, or as the first child if
alexmos9f8705a2015-05-06 19:58:59158 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
159 // semi-orphaned until it commits, at which point it replaces the proxy
alexmosa181efc2015-09-03 00:39:04160 // identified by |proxy_routing_id|. The frame's opener is set to the frame
161 // identified by |opener_routing_id|. The frame is created as a child of the
162 // RenderFrame identified by |parent_routing_id| or as the top-level frame if
163 // the latter is MSG_ROUTING_NONE. Note: This is called only when
alexmos9f8705a2015-05-06 19:58:59164 // RenderFrame is being created in response to IPC message from the browser
165 // process. All other frame creation is driven through Blink and Create.
lazyboy70605c32015-11-03 01:27:31166 static void CreateFrame(
167 int routing_id,
168 int proxy_routing_id,
169 int opener_routing_id,
170 int parent_routing_id,
171 int previous_sibling_routing_id,
172 const FrameReplicationState& replicated_state,
173 CompositorDependencies* compositor_deps,
174 const FrameMsg_NewFrame_WidgetParams& params,
175 const blink::WebFrameOwnerProperties& frameOwner_properties);
[email protected]82307f6b2014-08-07 03:30:12176
[email protected]5a7100d2014-05-19 01:29:04177 // Returns the RenderFrameImpl for the given routing ID.
178 static RenderFrameImpl* FromRoutingID(int routing_id);
179
[email protected]a5ac6dc2014-01-15 07:02:14180 // Just like RenderFrame::FromWebFrame but returns the implementation.
181 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09182
[email protected]2f61bdd2013-07-02 18:38:47183 // Used by content_layouttest_support to hook into the creation of
184 // RenderFrameImpls.
jochen664198b2015-06-25 14:13:00185 struct CreateParams {
186 CreateParams(RenderViewImpl* render_view, int32 routing_id)
187 : render_view(render_view), routing_id(routing_id) {}
188 ~CreateParams() {}
189
190 RenderViewImpl* render_view;
191 int32 routing_id;
192 };
193
194 using CreateRenderFrameImplFunction =
195 RenderFrameImpl* (*)(const CreateParams&);
[email protected]2f61bdd2013-07-02 18:38:47196 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50197 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47198
alexmos95733002015-08-24 16:38:09199 // Looks up and returns the WebFrame corresponding to a given opener frame
200 // routing ID. Also stores the opener's RenderView routing ID into
201 // |opener_view_routing_id|.
202 //
203 // TODO(alexmos): remove RenderViewImpl's dependency on
204 // opener_view_routing_id.
205 static blink::WebFrame* ResolveOpener(int opener_frame_routing_id,
206 int* opener_view_routing_id);
207
avi5c77d212015-09-25 20:08:25208 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04209
[email protected]b70da4c2014-01-06 19:57:09210 bool is_swapped_out() const {
211 return is_swapped_out_;
212 }
213
[email protected]5a7100d2014-05-19 01:29:04214 // TODO(nasko): This can be removed once we don't have a swapped out state on
215 // RenderFrames. See https://crbug.com/357747.
216 void set_render_frame_proxy(RenderFrameProxy* proxy) {
217 render_frame_proxy_ = proxy;
218 }
219
dglazkovf0e1d6d2015-10-10 02:13:48220 // Called by RenderWidget when meaningful layout has happened.
221 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
222 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
223
[email protected]bffc8302014-01-23 20:52:16224 // Out-of-process child frames receive a signal from RenderWidgetCompositor
225 // when a compositor frame has committed.
226 void DidCommitCompositorFrame();
227
[email protected]7a4e2532013-12-02 21:30:02228 // TODO(jam): this is a temporary getter until all the code is transitioned
229 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26230 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02231
[email protected]f3add922013-12-20 23:17:16232 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
233
[email protected]7a4e2532013-12-02 21:30:02234 // Returns the RenderWidget associated with this frame.
235 RenderWidget* GetRenderWidget();
236
dgozmancf9039cd2015-04-06 12:01:31237 DevToolsAgent* devtools_agent() { return devtools_agent_; }
238
[email protected]35b2a972014-04-04 15:50:22239 // This is called right after creation with the WebLocalFrame for this
[email protected]0287e762014-04-11 13:07:58240 // RenderFrame. It must be called before Initialize.
[email protected]35b2a972014-04-04 15:50:22241 void SetWebFrame(blink::WebLocalFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09242
[email protected]0287e762014-04-11 13:07:58243 // This method must be called after the frame has been added to the frame
244 // tree. It creates all objects that depend on the frame being at its proper
245 // spot.
246 void Initialize();
247
[email protected]de3c5d82014-05-28 22:12:59248 // Notifications from RenderWidget.
249 void WasHidden();
250 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31251 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59252
[email protected]723971b2014-02-12 11:08:25253 // Start/Stop loading notifications.
254 // TODO(nasko): Those are page-level methods at this time and come from
255 // WebViewClient. We should move them to be WebFrameClient calls and put
256 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09257 // |to_different_document| will be true unless the load is a fragment
258 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25259 void didStartLoading(bool to_different_document) override;
260 void didStopLoading() override;
261 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25262
[email protected]95640212014-07-26 18:14:30263 AccessibilityMode accessibility_mode() {
264 return accessibility_mode_;
265 }
266
267 RendererAccessibility* renderer_accessibility() {
268 return renderer_accessibility_;
269 }
270
271 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
272 blink::WebAXEvent event);
273
estade31c54342015-01-23 03:34:36274 // The focused node changed to |node|. If focus was lost from this frame,
275 // |node| will be null.
[email protected]95640212014-07-26 18:14:30276 void FocusedNodeChanged(const blink::WebNode& node);
277
estade31c54342015-01-23 03:34:36278 // TODO(dmazzoni): the only reason this is here is to plumb it through to
279 // RendererAccessibility. It should use the RenderFrameObserver method, once
280 // blink has a separate accessibility tree per frame.
281 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
282
[email protected]7a4e2532013-12-02 21:30:02283#if defined(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31284 // Notification that a PPAPI plugin has been created.
285 void PepperPluginCreated(RendererPpapiHost* host);
286
[email protected]7a4e2532013-12-02 21:30:02287 // Notifies that |instance| has changed the cursor.
288 // This will update the cursor appearance if it is currently over the plugin
289 // instance.
290 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
291 const blink::WebCursorInfo& cursor);
292
293 // Notifies that |instance| has received a mouse event.
294 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
295
[email protected]7a4e2532013-12-02 21:30:02296 // Informs the render view that a PPAPI plugin has changed text input status.
297 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
298 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
299
300 // Cancels current composition.
301 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
302
303 // Informs the render view that a PPAPI plugin has changed selection.
304 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
305
306 // Creates a fullscreen container for a pepper plugin instance.
307 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
308 PepperPluginInstanceImpl* plugin);
309
[email protected]7a4e2532013-12-02 21:30:02310 bool IsPepperAcceptingCompositionEvents() const;
311
312 // Notification that the given plugin has crashed.
313 void PluginCrashed(const base::FilePath& plugin_path,
314 base::ProcessId plugin_pid);
315
[email protected]7a4e2532013-12-02 21:30:02316 // Simulates IME events for testing purpose.
317 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26318 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02319 const std::vector<blink::WebCompositionUnderline>& underlines,
320 int selection_start,
321 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26322 void SimulateImeConfirmComposition(const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02323 const gfx::Range& replacement_range);
324
325 // TODO(jam): remove these once the IPC handler moves from RenderView to
326 // RenderFrame.
327 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42328 const base::string16& text,
329 const std::vector<blink::WebCompositionUnderline>& underlines,
330 int selection_start,
331 int selection_end);
332 void OnImeConfirmComposition(const base::string16& text,
333 const gfx::Range& replacement_range,
334 bool keep_selection);
335#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02336
[email protected]977db4a42014-07-17 08:04:32337 // May return NULL in some cases, especially if userMediaClient() returns
338 // NULL.
339 MediaStreamDispatcher* GetMediaStreamDispatcher();
340
avi485e5fd62014-08-25 23:26:14341#if defined(OS_MACOSX) || defined(OS_ANDROID)
342 void DidHideExternalPopupMenu();
343#endif
344
[email protected]227692c52013-05-31 22:43:04345 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52346 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04347
348 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52349 bool OnMessageReceived(const IPC::Message& msg) override;
[email protected]227692c52013-05-31 22:43:04350
[email protected]271ff5792013-12-04 22:29:31351 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52352 RenderView* GetRenderView() override;
353 int GetRoutingID() override;
354 blink::WebLocalFrame* GetWebFrame() override;
estade78d655f82015-01-30 01:55:08355 blink::WebElement GetFocusedElement() const override;
dcheng6d18e402014-10-21 12:32:52356 WebPreferences& GetWebkitPreferences() override;
357 int ShowContextMenu(ContextMenuClient* client,
358 const ContextMenuParams& params) override;
359 void CancelContextMenu(int request_id) override;
360 blink::WebNode GetContextMenuNode() const override;
tommycli59bd86c2014-12-10 02:09:38361 blink::WebPlugin* CreatePlugin(
362 blink::WebFrame* frame,
363 const WebPluginInfo& info,
364 const blink::WebPluginParams& params,
tommyclie8722702015-01-16 11:40:41365 scoped_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40366 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52367 blink::WebNavigationPolicy policy) override;
368 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07369 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52370 bool IsHidden() override;
371 ServiceRegistry* GetServiceRegistry() override;
tommyclid481c482014-12-03 01:50:41372#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38373 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26374 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38375 const base::Closure& unthrottle_callback) override;
tommyclibae63b92015-10-23 02:56:20376 bool ShouldThrottleContent(const url::Origin& main_frame_origin,
377 const url::Origin& content_origin,
tommyclibae63b92015-10-23 02:56:20378 int width,
379 int height,
380 bool* cross_origin_main_content) const override;
381 void WhitelistContentOrigin(const url::Origin& content_origin) override;
tommyclid481c482014-12-03 01:50:41382#endif
dcheng6d18e402014-10-21 12:32:52383 bool IsFTPDirectoryListing() override;
384 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52385 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52386 void SetSelectedText(const base::string16& selection_text,
387 size_t offset,
388 const gfx::Range& range) override;
389 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19390 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01391 void AddMessageToConsole(ConsoleMessageLevel level,
392 const std::string& message) override;
megjablond5ac7d52015-10-22 23:56:12393 bool IsUsingLoFi() const override;
[email protected]271ff5792013-12-04 22:29:31394
[email protected]96307312014-05-04 01:00:19395 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25396 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
397 const blink::WebPluginParams& params) override;
398 blink::WebMediaPlayer* createMediaPlayer(
srirama.m26f864d02015-07-14 05:21:46399 blink::WebLocalFrame* frame,
400 const blink::WebURL& url,
401 blink::WebMediaPlayerClient* client,
402 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15403 blink::WebContentDecryptionModule* initial_cdm,
404 const blink::WebString& sink_id) override;
davve50137b62015-10-23 12:15:21405 blink::WebMediaSession* createMediaSession() override;
avi5c77d212015-09-25 20:08:25406 blink::WebApplicationCacheHost* createApplicationCacheHost(
[email protected]35b2a972014-04-04 15:50:22407 blink::WebLocalFrame* frame,
avi5c77d212015-09-25 20:08:25408 blink::WebApplicationCacheHostClient* client) override;
409 blink::WebWorkerContentSettingsClientProxy*
410 createWorkerContentSettingsClientProxy(blink::WebLocalFrame* frame) override;
411 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22412 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25413 blink::WebExternalPopupMenuClient* popup_menu_client) override;
414 blink::WebCookieJar* cookieJar(blink::WebLocalFrame* frame) override;
415 blink::WebServiceWorkerProvider* createServiceWorkerProvider(
416 blink::WebLocalFrame* frame) override;
417 void didAccessInitialDocument(blink::WebLocalFrame* frame) override;
418 blink::WebFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17419 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56420 blink::WebTreeScopeType scope,
421 const blink::WebString& name,
lazyboy70605c32015-11-03 01:27:31422 blink::WebSandboxFlags sandboxFlags,
423 const blink::WebFrameOwnerProperties& frameOwnerProperties) override;
avi5c77d212015-09-25 20:08:25424 void didChangeOpener(blink::WebFrame* frame) override;
425 void frameDetached(blink::WebFrame* frame, DetachType type) override;
426 void frameFocused() override;
427 void willClose(blink::WebFrame* frame) override;
428 void didChangeName(blink::WebLocalFrame* frame,
429 const blink::WebString& name) override;
430 void didChangeSandboxFlags(blink::WebFrame* child_frame,
431 blink::WebSandboxFlags flags) override;
lazyboy70605c32015-11-03 01:27:31432 virtual void didChangeFrameOwnerProperties(
433 blink::WebFrame* child_frame,
434 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25435 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22436 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46437 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25438 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
439 override;
440 bool shouldReportDetailedMessageForSource(
441 const blink::WebString& source) override;
442 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
443 const blink::WebString& source_name,
444 unsigned source_line,
445 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40446 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25447 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40448 const blink::WebString& suggested_name,
449 bool should_replace_current_entry) override;
avi5c77d212015-09-25 20:08:25450 blink::WebNavigationPolicy decidePolicyForNavigation(
451 const NavigationPolicyInfo& info) override;
452 blink::WebHistoryItem historyItemForNewChildFrame(
453 blink::WebFrame* frame) override;
454 void willSendSubmitEvent(blink::WebLocalFrame* frame,
455 const blink::WebFormElement& form) override;
456 void willSubmitForm(blink::WebLocalFrame* frame,
457 const blink::WebFormElement& form) override;
458 void didCreateDataSource(blink::WebLocalFrame* frame,
459 blink::WebDataSource* datasource) override;
460 void didStartProvisionalLoad(blink::WebLocalFrame* frame,
461 double triggering_event_time) override;
462 void didReceiveServerRedirectForProvisionalLoad(
463 blink::WebLocalFrame* frame) override;
464 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
465 const blink::WebURLError& error,
466 blink::WebHistoryCommitType commit_type) override;
467 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22468 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52469 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25470 blink::WebHistoryCommitType commit_type) override;
471 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
472 void didClearWindowObject(blink::WebLocalFrame* frame) override;
473 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
474 void didReceiveTitle(blink::WebLocalFrame* frame,
475 const blink::WebString& title,
476 blink::WebTextDirection direction) override;
477 void didChangeIcon(blink::WebLocalFrame* frame,
478 blink::WebIconURL::Type icon_type) override;
479 void didFinishDocumentLoad(blink::WebLocalFrame* frame,
480 bool document_is_empty) override;
481 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
482 void didFailLoad(blink::WebLocalFrame* frame,
483 const blink::WebURLError& error,
484 blink::WebHistoryCommitType commit_type) override;
485 void didFinishLoad(blink::WebLocalFrame* frame) override;
486 void didNavigateWithinPage(blink::WebLocalFrame* frame,
487 const blink::WebHistoryItem& item,
488 blink::WebHistoryCommitType commit_type) override;
489 void didUpdateCurrentHistoryItem(blink::WebLocalFrame* frame) override;
490 void didChangeThemeColor() override;
491 void dispatchLoad() override;
492 void requestNotificationPermission(
[email protected]4459599e2014-07-29 22:40:09493 const blink::WebSecurityOrigin& origin,
avi5c77d212015-09-25 20:08:25494 blink::WebNotificationPermissionCallback* callback) override;
495 void didChangeSelection(bool is_empty_selection) override;
496 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19497 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55498 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25499 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
500 void runModalAlertDialog(const blink::WebString& message) override;
501 bool runModalConfirmDialog(const blink::WebString& message) override;
502 bool runModalPromptDialog(const blink::WebString& message,
503 const blink::WebString& default_value,
504 blink::WebString* actual_value) override;
505 bool runModalBeforeUnloadDialog(bool is_reload,
506 const blink::WebString& message) override;
507 void showContextMenu(const blink::WebContextMenuData& data) override;
508 void clearContextMenu() override;
509 void willSendRequest(blink::WebLocalFrame* frame,
510 unsigned identifier,
511 blink::WebURLRequest& request,
512 const blink::WebURLResponse& redirect_response) override;
513 void didReceiveResponse(blink::WebLocalFrame* frame,
514 unsigned identifier,
515 const blink::WebURLResponse& response) override;
516 void didLoadResourceFromMemoryCache(
[email protected]35b2a972014-04-04 15:50:22517 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46518 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25519 const blink::WebURLResponse& response) override;
520 void didDisplayInsecureContent() override;
521 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
522 const blink::WebURL& target) override;
523 void didChangePerformanceTiming() override;
524 void didAbortLoading(blink::WebLocalFrame* frame) override;
525 void didCreateScriptContext(blink::WebLocalFrame* frame,
526 v8::Local<v8::Context> context,
527 int extension_group,
528 int world_id) override;
529 void willReleaseScriptContext(blink::WebLocalFrame* frame,
530 v8::Local<v8::Context> context,
531 int world_id) override;
532 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
533 void willInsertBody(blink::WebLocalFrame* frame) override;
534 void reportFindInPageMatchCount(int request_id,
535 int count,
536 bool final_update) override;
537 void reportFindInPageSelection(int request_id,
538 int active_match_ordinal,
539 const blink::WebRect& sel) override;
540 void requestStorageQuota(blink::WebLocalFrame* frame,
541 blink::WebStorageQuotaType type,
542 unsigned long long requested_size,
543 blink::WebStorageQuotaCallbacks callbacks) override;
544 void willOpenWebSocket(blink::WebSocketHandle* handle) override;
alogvinovf50445a2015-10-30 13:00:12545 blink::WebWakeLockClient* wakeLockClient() override;
avi5c77d212015-09-25 20:08:25546 blink::WebGeolocationClient* geolocationClient() override;
547 blink::WebPushClient* pushClient() override;
548 blink::WebPresentationClient* presentationClient() override;
549 void willStartUsingPeerConnectionHandler(
[email protected]35b2a972014-04-04 15:50:22550 blink::WebLocalFrame* frame,
avi5c77d212015-09-25 20:08:25551 blink::WebRTCPeerConnectionHandler* handler) override;
552 blink::WebUserMediaClient* userMediaClient() override;
553 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
554 blink::WebMIDIClient* webMIDIClient() override;
555 bool willCheckAndDispatchMessageEvent(
[email protected]ce5064f2014-05-07 22:49:20556 blink::WebLocalFrame* source_frame,
557 blink::WebFrame* target_frame,
558 blink::WebSecurityOrigin target_origin,
avi5c77d212015-09-25 20:08:25559 blink::WebDOMMessageEvent event) override;
tzik34958ad62015-10-08 14:07:45560 blink::WebString userAgentOverride(blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25561 blink::WebString doNotTrackValue(blink::WebLocalFrame* frame) override;
562 bool allowWebGL(blink::WebLocalFrame* frame, bool default_value) override;
563 void didLoseWebGLContext(blink::WebLocalFrame* frame,
564 int arb_robustness_status_code) override;
565 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
566 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
567 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
568 void postAccessibilityEvent(const blink::WebAXObject& obj,
569 blink::WebAXEvent event) override;
570 void handleAccessibilityFindInPageResult(
571 int identifier,
572 int match_index,
573 const blink::WebAXObject& start_object,
574 int start_offset,
575 const blink::WebAXObject& end_object,
576 int end_offset) override;
577 void didChangeManifest(blink::WebLocalFrame*) override;
578 bool enterFullscreen() override;
579 bool exitFullscreen() override;
580 blink::WebPermissionClient* permissionClient() override;
581 blink::WebAppBannerClient* appBannerClient() override;
582 void registerProtocolHandler(const blink::WebString& scheme,
583 const blink::WebURL& url,
584 const blink::WebString& title) override;
585 void unregisterProtocolHandler(const blink::WebString& scheme,
586 const blink::WebURL& url) override;
587 blink::WebBluetooth* bluetooth() override;
588 blink::WebUSBClient* usbClient() override;
guidou3906a722015-11-12 22:14:42589 void checkIfAudioSinkExistsAndIsAuthorized(
590 const blink::WebString& sink_id,
591 const blink::WebSecurityOrigin& security_origin,
592 blink::WebSetSinkIdCallbacks* web_callbacks) override;
[email protected]85d85fd2013-06-19 00:57:41593
bajones02443532015-06-22 21:17:40594#if defined(ENABLE_WEBVR)
595 blink::WebVRClient* webVRClient() override;
596#endif
597
lukasza2e296c32015-09-28 23:29:48598 // WebPageSerializerClient implementation:
599 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48600 const blink::WebCString& data,
601 blink::WebPageSerializerClient::PageSerializationStatus status) override;
602
nasko78f06bc2014-11-18 18:18:57603 // Make this frame show an empty, unscriptable page.
604 // TODO(nasko): Remove this method once swapped out state is no longer used.
605 void NavigateToSwappedOutURL();
606
mlamouri4fff1992014-09-30 11:22:46607 ManifestManager* manifest_manager();
608
avi0392dbf52015-03-25 16:55:45609 // TODO(creis): Remove when the only caller, the HistoryController, is no
610 // more.
611 void SetPendingNavigationParams(
612 scoped_ptr<NavigationParams> navigation_params);
613
guoweisf4282b02015-09-24 23:05:22614 // Expose MediaPermission to the non-UI threads. Any calls to this will be
615 // redirected to |media_permission_dispatcher_| on UI thread and have the
616 // callback called on |caller_task_runner|.
617 scoped_ptr<media::MediaPermission> CreateMediaPermissionProxy(
618 scoped_refptr<base::SingleThreadTaskRunner> caller_task_runner);
619
creis69b184a472015-11-26 05:29:51620 // Sends the current frame's navigation state to the browser.
621 void SendUpdateState();
622
[email protected]2f61bdd2013-07-02 18:38:47623 protected:
jochen664198b2015-06-25 14:13:00624 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47625
[email protected]227692c52013-05-31 22:43:04626 private:
kenrbf98a4d22015-04-01 21:59:35627 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26628 friend class RenderFrameObserver;
[email protected]95640212014-07-26 18:14:30629 friend class RendererAccessibilityTest;
clamy98a9dee02015-06-24 16:09:10630 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14631 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
632 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
633 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
634 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
[email protected]66bbadaf2014-03-28 16:25:54635 FRIEND_TEST_ALL_PREFIXES(RendererAccessibilityTest,
636 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26637
twellington376424ad2015-05-04 18:57:25638 // A wrapper class used as the callback for JavaScript executed
639 // in an isolated world.
640 class JavaScriptIsolatedWorldRequest
641 : public blink::WebScriptExecutionCallback {
642 public:
643 JavaScriptIsolatedWorldRequest(
644 int id,
645 bool notify_result,
646 int routing_id,
647 base::WeakPtr<RenderFrameImpl> render_frame_impl);
648 void completed(
649 const blink::WebVector<v8::Local<v8::Value>>& result) override;
650
651 private:
avi5c77d212015-09-25 20:08:25652 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25653
654 int id_;
655 bool notify_result_;
656 int routing_id_;
657 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
658
659 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
660 };
661
[email protected]37567b432014-02-12 01:12:22662 typedef std::map<GURL, double> HostZoomLevels;
663
dchengc5ef1a52015-08-26 20:58:30664 // Creates a new RenderFrame. |render_view| is the RenderView object that this
665 // frame belongs to.
666 // Callers *must* call |SetWebFrame| immediately after creation.
667 static RenderFrameImpl* Create(RenderViewImpl* render_view, int32 routing_id);
668
[email protected]2e2d9632013-12-03 00:55:26669 // Functions to add and remove observers for this object.
670 void AddObserver(RenderFrameObserver* observer);
671 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34672
dcheng3d886b732015-11-05 19:16:01673 bool IsLocalRoot() const;
674
[email protected]f0906a02014-08-07 07:18:55675 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35676 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08677 blink::WebHistoryCommitType commit_type,
678 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22679
[email protected]b70da4c2014-01-06 19:57:09680 // IPC message handlers ------------------------------------------------------
681 //
682 // The documentation for these functions should be in
683 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10684 void OnNavigate(const CommonNavigationParams& common_params,
685 const StartNavigationParams& start_params,
686 const RequestNavigationParams& request_params);
[email protected]f76f32232014-03-11 17:36:17687 void OnBeforeUnload();
alexmosbc7eafa2014-12-06 01:38:09688 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56689 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09690 const FrameReplicationState& replicated_frame_state);
Nasko Oskov85f60222014-08-28 22:53:30691 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42692 void OnShowContextMenu(const gfx::Point& location);
693 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
694 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
695 unsigned action);
[email protected]4ee64622014-03-21 22:34:15696 void OnUndo();
697 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07698 void OnCut();
699 void OnCopy();
700 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15701 void OnPasteAndMatchStyle();
702 void OnDelete();
703 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14704 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38705 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15706 void OnUnselect();
christiankaeed9862014-11-05 10:49:14707 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17708 void OnReplace(const base::string16& text);
709 void OnReplaceMisspelling(const base::string16& text);
[email protected]e31b8ebb2014-03-07 17:59:34710 void OnCSSInsertRequest(const std::string& css);
peter4eb242002015-06-02 12:45:13711 void OnAddMessageToConsole(ConsoleMessageLevel level,
712 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52713 void OnJavaScriptExecuteRequest(const base::string16& javascript,
714 int id,
715 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28716 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
717 int id,
jochen2e7d95b2015-05-04 15:28:50718 bool notify_result,
719 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25720 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
721 int id,
722 bool notify_result,
723 int world_id);
igsolla1cea67b72015-02-11 16:25:04724 void OnVisualStateRequest(uint64 key);
[email protected]4ee64622014-03-21 22:34:15725 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16726 void OnSetCompositionFromExistingText(
727 int start, int end,
728 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24729 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16730 void OnExtendSelectionAndDelete(int before, int after);
[email protected]4fed3702014-04-01 09:08:00731 void OnReload(bool ignore_cache);
[email protected]96bb6132014-06-16 17:22:19732 void OnTextSurroundingSelectionRequest(size_t max_length);
[email protected]95640212014-07-26 18:14:30733 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51734 void OnSnapshotAccessibilityTree(int callback_id);
alexmos95733002015-08-24 16:38:09735 void OnUpdateOpener(int opener_routing_id);
dcheng5f60abb2015-05-28 01:39:36736 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
lazyboy70605c32015-11-03 01:27:31737 void OnSetFrameOwnerProperties(
738 const blink::WebFrameOwnerProperties& frame_owner_properties);
dspelle736c9db2015-04-03 04:53:16739 void OnTextTrackSettingsChanged(
740 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16741 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
avi485e5fd62014-08-25 23:26:14742#if defined(OS_ANDROID)
743 void OnSelectPopupMenuItems(bool canceled,
744 const std::vector<int>& selected_indices);
745#elif defined(OS_MACOSX)
746 void OnSelectPopupMenuItem(int selected_index);
[email protected]4ee64622014-03-21 22:34:15747 void OnCopyToFindPboard();
748#endif
[email protected]9c9343b2014-03-08 02:56:07749
davidbena5496d62014-10-07 18:52:04750 void OnCommitNavigation(const ResourceResponseHead& response,
751 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42752 const CommonNavigationParams& common_params,
clamy57b4b8e2015-03-24 13:32:11753 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57754 void OnFailedNavigation(const CommonNavigationParams& common_params,
755 const RequestNavigationParams& request_params,
756 bool has_stale_copy_in_cache,
757 int error_code);
lukasza6af746b72015-09-18 23:37:22758 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48759 void OnGetSerializedHtmlWithLocalLinks(
760 std::vector<GURL> original_urls,
761 std::vector<base::FilePath> equivalent_local_paths,
762 base::FilePath local_directory_path);
clamy9bfeef42014-09-30 20:50:42763
japhetb0bae9d82015-10-19 20:43:40764 void OpenURL(const GURL& url,
[email protected]65920f332014-03-04 21:14:18765 const Referrer& referrer,
japhetb0bae9d82015-10-19 20:43:40766 blink::WebNavigationPolicy policy,
767 bool should_replace_current_entry);
[email protected]a09d53ce2014-01-31 00:46:42768
clamyd6983032015-04-29 14:48:12769 // Performs a navigation in the frame. This provides a unified function for
770 // the current code path and the browser-side navigation path (in
771 // development). Currently used by OnNavigate, with all *NavigationParams
772 // provided by the browser. |stream_params| should be null.
773 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
774 // |request_params| received by the browser. |stream_params| should be non
775 // null and created from the information provided by the browser.
776 // |start_params| is not used.
777 void NavigateInternal(const CommonNavigationParams& common_params,
778 const StartNavigationParams& start_params,
779 const RequestNavigationParams& request_params,
780 scoped_ptr<StreamOverrideParameters> stream_params);
781
[email protected]ef3adfc2014-05-11 00:04:54782 // Update current main frame's encoding and send it to browser window.
783 // Since we want to let users see the right encoding info from menu
784 // before finishing loading, we call the UpdateEncoding in
785 // a) function:DidCommitLoadForFrame. When this function is called,
786 // that means we have got first data. In here we try to get encoding
787 // of page if it has been specified in http header.
788 // b) function:DidReceiveTitle. When this function is called,
789 // that means we have got specified title. Because in most of webpages,
790 // title tags will follow meta tags. In here we try to get encoding of
791 // page if it has been specified in meta tag.
792 // c) function:DidFinishDocumentLoadForFrame. When this function is
793 // called, that means we have got whole html page. In here we should
794 // finally get right encoding of page.
795 void UpdateEncoding(blink::WebFrame* frame,
796 const std::string& encoding_name);
797
[email protected]4ee64622014-03-21 22:34:15798 // Dispatches the current state of selection on the webpage to the browser if
799 // it has changed.
800 // TODO(varunjain): delete this method once we figure out how to keep
801 // selection handles in sync with the webpage.
802 void SyncSelectionIfRequired();
803
[email protected]87de04b02014-04-08 22:14:49804 bool RunJavaScriptMessage(JavaScriptMessageType type,
805 const base::string16& message,
806 const base::string16& default_value,
807 const GURL& frame_url,
808 base::string16* result);
809
[email protected]457736d2014-04-30 15:54:27810 // Loads the appropriate error page for the specified failure into the frame.
811 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
812 const blink::WebURLError& error,
813 bool replace);
814
zeeshanq3454e9c2014-09-04 21:30:28815 void HandleJavascriptExecutionResult(const base::string16& javascript,
816 int id,
817 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41818 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28819
[email protected]977db4a42014-07-17 08:04:32820 // Initializes |web_user_media_client_|. If this fails, because it wasn't
821 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
822 // |web_user_media_client_| will remain NULL.
823 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19824
825 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:15826 blink::WebMediaPlayerClient* client,
827 const blink::WebString& sink_id,
828 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:19829
[email protected]ae2477e2014-05-27 23:47:08830 // Creates a factory object used for creating audio and video renderers.
jochen51265132015-05-28 07:33:45831 scoped_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08832
avi5cad4912015-06-19 05:25:44833 // Does preparation for the navigation to |url|.
834 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25835 const GURL& url,
clamy57b4b8e2015-03-24 13:32:11836 const RequestNavigationParams& request_params,
clamyda97e8322014-10-07 21:57:25837 bool* is_reload,
838 blink::WebURLRequest::CachePolicy* cache_policy);
839
clamyece38882014-11-19 15:00:20840 // PlzNavigate
841 // Sends a FrameHostMsg_BeginNavigation to the browser based on the contents
842 // of the WebURLRequest.
843 void BeginNavigation(blink::WebURLRequest* request);
844
clamy4cc9b8202015-03-02 13:51:36845 // Loads a data url.
846 void LoadDataURL(const CommonNavigationParams& params,
boliu15890e42015-11-24 23:08:05847 blink::WebFrame* frame,
848 blink::WebFrameLoadType load_type);
clamy4cc9b8202015-03-02 13:51:36849
clamy62b271d2015-04-16 11:54:57850 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
851 // the failed request |request|.
852 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
853 const blink::WebURLError& error,
854 blink::WebLocalFrame* frame);
855
856 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
857 const GURL& unreachable_url);
858
[email protected]f3a95312014-06-12 16:46:58859 // Returns the URL being loaded by the |frame_|'s request.
860 GURL GetLoadingUrl() const;
861
avi0392dbf52015-03-25 16:55:45862 // If we initiated a navigation, this function will populate |document_state|
863 // with the navigation information saved in OnNavigate().
864 void PopulateDocumentStateFromPending(DocumentState* document_state);
865
866 // Returns a new NavigationState populated with the navigation information
867 // saved in OnNavigate().
868 NavigationState* CreateNavigationStateFromPending();
869
csharrison1ce0e852015-11-07 16:45:13870 // Sets the NavigationState on the DocumentState based on
871 // the value of |pending_navigation_params_|.
872 void UpdateNavigationState(DocumentState* document_state);
873
[email protected]96307312014-05-04 01:00:19874#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:00875 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:27876 blink::WebMediaPlayerClient* client,
srirama.m26f864d02015-07-14 05:21:46877 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
dalecurtis49f363882015-08-25 21:05:38878 const media::WebMediaPlayerParams& params);
[email protected]a017938b2014-05-27 21:17:17879
[email protected]65f3d1aa2014-05-29 01:57:00880 RendererMediaPlayerManager* GetMediaPlayerManager();
[email protected]4b556cf2014-06-10 23:21:53881#endif
882
sandersd02d9aea2015-05-12 02:29:26883 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:42884
xhwangd7180832015-04-03 05:38:15885 media::MediaPermission* GetMediaPermission();
xhwang33f939e2015-06-23 04:33:42886
xhwange70b7ee12015-06-25 09:17:17887#if defined(ENABLE_MOJO_MEDIA)
xhwangc0299ae32015-07-21 23:39:50888 media::interfaces::ServiceFactory* GetMediaServiceFactory();
xhwang33f939e2015-06-23 04:33:42889
xhwangc0299ae32015-07-21 23:39:50890 // Called when a connection error happened on |media_service_factory_|.
891 void OnMediaServiceFactoryConnectionError();
xhwang33f939e2015-06-23 04:33:42892#endif
893
xhwangd7180832015-04-03 05:38:15894 media::CdmFactory* GetCdmFactory();
[email protected]96307312014-05-04 01:00:19895
halton.huoca2eabd2015-07-06 08:17:40896 void RegisterMojoServices();
897
rockotd9260982015-08-21 22:26:30898 // Connects to a Mojo application and returns a proxy to its exposed
899 // ServiceProvider.
900 mojo::ServiceProviderPtr ConnectToApplication(const GURL& url);
901
dalecurtisa12e6062015-11-10 23:13:14902 // Returns the media delegate for WebMediaPlayer usage. If
903 // |media_player_delegate_| is NULL, one is created.
904 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
905
creiscfaa4462015-03-16 19:27:18906 // Stores the WebLocalFrame we are associated with. This is null from the
907 // constructor until SetWebFrame is called, and it is null after
908 // frameDetached is called until destruction (which is asynchronous in the
909 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:22910 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:09911
dglazkov2e140f52015-09-28 16:10:07912 // Boolean value indicating whether this RenderFrameImpl object is for the
913 // main frame or not. It remains accurate during destruction, even when
914 // |frame_| has been invalidated.
915 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:19916
[email protected]abc501e2014-01-27 19:27:26917 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:04918 int routing_id_;
[email protected]1c2052f2013-08-28 08:24:34919 bool is_swapped_out_;
nasko8b9d9bd2015-05-06 19:23:19920
[email protected]5a7100d2014-05-19 01:29:04921 // RenderFrameProxy exists only when is_swapped_out_ is true.
922 // TODO(nasko): This can be removed once we don't have a swapped out state on
923 // RenderFrame. See https://crbug.com/357747.
924 RenderFrameProxy* render_frame_proxy_;
[email protected]1c2052f2013-08-28 08:24:34925 bool is_detaching_;
[email protected]227692c52013-05-31 22:43:04926
japhete6adf142014-10-31 00:01:49927 // If this frame was created to replace a proxy, this will store the routing
928 // id of the proxy to replace at commit-time, at which time it will be
929 // cleared.
930 // TODO(creis): Remove this after switching to PlzNavigate.
931 int proxy_routing_id_;
932
dcheng3d886b732015-11-05 19:16:01933 // Non-null when the RenderFrame is a local root for compositing, input,
934 // layout, etc. A local frame is also a local root iff it does not have a
935 // parent that is a local frame.
kenrba7199832015-01-22 23:44:59936 scoped_refptr<RenderWidget> render_widget_;
937
avi0392dbf52015-03-25 16:55:45938 // Temporarily holds state pertaining to a navigation that has been initiated
939 // until the NavigationState corresponding to the new navigation is created in
940 // didCreateDataSource().
941 scoped_ptr<NavigationParams> pending_navigation_params_;
942
creis8eb8ef22015-11-04 22:51:38943 // Stores the current history item for this frame, so that updates to it can
944 // be reported to the browser process via SendUpdateState.
945 blink::WebHistoryItem current_history_item_;
946
[email protected]7a4e2532013-12-02 21:30:02947#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02948 // Current text input composition text. Empty if no composition is in
949 // progress.
[email protected]fcf75d42013-12-03 20:11:26950 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:09951
tommycli59bd86c2014-12-10 02:09:38952 PluginPowerSaverHelper* plugin_power_saver_helper_;
[email protected]7a4e2532013-12-02 21:30:02953#endif
954
[email protected]f3add922013-12-20 23:17:16955 RendererWebCookieJarImpl cookie_jar_;
956
[email protected]2e2d9632013-12-03 00:55:26957 // All the registered observers.
brettw236d3172015-06-03 16:31:43958 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:26959
[email protected]bffc8302014-01-23 20:52:16960 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
961
[email protected]4ecee352014-03-11 21:12:19962 // The node that the context menu was pressed over.
963 blink::WebNode context_menu_node_;
964
[email protected]a09d53ce2014-01-31 00:46:42965 // External context menu requests we're waiting for. "Internal"
966 // (WebKit-originated) context menu events will have an ID of 0 and will not
967 // be in this map.
968 //
969 // We don't want to add internal ones since some of the "special" page
970 // handlers in the browser process just ignore the context menu requests so
971 // avoid showing context menus, and so this will cause right clicks to leak
972 // entries in this map. Most users of the custom context menu (e.g. Pepper
973 // plugins) are normally only on "regular" pages and the regular pages will
974 // always respond properly to the request, so we don't have to worry so
975 // much about leaks.
976 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
977
[email protected]4ee64622014-03-21 22:34:15978 // The text selection the last time DidChangeSelection got called. May contain
979 // additional characters before and after the selected text, for IMEs. The
980 // portion of this string that is the actual selected text starts at index
981 // |selection_range_.GetMin() - selection_text_offset_| and has length
982 // |selection_range_.length()|.
983 base::string16 selection_text_;
984 // The offset corresponding to the start of |selection_text_| in the document.
985 size_t selection_text_offset_;
986 // Range over the document corresponding to the actual selected text (which
987 // could correspond to a substring of |selection_text_|; see above).
988 gfx::Range selection_range_;
989 // Used to inform didChangeSelection() when it is called in the context
990 // of handling a InputMsg_SelectRange IPC.
991 bool handling_select_range_;
992
[email protected]2626d142014-04-22 17:24:02993 // The next group of objects all implement RenderFrameObserver, so are deleted
994 // along with the RenderFrame automatically. This is why we just store weak
995 // references.
996
[email protected]4459599e2014-07-29 22:40:09997 // Dispatches permission requests for Web Notifications.
998 NotificationPermissionDispatcher* notification_permission_dispatcher_;
999
[email protected]977db4a42014-07-17 08:04:321000 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:331001 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191002
jrummell109c3a602014-12-18 01:08:501003 // EncryptedMediaClient attached to this frame; lazily initialized.
xhwang430baee2015-01-22 05:46:201004 scoped_ptr<media::WebEncryptedMediaClientImpl> web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501005
xhwang36b1f3b2015-01-27 17:54:011006 // The media permission dispatcher attached to this frame, lazily initialized.
guoweisf4282b02015-09-24 23:05:221007 MediaPermissionDispatcherImpl* media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011008
xhwange70b7ee12015-06-25 09:17:171009#if defined(ENABLE_MOJO_MEDIA)
xhwangc0299ae32015-07-21 23:39:501010 // The media factory attached to this frame, lazily initialized.
1011 media::interfaces::ServiceFactoryPtr media_service_factory_;
xhwang065b54b2015-06-03 22:25:551012#endif
1013
[email protected]52d3e172014-06-16 16:57:021014 // MidiClient attached to this frame; lazily initialized.
1015 MidiDispatcher* midi_dispatcher_;
1016
[email protected]a017938b2014-05-27 21:17:171017#if defined(OS_ANDROID)
[email protected]4b556cf2014-06-10 23:21:531018 // Manages all media players in this render frame for communicating with the
1019 // real media player in the browser process. It's okay to use a raw pointer
1020 // since it's a RenderFrameObserver.
[email protected]a017938b2014-05-27 21:17:171021 RendererMediaPlayerManager* media_player_manager_;
[email protected]4b556cf2014-06-10 23:21:531022#endif
1023
1024#if defined(ENABLE_BROWSER_CDMS)
1025 // Manage all CDMs in this render frame for communicating with the real CDM in
1026 // the browser process. It's okay to use a raw pointer since it's a
1027 // RenderFrameObserver.
[email protected]65f3d1aa2014-05-29 01:57:001028 RendererCdmManager* cdm_manager_;
[email protected]a017938b2014-05-27 21:17:171029#endif
1030
xhwangd7180832015-04-03 05:38:151031 // The CDM factory attached to this frame, lazily initialized.
xhwangf2eb532f2015-06-25 01:51:191032 scoped_ptr<media::CdmFactory> cdm_factory_;
xhwangd7180832015-04-03 05:38:151033
[email protected]a6e21c372014-07-12 02:27:211034#if defined(VIDEO_HOLE)
1035 // Whether or not this RenderFrameImpl contains a media player. Used to
1036 // register as an observer for video-hole-specific events.
1037 bool contains_media_player_;
1038#endif
1039
dgozman358ba322015-03-26 15:05:301040 // The devtools agent for this frame; only created for main frame and
1041 // local roots.
1042 DevToolsAgent* devtools_agent_;
1043
alogvinovf50445a2015-10-30 13:00:121044 WakeLockDispatcher* wakelock_dispatcher_;
1045
[email protected]45920862014-07-02 12:53:021046 // The geolocation dispatcher attached to this frame, lazily initialized.
[email protected]8eae0802014-06-02 21:35:551047 GeolocationDispatcher* geolocation_dispatcher_;
1048
[email protected]45920862014-07-02 12:53:021049 // The push messaging dispatcher attached to this frame, lazily initialized.
1050 PushMessagingDispatcher* push_messaging_dispatcher_;
1051
avayvodbca35fad2015-01-29 20:20:571052 // The presentation dispatcher implementation attached to this frame, lazily
1053 // initialized.
1054 PresentationDispatcher* presentation_dispatcher_;
1055
rockotac2a36e2015-11-20 17:56:541056 scoped_ptr<ServiceRegistry> service_registry_;
1057
1058 // Used to vend WeakPtrs to our ServiceRegistry.
1059 scoped_ptr<base::WeakPtrFactory<ServiceRegistry>>
1060 service_registry_weak_factory_;
[email protected]c52a1412014-06-25 06:09:251061
rockotd9260982015-08-21 22:26:301062 // The shell proxy used to connect to Mojo applications.
1063 mojo::ShellPtr mojo_shell_;
1064
[email protected]45920862014-07-02 12:53:021065 // The screen orientation dispatcher attached to the frame, lazily
1066 // initialized.
[email protected]cf78eda2014-06-13 16:57:411067 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1068
mlamouriefdca9d2014-09-16 16:55:401069 // The Manifest Manager handles the manifest requests from the browser
1070 // process.
1071 ManifestManager* manifest_manager_;
1072
[email protected]95640212014-07-26 18:14:301073 // The current accessibility mode.
1074 AccessibilityMode accessibility_mode_;
1075
1076 // Only valid if |accessibility_mode_| is anything other than
1077 // AccessibilityModeOff.
1078 RendererAccessibility* renderer_accessibility_;
1079
mlamouric6d31db2015-03-28 17:48:141080 scoped_ptr<PermissionDispatcher> permission_client_;
mlamouri670a86d2015-03-17 16:06:251081
benwells04ab5b962015-05-06 08:29:401082 scoped_ptr<blink::WebAppBannerClient> app_banner_client_;
1083
jyasskinf89a11b2015-07-21 00:27:481084 scoped_ptr<blink::WebBluetooth> bluetooth_;
1085
rockotd9260982015-08-21 22:26:301086 scoped_ptr<blink::WebUSBClient> usb_client_;
1087
dalecurtisa12e6062015-11-10 23:13:141088 // Manages play, pause notifications for WebMediaPlayer implementations; its
1089 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1090 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1091
megjablond5ac7d52015-10-22 23:56:121092 // Whether or not this RenderFrame is using Lo-Fi mode.
1093 bool is_using_lofi_;
1094
bajones02443532015-06-22 21:17:401095#if defined(ENABLE_WEBVR)
1096 // The VR dispatcher attached to the frame, lazily initialized.
1097 scoped_ptr<VRDispatcher> vr_dispatcher_;
1098#endif
1099
avi485e5fd62014-08-25 23:26:141100#if defined(OS_MACOSX) || defined(OS_ANDROID)
1101 // The external popup for the currently showing select popup.
1102 scoped_ptr<ExternalPopupMenu> external_popup_menu_;
1103#endif
1104
[email protected]96307312014-05-04 01:00:191105 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1106
[email protected]227692c52013-05-31 22:43:041107 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1108};
1109
1110} // namespace content
1111
[email protected]85d85fd2013-06-19 00:57:411112#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_