blob: 0e9a70afa995af7e3a035ae60061162d395018ae [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
avi1023d012015-12-25 02:39:148#include <stddef.h>
9#include <stdint.h>
10
dchengcedca5612016-04-09 01:40:1511#include <memory>
guidou3906a722015-11-12 22:14:4212#include <string>
[email protected]7a4e2532013-12-02 21:30:0213#include <vector>
14
[email protected]7a4e2532013-12-02 21:30:0215#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4216#include "base/gtest_prod_util.h"
17#include "base/id_map.h"
avi1023d012015-12-25 02:39:1418#include "base/macros.h"
hubbe5f0ad43b2015-12-14 20:57:2619#include "base/memory/linked_ptr.h"
lukaszabb2101b82016-06-17 16:52:2520#include "base/memory/ref_counted.h"
[email protected]abc501e2014-01-27 19:27:2621#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2622#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0223#include "base/process/process_handle.h"
avi1023d012015-12-25 02:39:1424#include "build/build_config.h"
[email protected]95640212014-07-26 18:14:3025#include "content/common/accessibility_mode_enums.h"
rockotf62002a2016-09-15 00:08:5926#include "content/common/associated_interface_registry_impl.h"
ben76f52b242016-06-18 05:42:4827#include "content/common/frame.mojom.h"
clamyda97e8322014-10-07 21:57:2528#include "content/common/frame_message_enums.h"
rockot53be7caf2016-10-04 20:17:0829#include "content/common/renderer.mojom.h"
peter4eb242002015-06-02 12:45:1330#include "content/public/common/console_message_level.h"
[email protected]87de04b02014-04-08 22:14:4931#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1832#include "content/public/common/referrer.h"
paulmeyer5d0a5f02016-01-21 20:15:5233#include "content/public/common/stop_find_action.h"
[email protected]227692c52013-05-31 22:43:0434#include "content/public/renderer/render_frame.h"
skyostilb4cce1b2016-03-31 17:56:3435#include "content/renderer/frame_blame_context.h"
ben88716142016-07-30 00:03:0336#include "content/renderer/mojo/blink_interface_provider_impl.h"
[email protected]f3add922013-12-20 23:17:1637#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0438#include "ipc/ipc_message.h"
lukasza70b79c82015-12-14 20:24:1339#include "ipc/ipc_platform_file.h"
acolwell9e0840d2014-09-06 19:01:3240#include "media/blink/webmediaplayer_delegate.h"
dalecurtis49f363882015-08-25 21:05:3841#include "media/blink/webmediaplayer_params.h"
miu1ddf18c62016-09-24 01:39:4142#include "media/mojo/interfaces/remoting.mojom.h"
ben155ecf82016-06-21 22:43:2643#include "mojo/public/cpp/bindings/binding.h"
benf709a3092016-04-12 22:38:2244#include "services/shell/public/interfaces/connector.mojom.h"
45#include "services/shell/public/interfaces/interface_provider.mojom.h"
tbansal7b6cf8b2016-05-10 19:27:2346#include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
alexmos401f0aba2015-12-06 10:07:3947#include "third_party/WebKit/public/platform/WebFocusType.h"
csharrisonae811ab2016-04-11 11:32:2548#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
sandersdf92f4e5c2016-01-22 20:57:2249#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
lfg717154072016-06-30 15:04:1650#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
benwells04ab5b962015-05-06 08:29:4051#include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerClient.h"
[email protected]95640212014-07-26 18:14:3052#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4153#include "third_party/WebKit/public/web/WebDataSource.h"
54#include "third_party/WebKit/public/web/WebFrameClient.h"
boliu15890e42015-11-24 23:08:0555#include "third_party/WebKit/public/web/WebFrameLoadType.h"
lukasza902fcc52015-12-31 04:45:2956#include "third_party/WebKit/public/web/WebFrameSerializerClient.h"
[email protected]680575542014-04-03 17:12:5257#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4658#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
twellington376424ad2015-05-04 18:57:2559#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1560#include "ui/gfx/range/range.h"
lukaszaede9cc02015-12-30 23:48:3261#include "url/gurl.h"
[email protected]227692c52013-05-31 22:43:0462
tommyclid481c482014-12-03 01:50:4163#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3864#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4165#endif
66
[email protected]a017938b2014-05-27 21:17:1767#if defined(OS_ANDROID)
68#include "content/renderer/media/android/renderer_media_player_manager.h"
69#endif
70
xhwangc0299ae32015-07-21 23:39:5071#if defined(ENABLE_MOJO_MEDIA)
jbromanb73f2582016-01-11 16:35:0572#include "media/mojo/interfaces/service_factory.mojom.h" // nogncheck
xhwangc0299ae32015-07-21 23:39:5073#endif
74
[email protected]7a4e2532013-12-02 21:30:0275class TransportDIB;
alexmose7da5a12015-04-09 02:22:1676struct FrameMsg_PostMessage_Params;
lukaszaede9cc02015-12-30 23:48:3277struct FrameMsg_SerializeAsMHTML_Params;
dspelle736c9db2015-04-03 04:53:1678struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0279
avi7d30b552016-04-06 20:32:5580namespace IPC {
81class SyncMessage;
82}
83
[email protected]7a4e2532013-12-02 21:30:0284namespace blink {
[email protected]82ce5b92014-03-22 05:15:2685class WebContentDecryptionModule;
raymesbba82b32016-07-19 00:41:3886class WebMouseEvent;
avayvodbca35fad2015-01-29 20:20:5787class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0288class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2689class WebSecurityOrigin;
toyoshimf3f7f682016-04-08 07:47:4890enum class WebCachePolicy;
[email protected]7a4e2532013-12-02 21:30:0291struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4292struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0293struct WebCursorInfo;
paulmeyer5d0a5f02016-01-21 20:15:5294struct WebFindOptions;
thestig4c8f2a72016-08-13 01:39:1195} // namespace blink
[email protected]7a4e2532013-12-02 21:30:0296
97namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:4298class Point;
[email protected]7a4e2532013-12-02 21:30:0299class Range;
100class Rect;
101}
102
jrummell109c3a602014-12-18 01:08:50103namespace media {
xhwangd7180832015-04-03 05:38:15104class CdmFactory;
xhwang409e53552016-02-23 00:52:44105class DecoderFactory;
xhwang60b430a2015-02-01 05:20:46106class MediaPermission;
hubbe5f0ad43b2015-12-14 20:57:26107class MediaServiceProvider;
xjzd3fe45a2016-10-12 18:26:37108class RemotingController;
dalecurtisa12e6062015-11-10 23:13:14109class RendererWebMediaPlayerDelegate;
watkdee516f2016-02-18 02:22:19110class SurfaceManager;
hubbe5f0ad43b2015-12-14 20:57:26111class UrlIndex;
jrummell109c3a602014-12-18 01:08:50112class WebEncryptedMediaClientImpl;
113}
114
ben155ecf82016-06-21 22:43:26115namespace shell {
116class InterfaceRegistry;
117class InterfaceProvider;
xhwang33f939e2015-06-23 04:33:42118}
119
tommycli58e3172c2015-09-15 18:18:26120namespace url {
121class Origin;
122}
123
[email protected]227692c52013-05-31 22:43:04124namespace content {
125
rockotf62002a2016-09-15 00:08:59126class AssociatedInterfaceProviderImpl;
[email protected]bffc8302014-01-23 20:52:16127class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:59128class CompositorDependencies;
dgozman358ba322015-03-26 15:05:30129class DevToolsAgent;
avi0392dbf52015-03-25 16:55:45130class DocumentState;
avi485e5fd62014-08-25 23:26:14131class ExternalPopupMenu;
yzshen0424e6952016-09-06 16:48:58132class HistoryEntry;
mlamouriefdca9d2014-09-16 16:55:40133class ManifestManager;
xhwanga5967e552016-02-26 00:54:08134class MediaInterfaceProvider;
[email protected]977db4a42014-07-17 08:04:32135class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:08136class MediaStreamRendererFactory;
xhwang5206d4e62016-02-05 02:09:55137class MediaPermissionDispatcher;
[email protected]52d3e172014-06-16 16:57:02138class MidiDispatcher;
avi0392dbf52015-03-25 16:55:45139class NavigationState;
clamyda97e8322014-10-07 21:57:25140class PageState;
[email protected]7a4e2532013-12-02 21:30:02141class PepperPluginInstanceImpl;
avayvodbca35fad2015-01-29 20:20:57142class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:02143class PushMessagingDispatcher;
dmazzoni8e6fe4d2016-06-27 06:35:37144class RenderAccessibilityImpl;
[email protected]4b556cf2014-06-10 23:21:53145class RendererCdmManager;
146class RendererMediaPlayerManager;
davve859f4f92015-11-27 10:16:19147class RendererMediaSessionManager;
[email protected]7a4e2532013-12-02 21:30:02148class RendererPpapiHost;
watkdee516f2016-02-18 02:22:19149class RendererSurfaceViewManager;
[email protected]2e2d9632013-12-03 00:55:26150class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04151class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02152class RenderWidget;
153class RenderWidgetFullscreenPepper;
lukaszade802372016-06-16 17:17:23154class ResourceRequestBodyImpl;
[email protected]cf78eda2014-06-13 16:57:41155class ScreenOrientationDispatcher;
perkj1a2d0432014-09-03 13:52:33156class UserMediaClientImpl;
alogvinovf50445a2015-10-30 13:00:12157class WakeLockDispatcher;
clamy9bfeef42014-09-30 20:50:42158struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42159struct CustomContextMenuContext;
naskoada75b22016-06-11 16:09:46160struct FileChooserFileInfo;
161struct FileChooserParams;
raymesbba82b32016-07-19 00:41:38162struct FrameOwnerProperties;
alexmosbc7eafa2014-12-06 01:38:09163struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45164struct NavigationParams;
clamy79b3da62014-10-14 08:50:37165struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04166struct ResourceResponseHead;
ccameron2f451532016-09-07 21:49:27167struct ScreenInfo;
clamy34e12782015-03-12 11:26:13168struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12169struct StreamOverrideParameters;
[email protected]227692c52013-05-31 22:43:04170
rockot53be7caf2016-10-04 20:17:08171namespace {
172class CreateFrameWidgetParams;
173}
174
[email protected]85d85fd2013-06-19 00:57:41175class CONTENT_EXPORT RenderFrameImpl
176 : public RenderFrame,
ben76f52b242016-06-18 05:42:48177 NON_EXPORTED_BASE(mojom::Frame),
[email protected]96307312014-05-04 01:00:19178 NON_EXPORTED_BASE(public blink::WebFrameClient),
lukasza902fcc52015-12-31 04:45:29179 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) {
[email protected]227692c52013-05-31 22:43:04180 public:
dchengc5ef1a52015-08-26 20:58:30181 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55182 static RenderFrameImpl* CreateMainFrame(
183 RenderViewImpl* render_view,
184 int32_t routing_id,
185 int32_t widget_routing_id,
186 bool hidden,
ccameron2f451532016-09-07 21:49:27187 const ScreenInfo& screen_info,
dcheng9e24bd352016-03-01 19:15:51188 CompositorDependencies* compositor_deps,
189 blink::WebFrame* opener);
[email protected]2f61bdd2013-07-02 18:38:47190
alexmosa181efc2015-09-03 00:39:04191 // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is
192 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
193 // the frame tree after the frame identified by
194 // |previous_sibling_routing_id|, or as the first child if
alexmos9f8705a2015-05-06 19:58:59195 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
196 // semi-orphaned until it commits, at which point it replaces the proxy
alexmosa181efc2015-09-03 00:39:04197 // identified by |proxy_routing_id|. The frame's opener is set to the frame
198 // identified by |opener_routing_id|. The frame is created as a child of the
199 // RenderFrame identified by |parent_routing_id| or as the top-level frame if
200 // the latter is MSG_ROUTING_NONE. Note: This is called only when
alexmos9f8705a2015-05-06 19:58:59201 // RenderFrame is being created in response to IPC message from the browser
202 // process. All other frame creation is driven through Blink and Create.
raymes31457802016-07-20 06:08:09203 static void CreateFrame(int routing_id,
204 int proxy_routing_id,
205 int opener_routing_id,
206 int parent_routing_id,
207 int previous_sibling_routing_id,
208 const FrameReplicationState& replicated_state,
209 CompositorDependencies* compositor_deps,
rockot53be7caf2016-10-04 20:17:08210 const mojom::CreateFrameWidgetParams& params,
raymes31457802016-07-20 06:08:09211 const FrameOwnerProperties& frame_owner_properties);
[email protected]82307f6b2014-08-07 03:30:12212
[email protected]5a7100d2014-05-19 01:29:04213 // Returns the RenderFrameImpl for the given routing ID.
214 static RenderFrameImpl* FromRoutingID(int routing_id);
215
[email protected]a5ac6dc2014-01-15 07:02:14216 // Just like RenderFrame::FromWebFrame but returns the implementation.
217 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09218
[email protected]2f61bdd2013-07-02 18:38:47219 // Used by content_layouttest_support to hook into the creation of
220 // RenderFrameImpls.
jochen664198b2015-06-25 14:13:00221 struct CreateParams {
avi1023d012015-12-25 02:39:14222 CreateParams(RenderViewImpl* render_view, int32_t routing_id)
jochen664198b2015-06-25 14:13:00223 : render_view(render_view), routing_id(routing_id) {}
224 ~CreateParams() {}
225
226 RenderViewImpl* render_view;
avi1023d012015-12-25 02:39:14227 int32_t routing_id;
jochen664198b2015-06-25 14:13:00228 };
229
230 using CreateRenderFrameImplFunction =
231 RenderFrameImpl* (*)(const CreateParams&);
[email protected]2f61bdd2013-07-02 18:38:47232 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50233 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47234
alexmos95733002015-08-24 16:38:09235 // Looks up and returns the WebFrame corresponding to a given opener frame
236 // routing ID. Also stores the opener's RenderView routing ID into
237 // |opener_view_routing_id|.
238 //
239 // TODO(alexmos): remove RenderViewImpl's dependency on
240 // opener_view_routing_id.
241 static blink::WebFrame* ResolveOpener(int opener_frame_routing_id,
242 int* opener_view_routing_id);
243
kdsilvae0135592016-08-09 17:08:11244 // Overwrites the given URL to use an HTML5 embed if possible.
245 blink::WebURL overrideFlashEmbedWithHTML(const blink::WebURL& url) override;
246
avi5c77d212015-09-25 20:08:25247 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04248
dglazkovf0e1d6d2015-10-10 02:13:48249 // Called by RenderWidget when meaningful layout has happened.
250 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
251 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
252
[email protected]bffc8302014-01-23 20:52:16253 // Out-of-process child frames receive a signal from RenderWidgetCompositor
254 // when a compositor frame has committed.
255 void DidCommitCompositorFrame();
256
lfge0c2792ec2016-05-11 18:52:08257 // Draw commands have been issued by RenderWidgetCompositor.
258 void DidCommitAndDrawCompositorFrame();
259
[email protected]7a4e2532013-12-02 21:30:02260 // TODO(jam): this is a temporary getter until all the code is transitioned
261 // to using RenderFrame instead of RenderView.
[email protected]abc501e2014-01-27 19:27:26262 RenderViewImpl* render_view() { return render_view_.get(); }
[email protected]7a4e2532013-12-02 21:30:02263
creis225a7432016-06-03 22:56:27264 const blink::WebHistoryItem& current_history_item() {
265 return current_history_item_;
266 }
267
[email protected]f3add922013-12-20 23:17:16268 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
269
[email protected]7a4e2532013-12-02 21:30:02270 // Returns the RenderWidget associated with this frame.
271 RenderWidget* GetRenderWidget();
272
dgozmancf9039cd2015-04-06 12:01:31273 DevToolsAgent* devtools_agent() { return devtools_agent_; }
274
[email protected]0287e762014-04-11 13:07:58275 // This method must be called after the frame has been added to the frame
276 // tree. It creates all objects that depend on the frame being at its proper
277 // spot.
278 void Initialize();
279
[email protected]de3c5d82014-05-28 22:12:59280 // Notifications from RenderWidget.
281 void WasHidden();
282 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31283 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59284
[email protected]723971b2014-02-12 11:08:25285 // Start/Stop loading notifications.
286 // TODO(nasko): Those are page-level methods at this time and come from
287 // WebViewClient. We should move them to be WebFrameClient calls and put
288 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09289 // |to_different_document| will be true unless the load is a fragment
290 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25291 void didStartLoading(bool to_different_document) override;
292 void didStopLoading() override;
293 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25294
[email protected]95640212014-07-26 18:14:30295 AccessibilityMode accessibility_mode() {
296 return accessibility_mode_;
297 }
298
dmazzoni8e6fe4d2016-06-27 06:35:37299 RenderAccessibilityImpl* render_accessibility() {
300 return render_accessibility_;
[email protected]95640212014-07-26 18:14:30301 }
302
303 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
304 blink::WebAXEvent event);
305
estade31c54342015-01-23 03:34:36306 // The focused node changed to |node|. If focus was lost from this frame,
307 // |node| will be null.
[email protected]95640212014-07-26 18:14:30308 void FocusedNodeChanged(const blink::WebNode& node);
309
estade31c54342015-01-23 03:34:36310 // TODO(dmazzoni): the only reason this is here is to plumb it through to
dmazzoni8e6fe4d2016-06-27 06:35:37311 // RenderAccessibilityImpl. It should use the RenderFrameObserver method, once
estade31c54342015-01-23 03:34:36312 // blink has a separate accessibility tree per frame.
313 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
314
lfge0c2792ec2016-05-11 18:52:08315 // Called when this frame's widget is focused.
316 void RenderWidgetSetFocus(bool enable);
317
318 // Called when the widget receives a mouse event.
319 void RenderWidgetWillHandleMouseEvent();
320
[email protected]7a4e2532013-12-02 21:30:02321#if defined(ENABLE_PLUGINS)
paulmeyer5d0a5f02016-01-21 20:15:52322 // Get/set the plugin which will be used to handle document find requests.
323 void set_plugin_find_handler(PepperPluginInstanceImpl* plugin) {
324 plugin_find_handler_ = plugin;
325 }
326 PepperPluginInstanceImpl* plugin_find_handler() {
327 return plugin_find_handler_;
328 }
329
[email protected]271ff5792013-12-04 22:29:31330 // Notification that a PPAPI plugin has been created.
331 void PepperPluginCreated(RendererPpapiHost* host);
332
[email protected]7a4e2532013-12-02 21:30:02333 // Notifies that |instance| has changed the cursor.
334 // This will update the cursor appearance if it is currently over the plugin
335 // instance.
336 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
337 const blink::WebCursorInfo& cursor);
338
339 // Notifies that |instance| has received a mouse event.
340 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
341
[email protected]7a4e2532013-12-02 21:30:02342 // Informs the render view that a PPAPI plugin has changed text input status.
343 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
344 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
345
346 // Cancels current composition.
347 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
348
349 // Informs the render view that a PPAPI plugin has changed selection.
350 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
351
352 // Creates a fullscreen container for a pepper plugin instance.
353 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
354 PepperPluginInstanceImpl* plugin);
355
[email protected]7a4e2532013-12-02 21:30:02356 bool IsPepperAcceptingCompositionEvents() const;
357
358 // Notification that the given plugin has crashed.
359 void PluginCrashed(const base::FilePath& plugin_path,
360 base::ProcessId plugin_pid);
361
[email protected]7a4e2532013-12-02 21:30:02362 // Simulates IME events for testing purpose.
363 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26364 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02365 const std::vector<blink::WebCompositionUnderline>& underlines,
366 int selection_start,
367 int selection_end);
aelias87b8f7c2016-09-14 03:19:29368 void SimulateImeCommitText(const base::string16& text,
369 const gfx::Range& replacement_range);
370 void SimulateImeFinishComposingText(bool keep_selection);
[email protected]7a4e2532013-12-02 21:30:02371
372 // TODO(jam): remove these once the IPC handler moves from RenderView to
373 // RenderFrame.
374 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42375 const base::string16& text,
376 const std::vector<blink::WebCompositionUnderline>& underlines,
377 int selection_start,
378 int selection_end);
aelias87b8f7c2016-09-14 03:19:29379 void OnImeCommitText(const base::string16& text,
380 const gfx::Range& replacement_range,
381 int relative_cursor_pos);
382 void OnImeFinishComposingText(bool keep_selection);
383
tommyclie6633ca72014-10-31 00:40:42384#endif // defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02385
[email protected]977db4a42014-07-17 08:04:32386 // May return NULL in some cases, especially if userMediaClient() returns
387 // NULL.
388 MediaStreamDispatcher* GetMediaStreamDispatcher();
389
haibinluc643d33c2016-06-03 02:22:34390#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:14391 void DidHideExternalPopupMenu();
392#endif
393
[email protected]227692c52013-05-31 22:43:04394 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52395 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04396
397 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52398 bool OnMessageReceived(const IPC::Message& msg) override;
rockotce2138c2016-09-16 00:09:18399 void OnAssociatedInterfaceRequest(
400 const std::string& interface_name,
401 mojo::ScopedInterfaceEndpointHandle handle) override;
[email protected]227692c52013-05-31 22:43:04402
[email protected]271ff5792013-12-04 22:29:31403 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52404 RenderView* GetRenderView() override;
dmazzoni8e6fe4d2016-06-27 06:35:37405 RenderAccessibility* GetRenderAccessibility() override;
dcheng6d18e402014-10-21 12:32:52406 int GetRoutingID() override;
407 blink::WebLocalFrame* GetWebFrame() override;
408 WebPreferences& GetWebkitPreferences() override;
409 int ShowContextMenu(ContextMenuClient* client,
410 const ContextMenuParams& params) override;
411 void CancelContextMenu(int request_id) override;
tommycli59bd86c2014-12-10 02:09:38412 blink::WebPlugin* CreatePlugin(
413 blink::WebFrame* frame,
414 const WebPluginInfo& info,
415 const blink::WebPluginParams& params,
dchengcedca5612016-04-09 01:40:15416 std::unique_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40417 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52418 blink::WebNavigationPolicy policy) override;
419 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07420 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52421 bool IsHidden() override;
ben155ecf82016-06-21 22:43:26422 shell::InterfaceRegistry* GetInterfaceRegistry() override;
423 shell::InterfaceProvider* GetRemoteInterfaces() override;
rockotf62002a2016-09-15 00:08:59424 AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
425 AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
tommyclid481c482014-12-03 01:50:41426#if defined(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38427 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26428 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38429 const base::Closure& unthrottle_callback) override;
tommycli9c7cbd92015-12-18 23:34:34430 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus(
431 const url::Origin& main_frame_origin,
432 const url::Origin& content_origin,
tommycli8a1ef84d2016-08-10 23:05:08433 const gfx::Size& unobscured_size,
434 RecordPeripheralDecision record_decision) const override;
tommyclibae63b92015-10-23 02:56:20435 void WhitelistContentOrigin(const url::Origin& content_origin) override;
thestig4c8f2a72016-08-13 01:39:11436 void DidStartLoading() override;
437 void DidStopLoading() override;
tommyclid481c482014-12-03 01:50:41438#endif
dcheng6d18e402014-10-21 12:32:52439 bool IsFTPDirectoryListing() override;
440 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52441 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52442 void SetSelectedText(const base::string16& selection_text,
443 size_t offset,
444 const gfx::Range& range) override;
445 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19446 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01447 void AddMessageToConsole(ConsoleMessageLevel level,
448 const std::string& message) override;
megjablond5ac7d52015-10-22 23:56:12449 bool IsUsingLoFi() const override;
ellyjonesdb20fae12015-12-04 16:47:55450 bool IsPasting() const override;
lfg717154072016-06-30 15:04:16451 blink::WebPageVisibilityState GetVisibilityState() const override;
[email protected]271ff5792013-12-04 22:29:31452
ben76f52b242016-06-18 05:42:48453 // mojom::Frame implementation:
454 void GetInterfaceProvider(
455 shell::mojom::InterfaceProviderRequest request) override;
456
[email protected]96307312014-05-04 01:00:19457 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25458 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
459 const blink::WebPluginParams& params) override;
460 blink::WebMediaPlayer* createMediaPlayer(
guidou9bfe4e2f2016-04-09 08:31:19461 const blink::WebMediaPlayerSource& source,
srirama.m26f864d02015-07-14 05:21:46462 blink::WebMediaPlayerClient* client,
463 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15464 blink::WebContentDecryptionModule* initial_cdm,
zqzhangf85a8f82016-09-22 19:12:09465 const blink::WebString& sink_id) override;
avi5c77d212015-09-25 20:08:25466 blink::WebApplicationCacheHost* createApplicationCacheHost(
avi5c77d212015-09-25 20:08:25467 blink::WebApplicationCacheHostClient* client) override;
468 blink::WebWorkerContentSettingsClientProxy*
avi01681ef2016-02-16 17:53:57469 createWorkerContentSettingsClientProxy() override;
avi5c77d212015-09-25 20:08:25470 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22471 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25472 blink::WebExternalPopupMenuClient* popup_menu_client) override;
avi5047cd572016-02-16 20:41:12473 blink::WebCookieJar* cookieJar() override;
skyostilb4cce1b2016-03-31 17:56:34474 blink::BlameContext* frameBlameContext() override;
avi01681ef2016-02-16 17:53:57475 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override;
avi5047cd572016-02-16 20:41:12476 void didAccessInitialDocument() override;
dcheng9f8e2f62016-09-29 15:54:50477 blink::WebLocalFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17478 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56479 blink::WebTreeScopeType scope,
480 const blink::WebString& name,
lukasza464d8692016-02-22 19:26:32481 const blink::WebString& unique_name,
482 blink::WebSandboxFlags sandbox_flags,
483 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25484 void didChangeOpener(blink::WebFrame* frame) override;
lfgaf41ee002016-07-05 14:57:24485 void frameDetached(blink::WebLocalFrame* frame, DetachType type) override;
avi5c77d212015-09-25 20:08:25486 void frameFocused() override;
dcheng9f8e2f62016-09-29 15:54:50487 void willCommitProvisionalLoad(blink::WebLocalFrame* frame) override;
lukasza464d8692016-02-22 19:26:32488 void didChangeName(const blink::WebString& name,
489 const blink::WebString& unique_name) override;
mkwstf672e7ef2016-06-09 20:51:07490 void didEnforceInsecureRequestPolicy(
491 blink::WebInsecureRequestPolicy policy) override;
estarkbd8e26f2016-03-16 23:30:37492 void didUpdateToUniqueOrigin(
493 bool is_potentially_trustworthy_unique_origin) override;
avi5c77d212015-09-25 20:08:25494 void didChangeSandboxFlags(blink::WebFrame* child_frame,
495 blink::WebSandboxFlags flags) override;
lukasza8e1c02e42016-05-17 20:05:10496 void didAddContentSecurityPolicy(
497 const blink::WebString& header_value,
498 blink::WebContentSecurityPolicyType type,
499 blink::WebContentSecurityPolicySource source) override;
Avi Drissman09b359e52015-12-07 20:19:21500 void didChangeFrameOwnerProperties(
lazyboy70605c32015-11-03 01:27:31501 blink::WebFrame* child_frame,
502 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25503 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22504 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46505 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25506 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
507 override;
508 bool shouldReportDetailedMessageForSource(
509 const blink::WebString& source) override;
510 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
511 const blink::WebString& source_name,
512 unsigned source_line,
513 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40514 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25515 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40516 const blink::WebString& suggested_name,
517 bool should_replace_current_entry) override;
avi5c77d212015-09-25 20:08:25518 blink::WebNavigationPolicy decidePolicyForNavigation(
519 const NavigationPolicyInfo& info) override;
creise18ce072015-12-02 02:00:02520 blink::WebHistoryItem historyItemForNewChildFrame() override;
avi0fe3a6d2016-02-16 20:57:27521 void willSendSubmitEvent(const blink::WebFormElement& form) override;
522 void willSubmitForm(const blink::WebFormElement& form) override;
avi5c77d212015-09-25 20:08:25523 void didCreateDataSource(blink::WebLocalFrame* frame,
524 blink::WebDataSource* datasource) override;
525 void didStartProvisionalLoad(blink::WebLocalFrame* frame,
526 double triggering_event_time) override;
527 void didReceiveServerRedirectForProvisionalLoad(
528 blink::WebLocalFrame* frame) override;
529 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
530 const blink::WebURLError& error,
531 blink::WebHistoryCommitType commit_type) override;
532 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22533 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52534 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25535 blink::WebHistoryCommitType commit_type) override;
536 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
537 void didClearWindowObject(blink::WebLocalFrame* frame) override;
538 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
rob43ea0642016-03-19 01:05:01539 void runScriptsAtDocumentElementAvailable(
540 blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25541 void didReceiveTitle(blink::WebLocalFrame* frame,
542 const blink::WebString& title,
543 blink::WebTextDirection direction) override;
544 void didChangeIcon(blink::WebLocalFrame* frame,
545 blink::WebIconURL::Type icon_type) override;
rob2718dfc2016-03-25 20:58:27546 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override;
547 void runScriptsAtDocumentReady(blink::WebLocalFrame* frame,
548 bool document_is_empty) override;
avi5c77d212015-09-25 20:08:25549 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
550 void didFailLoad(blink::WebLocalFrame* frame,
551 const blink::WebURLError& error,
552 blink::WebHistoryCommitType commit_type) override;
553 void didFinishLoad(blink::WebLocalFrame* frame) override;
554 void didNavigateWithinPage(blink::WebLocalFrame* frame,
555 const blink::WebHistoryItem& item,
avi68a109ab2016-05-15 01:46:32556 blink::WebHistoryCommitType commit_type,
557 bool content_initiated) override;
avi1008732f2016-02-17 17:28:49558 void didUpdateCurrentHistoryItem() override;
avi5c77d212015-09-25 20:08:25559 void didChangeThemeColor() override;
560 void dispatchLoad() override;
tbansal7b6cf8b2016-05-10 19:27:23561 blink::WebEffectiveConnectionType getEffectiveConnectionType() override;
avi5c77d212015-09-25 20:08:25562 void didChangeSelection(bool is_empty_selection) override;
alexmos56567492016-09-13 00:52:46563 bool handleCurrentKeyboardEvent() override;
avi5c77d212015-09-25 20:08:25564 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19565 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55566 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25567 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
568 void runModalAlertDialog(const blink::WebString& message) override;
569 bool runModalConfirmDialog(const blink::WebString& message) override;
570 bool runModalPromptDialog(const blink::WebString& message,
571 const blink::WebString& default_value,
572 blink::WebString* actual_value) override;
avi141dbc1322016-03-11 22:27:42573 bool runModalBeforeUnloadDialog(bool is_reload) override;
naskoada75b22016-06-11 16:09:46574 bool runFileChooser(
575 const blink::WebFileChooserParams& params,
576 blink::WebFileChooserCompletion* chooser_completion) override;
avi5c77d212015-09-25 20:08:25577 void showContextMenu(const blink::WebContextMenuData& data) override;
brettw8f508f42016-06-20 21:34:21578 void saveImageFromDataURL(const blink::WebString& data_url) override;
avi5c77d212015-09-25 20:08:25579 void willSendRequest(blink::WebLocalFrame* frame,
japhet8489f1b2016-08-24 00:27:59580 blink::WebURLRequest& request) override;
581 void didReceiveResponse(const blink::WebURLResponse& response) override;
avi5c77d212015-09-25 20:08:25582 void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46583 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25584 const blink::WebURLResponse& response) override;
585 void didDisplayInsecureContent() override;
586 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
587 const blink::WebURL& target) override;
estark910b4572015-12-09 20:55:41588 void didDisplayContentWithCertificateErrors(
jamc94a7532016-09-07 19:40:29589 const blink::WebURL& url) override;
590 void didRunContentWithCertificateErrors(const blink::WebURL& url) override;
avi5c77d212015-09-25 20:08:25591 void didChangePerformanceTiming() override;
csharrisonae811ab2016-04-11 11:32:25592 void didObserveLoadingBehavior(
593 blink::WebLoadingBehaviorFlag behavior) override;
avi5c77d212015-09-25 20:08:25594 void didCreateScriptContext(blink::WebLocalFrame* frame,
595 v8::Local<v8::Context> context,
596 int extension_group,
597 int world_id) override;
598 void willReleaseScriptContext(blink::WebLocalFrame* frame,
599 v8::Local<v8::Context> context,
600 int world_id) override;
601 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
602 void willInsertBody(blink::WebLocalFrame* frame) override;
603 void reportFindInPageMatchCount(int request_id,
604 int count,
605 bool final_update) override;
606 void reportFindInPageSelection(int request_id,
607 int active_match_ordinal,
608 const blink::WebRect& sel) override;
avif0d894852016-02-17 17:49:12609 void requestStorageQuota(blink::WebStorageQuotaType type,
avi5c77d212015-09-25 20:08:25610 unsigned long long requested_size,
611 blink::WebStorageQuotaCallbacks callbacks) override;
avi5c77d212015-09-25 20:08:25612 blink::WebPushClient* pushClient() override;
613 blink::WebPresentationClient* presentationClient() override;
614 void willStartUsingPeerConnectionHandler(
avi5c77d212015-09-25 20:08:25615 blink::WebRTCPeerConnectionHandler* handler) override;
616 blink::WebUserMediaClient* userMediaClient() override;
617 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
avif0d894852016-02-17 17:49:12618 blink::WebString userAgentOverride() override;
619 blink::WebString doNotTrackValue() override;
620 bool allowWebGL(bool default_value) override;
avi5c77d212015-09-25 20:08:25621 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
622 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
623 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
624 void postAccessibilityEvent(const blink::WebAXObject& obj,
625 blink::WebAXEvent event) override;
626 void handleAccessibilityFindInPageResult(
627 int identifier,
628 int match_index,
629 const blink::WebAXObject& start_object,
630 int start_offset,
631 const blink::WebAXObject& end_object,
632 int end_offset) override;
avi1008732f2016-02-17 17:28:49633 void didChangeManifest() override;
foolip73101372016-07-13 08:19:22634 void enterFullscreen() override;
635 void exitFullscreen() override;
avi5c77d212015-09-25 20:08:25636 blink::WebAppBannerClient* appBannerClient() override;
637 void registerProtocolHandler(const blink::WebString& scheme,
638 const blink::WebURL& url,
639 const blink::WebString& title) override;
640 void unregisterProtocolHandler(const blink::WebString& scheme,
641 const blink::WebURL& url) override;
642 blink::WebBluetooth* bluetooth() override;
guidou3906a722015-11-12 22:14:42643 void checkIfAudioSinkExistsAndIsAuthorized(
644 const blink::WebString& sink_id,
645 const blink::WebSecurityOrigin& security_origin,
646 blink::WebSetSinkIdCallbacks* web_callbacks) override;
ben88716142016-07-30 00:03:03647 blink::InterfaceProvider* interfaceProvider() override;
lfg717154072016-06-30 15:04:16648 blink::WebPageVisibilityState visibilityState() const override;
[email protected]85d85fd2013-06-19 00:57:41649
lukasza902fcc52015-12-31 04:45:29650 // WebFrameSerializerClient implementation:
lukasza2e296c32015-09-28 23:29:48651 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48652 const blink::WebCString& data,
lukasza902fcc52015-12-31 04:45:29653 blink::WebFrameSerializerClient::FrameSerializationStatus status)
654 override;
lukasza2e296c32015-09-28 23:29:48655
ben76f52b242016-06-18 05:42:48656 // Binds to the FrameHost in the browser.
657 void Bind(mojom::FrameRequest frame, mojom::FrameHostPtr frame_host);
rockotf8fdd9b2015-12-16 22:22:35658
mlamouri4fff1992014-09-30 11:22:46659 ManifestManager* manifest_manager();
660
avi0392dbf52015-03-25 16:55:45661 // TODO(creis): Remove when the only caller, the HistoryController, is no
662 // more.
663 void SetPendingNavigationParams(
dchengcedca5612016-04-09 01:40:15664 std::unique_ptr<NavigationParams> navigation_params);
avi0392dbf52015-03-25 16:55:45665
xhwang5206d4e62016-02-05 02:09:55666 media::MediaPermission* GetMediaPermission();
guoweisf4282b02015-09-24 23:05:22667
creis69b184a472015-11-26 05:29:51668 // Sends the current frame's navigation state to the browser.
669 void SendUpdateState();
670
sammce2f99982016-03-14 22:38:12671 // Creates a MojoBindingsController if Mojo bindings have been enabled for
672 // this frame. For WebUI, this allows the page to communicate with the browser
673 // process; for layout tests, this allows the test to mock out services at
674 // the Mojo IPC layer.
675 void MaybeEnableMojoBindings();
nasko1fa0fb62015-12-09 01:49:57676
lfge0c2792ec2016-05-11 18:52:08677 // Plugin-related functions --------------------------------------------------
678
679#if defined(ENABLE_PLUGINS)
680 PepperPluginInstanceImpl* focused_pepper_plugin() {
681 return focused_pepper_plugin_;
682 }
683 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
684 return pepper_last_mouse_event_target_;
685 }
686 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
687 pepper_last_mouse_event_target_ = plugin;
688 }
689
690 // Indicates that the given instance has been created.
691 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
692
693 // Indicates that the given instance is being destroyed. This is called from
694 // the destructor, so it's important that the instance is not dereferenced
695 // from this call.
696 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
697
698 // Notification that the given plugin is focused or unfocused.
699 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
zqzhangc885f6b2016-06-23 19:44:46700
701 void PepperStartsPlayback(PepperPluginInstanceImpl* instance);
702 void PepperStopsPlayback(PepperPluginInstanceImpl* instance);
703 void OnSetPepperVolume(int32_t pp_instance, double volume);
lfge0c2792ec2016-05-11 18:52:08704#endif // ENABLE_PLUGINS
705
[email protected]2f61bdd2013-07-02 18:38:47706 protected:
jochen664198b2015-06-25 14:13:00707 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47708
[email protected]227692c52013-05-31 22:43:04709 private:
kenrbf98a4d22015-04-01 21:59:35710 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26711 friend class RenderFrameObserver;
dmazzoni8e6fe4d2016-06-27 06:35:37712 friend class RenderAccessibilityImplTest;
clamy98a9dee02015-06-24 16:09:10713 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14714 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
715 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
716 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
717 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
dmazzoni8e6fe4d2016-06-27 06:35:37718 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
[email protected]66bbadaf2014-03-28 16:25:54719 AccessibilityMessagesQueueWhileSwappedOut);
[email protected]2e2d9632013-12-03 00:55:26720
twellington376424ad2015-05-04 18:57:25721 // A wrapper class used as the callback for JavaScript executed
722 // in an isolated world.
723 class JavaScriptIsolatedWorldRequest
724 : public blink::WebScriptExecutionCallback {
725 public:
726 JavaScriptIsolatedWorldRequest(
727 int id,
728 bool notify_result,
729 int routing_id,
730 base::WeakPtr<RenderFrameImpl> render_frame_impl);
731 void completed(
732 const blink::WebVector<v8::Local<v8::Value>>& result) override;
733
734 private:
avi5c77d212015-09-25 20:08:25735 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25736
737 int id_;
738 bool notify_result_;
739 int routing_id_;
740 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
741
742 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
743 };
744
[email protected]37567b432014-02-12 01:12:22745 typedef std::map<GURL, double> HostZoomLevels;
746
dchengc5ef1a52015-08-26 20:58:30747 // Creates a new RenderFrame. |render_view| is the RenderView object that this
748 // frame belongs to.
ddorwinf63505e2016-01-08 00:54:50749 // Callers *must* call |BindToWebFrame| immediately after creation.
avi1023d012015-12-25 02:39:14750 static RenderFrameImpl* Create(RenderViewImpl* render_view,
751 int32_t routing_id);
dchengc5ef1a52015-08-26 20:58:30752
ddorwinf63505e2016-01-08 00:54:50753 // This is called right after creation with the WebLocalFrame for this
754 // RenderFrame. It must be called before Initialize.
755 void BindToWebFrame(blink::WebLocalFrame* web_frame);
756
[email protected]2e2d9632013-12-03 00:55:26757 // Functions to add and remove observers for this object.
758 void AddObserver(RenderFrameObserver* observer);
759 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34760
dcheng3d886b732015-11-05 19:16:01761 bool IsLocalRoot() const;
762
[email protected]f0906a02014-08-07 07:18:55763 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35764 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08765 blink::WebHistoryCommitType commit_type,
766 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22767
[email protected]b70da4c2014-01-06 19:57:09768 // IPC message handlers ------------------------------------------------------
769 //
770 // The documentation for these functions should be in
771 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10772 void OnNavigate(const CommonNavigationParams& common_params,
773 const StartNavigationParams& start_params,
774 const RequestNavigationParams& request_params);
clamybfd6a812016-05-30 16:25:17775 void OnBeforeUnload(bool is_reload);
alexmosbc7eafa2014-12-06 01:38:09776 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56777 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09778 const FrameReplicationState& replicated_frame_state);
naskoeab5c5582015-12-15 05:20:00779 void OnDeleteFrame();
Nasko Oskov85f60222014-08-28 22:53:30780 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42781 void OnShowContextMenu(const gfx::Point& location);
782 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
783 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
784 unsigned action);
[email protected]4ee64622014-03-21 22:34:15785 void OnUndo();
786 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07787 void OnCut();
788 void OnCopy();
789 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15790 void OnPasteAndMatchStyle();
791 void OnDelete();
792 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14793 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38794 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15795 void OnUnselect();
christiankaeed9862014-11-05 10:49:14796 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17797 void OnReplace(const base::string16& text);
798 void OnReplaceMisspelling(const base::string16& text);
brettw8f508f42016-06-20 21:34:21799 void OnCopyImageAt(int x, int y);
800 void OnSaveImageAt(int x, int y);
peter4eb242002015-06-02 12:45:13801 void OnAddMessageToConsole(ConsoleMessageLevel level,
802 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52803 void OnJavaScriptExecuteRequest(const base::string16& javascript,
804 int id,
805 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28806 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
807 int id,
jochen2e7d95b2015-05-04 15:28:50808 bool notify_result,
809 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25810 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
811 int id,
812 bool notify_result,
813 int world_id);
avi1023d012015-12-25 02:39:14814 void OnVisualStateRequest(uint64_t key);
[email protected]4ee64622014-03-21 22:34:15815 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16816 void OnSetCompositionFromExistingText(
817 int start, int end,
818 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24819 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16820 void OnExtendSelectionAndDelete(int before, int after);
yabinh90f1be12016-10-14 03:04:39821 void OnDeleteSurroundingText(int before, int after);
toyoshim24a4c7ab2016-04-05 09:24:14822 void OnReload(bool bypass_cache);
megjablon3f5941072016-02-04 23:27:52823 void OnReloadLoFiImages();
jam973236102016-02-09 00:47:05824 void OnTextSurroundingSelectionRequest(uint32_t max_length);
[email protected]95640212014-07-26 18:14:30825 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51826 void OnSnapshotAccessibilityTree(int callback_id);
alexmos95733002015-08-24 16:38:09827 void OnUpdateOpener(int opener_routing_id);
dcheng5f60abb2015-05-28 01:39:36828 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
lazyboy70605c32015-11-03 01:27:31829 void OnSetFrameOwnerProperties(
raymesbba82b32016-07-19 00:41:38830 const FrameOwnerProperties& frame_owner_properties);
alexmos401f0aba2015-12-06 10:07:39831 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id);
alexmos5357efb2015-12-16 21:44:00832 void OnSetFocusedFrame();
avallee0206f782016-07-28 18:55:33833 void OnClearFocusedFrame();
dspelle736c9db2015-04-03 04:53:16834 void OnTextTrackSettingsChanged(
835 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16836 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
davidbena5496d62014-10-07 18:52:04837 void OnCommitNavigation(const ResourceResponseHead& response,
838 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42839 const CommonNavigationParams& common_params,
lukaszad04640f2016-05-25 17:08:44840 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57841 void OnFailedNavigation(const CommonNavigationParams& common_params,
842 const RequestNavigationParams& request_params,
843 bool has_stale_copy_in_cache,
844 int error_code);
lukasza6af746b72015-09-18 23:37:22845 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48846 void OnGetSerializedHtmlWithLocalLinks(
lukasza777a7dd2016-01-25 23:55:47847 const std::map<GURL, base::FilePath>& url_to_local_path,
848 const std::map<int, base::FilePath>& frame_routing_id_to_local_path);
lukaszaede9cc02015-12-30 23:48:32849 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params);
paulmeyer5d0a5f02016-01-21 20:15:52850 void OnFind(int request_id,
851 const base::string16& search_text,
852 const blink::WebFindOptions& options);
paulmeyerc8cb7cb2016-06-07 01:14:19853 void OnClearActiveFindMatch();
paulmeyer5d0a5f02016-01-21 20:15:52854 void OnStopFinding(StopFindAction action);
clamy91b7abf2016-03-24 15:17:45855 void OnEnableViewSourceMode();
avi6b8dbb32016-04-08 18:59:35856 void OnSuppressFurtherDialogs();
naskoada75b22016-06-11 16:09:46857 void OnFileChooserResponse(
858 const std::vector<content::FileChooserFileInfo>& files);
paulmeyer5d0a5f02016-01-21 20:15:52859#if defined(OS_ANDROID)
860 void OnActivateNearestFindResult(int request_id, float x, float y);
paulmeyerc8cb7cb2016-06-07 01:14:19861 void OnGetNearestFindResult(int request_id, float x, float y);
paulmeyer5d0a5f02016-01-21 20:15:52862 void OnFindMatchRects(int current_version);
haibinluc643d33c2016-06-03 02:22:34863#endif
864
865#if defined(USE_EXTERNAL_POPUP_MENU)
866#if defined(OS_MACOSX)
867 void OnSelectPopupMenuItem(int selected_index);
868#else
paulmeyer5d0a5f02016-01-21 20:15:52869 void OnSelectPopupMenuItems(bool canceled,
870 const std::vector<int>& selected_indices);
haibinluc643d33c2016-06-03 02:22:34871#endif
872#endif
873
874#if defined(OS_MACOSX)
paulmeyer5d0a5f02016-01-21 20:15:52875 void OnCopyToFindPboard();
876#endif
clamy9bfeef42014-09-30 20:50:42877
carlosk27fa0652016-10-05 23:10:36878 // Callback scheduled from OnSerializeAsMHTML for when writing serialized
879 // MHTML to file has been completed in the file thread.
880 void OnWriteMHTMLToDiskComplete(
881 int job_id,
882 std::set<std::string> serialized_resources_uri_digests,
883 base::TimeDelta main_thread_use_time,
884 bool success);
885
creise18ce072015-12-02 02:00:02886 // Requests that the browser process navigates to |url|. If
887 // |is_history_navigation_in_new_child| is true, the browser process should
888 // look for a matching FrameNavigationEntry in the last committed entry to use
889 // instead of |url|.
lukaszabb2101b82016-06-17 16:52:25890 void OpenURL(
891 const GURL& url,
892 bool uses_post,
893 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
lukaszaf097ee52016-10-11 23:17:52894 const std::string& extra_headers,
lukaszabb2101b82016-06-17 16:52:25895 const Referrer& referrer,
896 blink::WebNavigationPolicy policy,
897 bool should_replace_current_entry,
898 bool is_history_navigation_in_new_child);
[email protected]a09d53ce2014-01-31 00:46:42899
clamyd6983032015-04-29 14:48:12900 // Performs a navigation in the frame. This provides a unified function for
901 // the current code path and the browser-side navigation path (in
902 // development). Currently used by OnNavigate, with all *NavigationParams
903 // provided by the browser. |stream_params| should be null.
904 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
905 // |request_params| received by the browser. |stream_params| should be non
906 // null and created from the information provided by the browser.
907 // |start_params| is not used.
dchengcedca5612016-04-09 01:40:15908 void NavigateInternal(
909 const CommonNavigationParams& common_params,
910 const StartNavigationParams& start_params,
911 const RequestNavigationParams& request_params,
lukaszad04640f2016-05-25 17:08:44912 std::unique_ptr<StreamOverrideParameters> stream_params);
clamyd6983032015-04-29 14:48:12913
[email protected]ef3adfc2014-05-11 00:04:54914 // Update current main frame's encoding and send it to browser window.
915 // Since we want to let users see the right encoding info from menu
916 // before finishing loading, we call the UpdateEncoding in
917 // a) function:DidCommitLoadForFrame. When this function is called,
918 // that means we have got first data. In here we try to get encoding
919 // of page if it has been specified in http header.
920 // b) function:DidReceiveTitle. When this function is called,
921 // that means we have got specified title. Because in most of webpages,
922 // title tags will follow meta tags. In here we try to get encoding of
923 // page if it has been specified in meta tag.
924 // c) function:DidFinishDocumentLoadForFrame. When this function is
925 // called, that means we have got whole html page. In here we should
926 // finally get right encoding of page.
927 void UpdateEncoding(blink::WebFrame* frame,
928 const std::string& encoding_name);
929
[email protected]4ee64622014-03-21 22:34:15930 // Dispatches the current state of selection on the webpage to the browser if
931 // it has changed.
932 // TODO(varunjain): delete this method once we figure out how to keep
933 // selection handles in sync with the webpage.
934 void SyncSelectionIfRequired();
935
[email protected]87de04b02014-04-08 22:14:49936 bool RunJavaScriptMessage(JavaScriptMessageType type,
937 const base::string16& message,
938 const base::string16& default_value,
939 const GURL& frame_url,
940 base::string16* result);
941
naskoada75b22016-06-11 16:09:46942 // Adds the given file chooser request to the file_chooser_completion_ queue
943 // (see that var for more) and requests the chooser be displayed if there are
944 // no other waiting items in the queue.
945 //
946 // Returns true if the chooser was successfully scheduled. False means we
947 // didn't schedule anything.
948 bool ScheduleFileChooser(const FileChooserParams& params,
949 blink::WebFileChooserCompletion* completion);
950
[email protected]457736d2014-04-30 15:54:27951 // Loads the appropriate error page for the specified failure into the frame.
yzshen0424e6952016-09-06 16:48:58952 // |entry| is only used by PlzNavigate when navigating to a history item.
[email protected]457736d2014-04-30 15:54:27953 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
954 const blink::WebURLError& error,
yzshen0424e6952016-09-06 16:48:58955 bool replace,
956 HistoryEntry* entry);
[email protected]457736d2014-04-30 15:54:27957
zeeshanq3454e9c2014-09-04 21:30:28958 void HandleJavascriptExecutionResult(const base::string16& javascript,
959 int id,
960 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41961 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28962
[email protected]977db4a42014-07-17 08:04:32963 // Initializes |web_user_media_client_|. If this fails, because it wasn't
964 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
965 // |web_user_media_client_| will remain NULL.
966 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19967
968 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:15969 blink::WebMediaPlayerClient* client,
970 const blink::WebString& sink_id,
971 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:19972
[email protected]ae2477e2014-05-27 23:47:08973 // Creates a factory object used for creating audio and video renderers.
dchengcedca5612016-04-09 01:40:15974 std::unique_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08975
avi5cad4912015-06-19 05:25:44976 // Does preparation for the navigation to |url|.
977 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25978 const GURL& url,
toyoshimf3f7f682016-04-08 07:47:48979 const RequestNavigationParams& request_params);
clamyda97e8322014-10-07 21:57:25980
clamyece38882014-11-19 15:00:20981 // PlzNavigate
arthursonzogni69824eb2016-07-13 16:22:03982 // Sends a FrameHostMsg_BeginNavigation to the browser
983 void BeginNavigation(const NavigationPolicyInfo& info);
clamyece38882014-11-19 15:00:20984
clamy4cc9b8202015-03-02 13:51:36985 // Loads a data url.
986 void LoadDataURL(const CommonNavigationParams& params,
mnaganovbf087422015-12-16 05:10:03987 const RequestNavigationParams& request_params,
clamy0f4ccc82016-02-24 12:43:53988 blink::WebLocalFrame* frame,
989 blink::WebFrameLoadType load_type,
990 blink::WebHistoryItem item_for_history_navigation,
991 blink::WebHistoryLoadType history_load_type,
992 bool is_client_redirect);
clamy4cc9b8202015-03-02 13:51:36993
clamy62b271d2015-04-16 11:54:57994 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
995 // the failed request |request|.
996 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
997 const blink::WebURLError& error,
998 blink::WebLocalFrame* frame);
999
1000 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
1001 const GURL& unreachable_url);
1002
[email protected]f3a95312014-06-12 16:46:581003 // Returns the URL being loaded by the |frame_|'s request.
1004 GURL GetLoadingUrl() const;
1005
avi0392dbf52015-03-25 16:55:451006 // If we initiated a navigation, this function will populate |document_state|
1007 // with the navigation information saved in OnNavigate().
1008 void PopulateDocumentStateFromPending(DocumentState* document_state);
1009
1010 // Returns a new NavigationState populated with the navigation information
1011 // saved in OnNavigate().
1012 NavigationState* CreateNavigationStateFromPending();
1013
csharrison1ce0e852015-11-07 16:45:131014 // Sets the NavigationState on the DocumentState based on
1015 // the value of |pending_navigation_params_|.
boliuac512fd2016-03-16 23:33:351016 void UpdateNavigationState(DocumentState* document_state,
avi68a109ab2016-05-15 01:46:321017 bool was_within_same_page,
1018 bool content_initiated);
csharrison1ce0e852015-11-07 16:45:131019
[email protected]96307312014-05-04 01:00:191020#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:001021 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:271022 blink::WebMediaPlayerClient* client,
srirama.m26f864d02015-07-14 05:21:461023 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
dalecurtis49f363882015-08-25 21:05:381024 const media::WebMediaPlayerParams& params);
[email protected]a017938b2014-05-27 21:17:171025
[email protected]65f3d1aa2014-05-29 01:57:001026 RendererMediaPlayerManager* GetMediaPlayerManager();
davve859f4f92015-11-27 10:16:191027
1028 RendererMediaSessionManager* GetMediaSessionManager();
[email protected]4b556cf2014-06-10 23:21:531029#endif
1030
sandersd02d9aea2015-05-12 02:29:261031 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:421032
xhwange70b7ee12015-06-25 09:17:171033#if defined(ENABLE_MOJO_MEDIA)
rockotb00e6462016-04-14 02:24:031034 shell::mojom::InterfaceProvider* GetMediaInterfaceProvider();
xhwang33f939e2015-06-23 04:33:421035#endif
1036
xjzd3fe45a2016-10-12 18:26:371037#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
miu1ddf18c62016-09-24 01:39:411038 media::mojom::RemoterFactory* GetRemoterFactory();
xjzd3fe45a2016-10-12 18:26:371039#endif
1040
xhwangd7180832015-04-03 05:38:151041 media::CdmFactory* GetCdmFactory();
xhwang409e53552016-02-23 00:52:441042 media::DecoderFactory* GetDecoderFactory();
[email protected]96307312014-05-04 01:00:191043
ben155ecf82016-06-21 22:43:261044 void RegisterMojoInterfaces();
halton.huoca2eabd2015-07-06 08:17:401045
xhwang6bca21e2016-02-06 00:21:451046 // Connect to an interface provided by the service registry.
1047 template <typename Interface>
bene3bc9022016-02-10 17:38:241048 void GetInterface(mojo::InterfaceRequest<Interface> request);
xhwang6bca21e2016-02-06 00:21:451049
dalecurtisa12e6062015-11-10 23:13:141050 // Returns the media delegate for WebMediaPlayer usage. If
1051 // |media_player_delegate_| is NULL, one is created.
1052 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
1053
paulmeyer5d0a5f02016-01-21 20:15:521054 // Called to get the WebPlugin to handle find requests in the document.
1055 // Returns nullptr if there is no such WebPlugin.
1056 blink::WebPlugin* GetWebPluginForFind();
1057
1058 // Sends a reply to the current find operation handling if it was a
1059 // synchronous find request.
1060 void SendFindReply(int request_id,
1061 int match_count,
1062 int ordinal,
1063 const blink::WebRect& selection_rect,
1064 bool final_status_update);
1065
skyostilb4cce1b2016-03-31 17:56:341066 void InitializeBlameContext(RenderFrameImpl* parent_frame);
1067
xjzd3fe45a2016-10-12 18:26:371068#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
1069 // Creates the RemotingController to control whether to switch to/from media
1070 // remoting from/to local playback.
1071 std::unique_ptr<media::RemotingController> CreateRemotingController();
1072#endif
1073
creiscfaa4462015-03-16 19:27:181074 // Stores the WebLocalFrame we are associated with. This is null from the
ddorwinf63505e2016-01-08 00:54:501075 // constructor until BindToWebFrame is called, and it is null after
creiscfaa4462015-03-16 19:27:181076 // frameDetached is called until destruction (which is asynchronous in the
1077 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:221078 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:091079
dglazkov2e140f52015-09-28 16:10:071080 // Boolean value indicating whether this RenderFrameImpl object is for the
1081 // main frame or not. It remains accurate during destruction, even when
1082 // |frame_| has been invalidated.
1083 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:191084
naskoeab5c5582015-12-15 05:20:001085 // When a frame is detached in response to a message from the browser process,
1086 // this RenderFrame should not be sending notifications back to it. This
1087 // boolean is used to indicate this case.
1088 bool in_browser_initiated_detach_;
1089
1090 // Indicates whether the frame has been inserted into the frame tree yet or
1091 // not.
1092 //
1093 // When a frame is created by the browser process, it is for a pending
1094 // navigation. In this case, it is not immediately attached to the frame tree
1095 // if there is a RenderFrameProxy for the same frame. It is inserted into the
1096 // frame tree at the time the pending navigation commits.
1097 // Frames added by the parent document are created from the renderer process
1098 // and are immediately inserted in the frame tree.
1099 // TODO(dcheng): Remove this once we have FrameTreeHandle and can use the
1100 // Blink Web* layer to check for provisional frames.
1101 bool in_frame_tree_;
1102
[email protected]abc501e2014-01-27 19:27:261103 base::WeakPtr<RenderViewImpl> render_view_;
[email protected]227692c52013-05-31 22:43:041104 int routing_id_;
nasko8b9d9bd2015-05-06 19:23:191105
japhete6adf142014-10-31 00:01:491106 // If this frame was created to replace a proxy, this will store the routing
1107 // id of the proxy to replace at commit-time, at which time it will be
1108 // cleared.
1109 // TODO(creis): Remove this after switching to PlzNavigate.
1110 int proxy_routing_id_;
1111
dcheng3d886b732015-11-05 19:16:011112 // Non-null when the RenderFrame is a local root for compositing, input,
1113 // layout, etc. A local frame is also a local root iff it does not have a
1114 // parent that is a local frame.
kenrba7199832015-01-22 23:44:591115 scoped_refptr<RenderWidget> render_widget_;
1116
avi0392dbf52015-03-25 16:55:451117 // Temporarily holds state pertaining to a navigation that has been initiated
1118 // until the NavigationState corresponding to the new navigation is created in
1119 // didCreateDataSource().
dchengcedca5612016-04-09 01:40:151120 std::unique_ptr<NavigationParams> pending_navigation_params_;
avi0392dbf52015-03-25 16:55:451121
creisc8ca51e2016-09-29 23:10:281122 // Keeps track of which future subframes the browser process has history items
1123 // for during a history navigation. The renderer process should ask the
1124 // browser for history items when subframes with these names are created, and
1125 // directly load the initial URLs for any other subframes. This state is
1126 // incrementally cleared as it is used and then reset in didStopLoading, since
1127 // it is not needed after the first load completes and is never used after the
1128 // initial navigation.
1129 // TODO(creis): Expand this to include any corresponding same-process
1130 // PageStates for the whole subtree in https://crbug.com/639842.
1131 std::set<std::string> history_subframe_unique_names_;
creis45b3bba2016-09-22 22:47:131132
creis8eb8ef22015-11-04 22:51:381133 // Stores the current history item for this frame, so that updates to it can
1134 // be reported to the browser process via SendUpdateState.
1135 blink::WebHistoryItem current_history_item_;
1136
[email protected]7a4e2532013-12-02 21:30:021137#if defined(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:021138 // Current text input composition text. Empty if no composition is in
1139 // progress.
[email protected]fcf75d42013-12-03 20:11:261140 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:091141
tommycli59bd86c2014-12-10 02:09:381142 PluginPowerSaverHelper* plugin_power_saver_helper_;
paulmeyer5d0a5f02016-01-21 20:15:521143
1144 PepperPluginInstanceImpl* plugin_find_handler_;
[email protected]7a4e2532013-12-02 21:30:021145#endif
1146
[email protected]f3add922013-12-20 23:17:161147 RendererWebCookieJarImpl cookie_jar_;
1148
[email protected]2e2d9632013-12-03 00:55:261149 // All the registered observers.
brettw236d3172015-06-03 16:31:431150 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:261151
[email protected]bffc8302014-01-23 20:52:161152 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
1153
[email protected]a09d53ce2014-01-31 00:46:421154 // External context menu requests we're waiting for. "Internal"
1155 // (WebKit-originated) context menu events will have an ID of 0 and will not
1156 // be in this map.
1157 //
1158 // We don't want to add internal ones since some of the "special" page
1159 // handlers in the browser process just ignore the context menu requests so
1160 // avoid showing context menus, and so this will cause right clicks to leak
1161 // entries in this map. Most users of the custom context menu (e.g. Pepper
1162 // plugins) are normally only on "regular" pages and the regular pages will
1163 // always respond properly to the request, so we don't have to worry so
1164 // much about leaks.
1165 IDMap<ContextMenuClient, IDMapExternalPointer> pending_context_menus_;
1166
[email protected]4ee64622014-03-21 22:34:151167 // The text selection the last time DidChangeSelection got called. May contain
1168 // additional characters before and after the selected text, for IMEs. The
1169 // portion of this string that is the actual selected text starts at index
1170 // |selection_range_.GetMin() - selection_text_offset_| and has length
1171 // |selection_range_.length()|.
1172 base::string16 selection_text_;
1173 // The offset corresponding to the start of |selection_text_| in the document.
1174 size_t selection_text_offset_;
1175 // Range over the document corresponding to the actual selected text (which
1176 // could correspond to a substring of |selection_text_|; see above).
1177 gfx::Range selection_range_;
1178 // Used to inform didChangeSelection() when it is called in the context
1179 // of handling a InputMsg_SelectRange IPC.
1180 bool handling_select_range_;
1181
[email protected]2626d142014-04-22 17:24:021182 // The next group of objects all implement RenderFrameObserver, so are deleted
1183 // along with the RenderFrame automatically. This is why we just store weak
1184 // references.
1185
[email protected]977db4a42014-07-17 08:04:321186 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:331187 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191188
jrummell109c3a602014-12-18 01:08:501189 // EncryptedMediaClient attached to this frame; lazily initialized.
dchengcedca5612016-04-09 01:40:151190 std::unique_ptr<media::WebEncryptedMediaClientImpl>
1191 web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501192
xhwang6bca21e2016-02-06 00:21:451193 // The media permission dispatcher attached to this frame.
dchengcedca5612016-04-09 01:40:151194 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011195
xhwange70b7ee12015-06-25 09:17:171196#if defined(ENABLE_MOJO_MEDIA)
xhwanga5967e552016-02-26 00:54:081197 // The media interface provider attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151198 std::unique_ptr<MediaInterfaceProvider> media_interface_provider_;
xhwang065b54b2015-06-03 22:25:551199#endif
1200
[email protected]a017938b2014-05-27 21:17:171201#if defined(OS_ANDROID)
davve859f4f92015-11-27 10:16:191202 // Manages all media players and sessions in this render frame for
1203 // communicating with the real media player and sessions in the
1204 // browser process. It's okay to use raw pointers since they're both
1205 // RenderFrameObservers.
[email protected]a017938b2014-05-27 21:17:171206 RendererMediaPlayerManager* media_player_manager_;
davve859f4f92015-11-27 10:16:191207 RendererMediaSessionManager* media_session_manager_;
[email protected]4b556cf2014-06-10 23:21:531208#endif
1209
watkdee516f2016-02-18 02:22:191210 media::SurfaceManager* media_surface_manager_;
1211
xjzd3fe45a2016-10-12 18:26:371212#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
miu1ddf18c62016-09-24 01:39:411213 // Lazy-bound pointer to the RemoterFactory service in the browser
1214 // process. Always use the GetRemoterFactory() accessor instead of this.
1215 media::mojom::RemoterFactoryPtr remoter_factory_;
xjzd3fe45a2016-10-12 18:26:371216#endif
miu1ddf18c62016-09-24 01:39:411217
xhwang409e53552016-02-23 00:52:441218 // The CDM and decoder factory attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151219 std::unique_ptr<media::CdmFactory> cdm_factory_;
1220 std::unique_ptr<media::DecoderFactory> decoder_factory_;
xhwangd7180832015-04-03 05:38:151221
hubbe5f0ad43b2015-12-14 20:57:261222 // Media resource cache, lazily initialized.
1223 linked_ptr<media::UrlIndex> url_index_;
1224
dgozman358ba322015-03-26 15:05:301225 // The devtools agent for this frame; only created for main frame and
1226 // local roots.
1227 DevToolsAgent* devtools_agent_;
1228
[email protected]45920862014-07-02 12:53:021229 // The push messaging dispatcher attached to this frame, lazily initialized.
1230 PushMessagingDispatcher* push_messaging_dispatcher_;
1231
avayvodbca35fad2015-01-29 20:20:571232 // The presentation dispatcher implementation attached to this frame, lazily
1233 // initialized.
1234 PresentationDispatcher* presentation_dispatcher_;
1235
ben155ecf82016-06-21 22:43:261236 std::unique_ptr<shell::InterfaceRegistry> interface_registry_;
1237 std::unique_ptr<shell::InterfaceProvider> remote_interfaces_;
ben88716142016-07-30 00:03:031238 std::unique_ptr<BlinkInterfaceProviderImpl> blink_interface_provider_;
ben155ecf82016-06-21 22:43:261239 shell::mojom::InterfaceProviderRequest
1240 pending_remote_interface_provider_request_;
[email protected]c52a1412014-06-25 06:09:251241
bend32292b2016-10-07 00:21:581242 // The shell proxy used to connect to services.
rockotb00e6462016-04-14 02:24:031243 shell::mojom::ConnectorPtr connector_;
rockotd9260982015-08-21 22:26:301244
[email protected]45920862014-07-02 12:53:021245 // The screen orientation dispatcher attached to the frame, lazily
1246 // initialized.
[email protected]cf78eda2014-06-13 16:57:411247 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1248
mlamouriefdca9d2014-09-16 16:55:401249 // The Manifest Manager handles the manifest requests from the browser
1250 // process.
1251 ManifestManager* manifest_manager_;
1252
[email protected]95640212014-07-26 18:14:301253 // The current accessibility mode.
1254 AccessibilityMode accessibility_mode_;
1255
1256 // Only valid if |accessibility_mode_| is anything other than
1257 // AccessibilityModeOff.
dmazzoni8e6fe4d2016-06-27 06:35:371258 RenderAccessibilityImpl* render_accessibility_;
[email protected]95640212014-07-26 18:14:301259
dchengcedca5612016-04-09 01:40:151260 std::unique_ptr<blink::WebAppBannerClient> app_banner_client_;
benwells04ab5b962015-05-06 08:29:401261
dchengcedca5612016-04-09 01:40:151262 std::unique_ptr<blink::WebBluetooth> bluetooth_;
jyasskinf89a11b2015-07-21 00:27:481263
dalecurtisa12e6062015-11-10 23:13:141264 // Manages play, pause notifications for WebMediaPlayer implementations; its
1265 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1266 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1267
megjablond5ac7d52015-10-22 23:56:121268 // Whether or not this RenderFrame is using Lo-Fi mode.
1269 bool is_using_lofi_;
1270
tbansal7b6cf8b2016-05-10 19:27:231271 // Effective connection type when the document of this frame was fetched.
1272 blink::WebEffectiveConnectionType effective_connection_type_;
1273
ellyjonesdb20fae12015-12-04 16:47:551274 // Whether or not this RenderFrame is currently pasting.
1275 bool is_pasting_;
1276
avi6b8dbb32016-04-08 18:59:351277 // Whether we must stop creating nested message loops for modal dialogs. This
1278 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the
1279 // stack that interferes with swapping out.
1280 bool suppress_further_dialogs_;
1281
naskoada75b22016-06-11 16:09:461282 // The current and pending file chooser completion objects. If the queue is
1283 // nonempty, the first item represents the currently running file chooser
1284 // callback, and the remaining elements are the other file chooser completion
1285 // still waiting to be run (in order).
1286 struct PendingFileChooser;
1287 std::deque<std::unique_ptr<PendingFileChooser>> file_chooser_completions_;
1288
haibinluc643d33c2016-06-03 02:22:341289#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:141290 // The external popup for the currently showing select popup.
dchengcedca5612016-04-09 01:40:151291 std::unique_ptr<ExternalPopupMenu> external_popup_menu_;
avi485e5fd62014-08-25 23:26:141292#endif
1293
xiaochengh01c3b102016-06-13 23:56:081294 std::unique_ptr<FrameBlameContext> blame_context_;
skyostilb4cce1b2016-03-31 17:56:341295
lfge0c2792ec2016-05-11 18:52:081296 // Plugins -------------------------------------------------------------------
1297#if defined(ENABLE_PLUGINS)
1298 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1299 PepperPluginSet active_pepper_instances_;
1300
1301 // Whether or not the focus is on a PPAPI plugin
1302 PepperPluginInstanceImpl* focused_pepper_plugin_;
1303
1304 // The plugin instance that received the last mouse event. It is set to NULL
1305 // if the last mouse event went to elements other than Pepper plugins.
1306 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1307 // the RenderFrameImpl to NULL it out when it destructs.
1308 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
1309#endif
1310
ben76f52b242016-06-18 05:42:481311 mojo::Binding<mojom::Frame> frame_binding_;
1312 mojom::FrameHostPtr frame_host_;
1313
ahesteacad602016-08-30 21:25:541314 // Indicates whether |didAccessInitialDocument| was called.
1315 bool has_accessed_initial_document_;
1316
rockotf62002a2016-09-15 00:08:591317 AssociatedInterfaceRegistryImpl associated_interfaces_;
1318 std::unique_ptr<AssociatedInterfaceProviderImpl>
1319 remote_associated_interfaces_;
1320
dcheng77df1082016-10-06 02:54:171321 // TODO(dcheng): Remove these members.
1322 bool committed_first_load_ = false;
1323 bool name_changed_before_first_commit_ = false;
1324
[email protected]96307312014-05-04 01:00:191325 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1326
[email protected]227692c52013-05-31 22:43:041327 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1328};
1329
1330} // namespace content
1331
[email protected]85d85fd2013-06-19 00:57:411332#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_