blob: 2132cb23060fef2c33c36566932275c1b7763222 [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
thestige62f7382016-11-08 18:31:3911#include <deque>
Charles Reis37c95492016-10-21 20:38:5812#include <map>
dchengcedca5612016-04-09 01:40:1513#include <memory>
thestige62f7382016-11-08 18:31:3914#include <set>
guidou3906a722015-11-12 22:14:4215#include <string>
[email protected]7a4e2532013-12-02 21:30:0216#include <vector>
17
[email protected]7a4e2532013-12-02 21:30:0218#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4219#include "base/gtest_prod_util.h"
20#include "base/id_map.h"
avi1023d012015-12-25 02:39:1421#include "base/macros.h"
hubbe5f0ad43b2015-12-14 20:57:2622#include "base/memory/linked_ptr.h"
lukaszabb2101b82016-06-17 16:52:2523#include "base/memory/ref_counted.h"
[email protected]abc501e2014-01-27 19:27:2624#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2625#include "base/observer_list.h"
[email protected]7a4e2532013-12-02 21:30:0226#include "base/process/process_handle.h"
avi1023d012015-12-25 02:39:1427#include "build/build_config.h"
[email protected]95640212014-07-26 18:14:3028#include "content/common/accessibility_mode_enums.h"
rockotf62002a2016-09-15 00:08:5929#include "content/common/associated_interface_registry_impl.h"
carlosk29da4fe2016-11-29 00:01:2930#include "content/common/download/mhtml_save_status.h"
ben76f52b242016-06-18 05:42:4831#include "content/common/frame.mojom.h"
clamyda97e8322014-10-07 21:57:2532#include "content/common/frame_message_enums.h"
scottmg276753cf2016-10-27 18:25:2233#include "content/common/host_zoom.mojom.h"
rockot53be7caf2016-10-04 20:17:0834#include "content/common/renderer.mojom.h"
peter4eb242002015-06-02 12:45:1335#include "content/public/common/console_message_level.h"
[email protected]87de04b02014-04-08 22:14:4936#include "content/public/common/javascript_message_type.h"
[email protected]65920f332014-03-04 21:14:1837#include "content/public/common/referrer.h"
paulmeyer5d0a5f02016-01-21 20:15:5238#include "content/public/common/stop_find_action.h"
[email protected]227692c52013-05-31 22:43:0439#include "content/public/renderer/render_frame.h"
skyostilb4cce1b2016-03-31 17:56:3440#include "content/renderer/frame_blame_context.h"
ben88716142016-07-30 00:03:0341#include "content/renderer/mojo/blink_interface_provider_impl.h"
[email protected]f3add922013-12-20 23:17:1642#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0443#include "ipc/ipc_message.h"
lukasza70b79c82015-12-14 20:24:1344#include "ipc/ipc_platform_file.h"
acolwell9e0840d2014-09-06 19:01:3245#include "media/blink/webmediaplayer_delegate.h"
dalecurtis49f363882015-08-25 21:05:3846#include "media/blink/webmediaplayer_params.h"
miu1ddf18c62016-09-24 01:39:4147#include "media/mojo/interfaces/remoting.mojom.h"
scottmg276753cf2016-10-27 18:25:2248#include "mojo/public/cpp/bindings/associated_binding.h"
ben155ecf82016-06-21 22:43:2649#include "mojo/public/cpp/bindings/binding.h"
brettw4b461082016-11-19 18:55:1650#include "ppapi/features/features.h"
rockot734fb662016-10-15 16:41:3051#include "services/service_manager/public/interfaces/connector.mojom.h"
52#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
tbansal7b6cf8b2016-05-10 19:27:2353#include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
raymesd405a052016-12-05 23:41:3454#include "third_party/WebKit/public/platform/WebFeaturePolicy.h"
alexmos401f0aba2015-12-06 10:07:3955#include "third_party/WebKit/public/platform/WebFocusType.h"
csharrisonae811ab2016-04-11 11:32:2556#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
sandersdf92f4e5c2016-01-22 20:57:2257#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
lfg717154072016-06-30 15:04:1658#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
dominickn6c1f1cf2016-12-20 06:13:3359#include "third_party/WebKit/public/platform/site_engagement.mojom.h"
[email protected]95640212014-07-26 18:14:3060#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4161#include "third_party/WebKit/public/web/WebDataSource.h"
62#include "third_party/WebKit/public/web/WebFrameClient.h"
boliu15890e42015-11-24 23:08:0563#include "third_party/WebKit/public/web/WebFrameLoadType.h"
lukasza902fcc52015-12-31 04:45:2964#include "third_party/WebKit/public/web/WebFrameSerializerClient.h"
[email protected]680575542014-04-03 17:12:5265#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4666#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
twellington376424ad2015-05-04 18:57:2567#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1568#include "ui/gfx/range/range.h"
lukaszaede9cc02015-12-30 23:48:3269#include "url/gurl.h"
dominickn6c1f1cf2016-12-20 06:13:3370#include "url/origin.h"
[email protected]227692c52013-05-31 22:43:0471
brettw4b461082016-11-19 18:55:1672#if BUILDFLAG(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3873#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4174#endif
75
[email protected]a017938b2014-05-27 21:17:1776#if defined(OS_ANDROID)
77#include "content/renderer/media/android/renderer_media_player_manager.h"
78#endif
79
alexmose7da5a12015-04-09 02:22:1680struct FrameMsg_PostMessage_Params;
lukaszaede9cc02015-12-30 23:48:3281struct FrameMsg_SerializeAsMHTML_Params;
dspelle736c9db2015-04-03 04:53:1682struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0283
84namespace blink {
sammc7f964632016-10-14 04:16:2185class InterfaceRegistry;
[email protected]82ce5b92014-03-22 05:15:2686class WebContentDecryptionModule;
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;
[email protected]7a4e2532013-12-02 21:30:02100}
101
jrummell109c3a602014-12-18 01:08:50102namespace media {
xhwangd7180832015-04-03 05:38:15103class CdmFactory;
xhwang409e53552016-02-23 00:52:44104class DecoderFactory;
xhwang60b430a2015-02-01 05:20:46105class MediaPermission;
xjzdf8ea422016-11-08 22:00:52106class RemotingRendererController;
107class RemotingSinkObserver;
dalecurtisa12e6062015-11-10 23:13:14108class RendererWebMediaPlayerDelegate;
watkdee516f2016-02-18 02:22:19109class SurfaceManager;
hubbe5f0ad43b2015-12-14 20:57:26110class UrlIndex;
jrummell109c3a602014-12-18 01:08:50111class WebEncryptedMediaClientImpl;
thestige62f7382016-11-08 18:31:39112} // namespace media
jrummell109c3a602014-12-18 01:08:50113
rockot400ea35b2016-10-15 19:15:32114namespace service_manager {
ben155ecf82016-06-21 22:43:26115class InterfaceRegistry;
116class InterfaceProvider;
xhwang33f939e2015-06-23 04:33:42117}
118
tommycli58e3172c2015-09-15 18:18:26119namespace url {
120class Origin;
121}
122
[email protected]227692c52013-05-31 22:43:04123namespace content {
124
rockotf62002a2016-09-15 00:08:59125class AssociatedInterfaceProviderImpl;
sammc7f964632016-10-14 04:16:21126class BlinkInterfaceRegistryImpl;
[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;
avi0392dbf52015-03-25 16:55:45138class NavigationState;
[email protected]7a4e2532013-12-02 21:30:02139class PepperPluginInstanceImpl;
avayvodbca35fad2015-01-29 20:20:57140class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:02141class PushMessagingDispatcher;
dmazzoni8e6fe4d2016-06-27 06:35:37142class RenderAccessibilityImpl;
[email protected]4b556cf2014-06-10 23:21:53143class RendererMediaPlayerManager;
davve859f4f92015-11-27 10:16:19144class RendererMediaSessionManager;
[email protected]7a4e2532013-12-02 21:30:02145class RendererPpapiHost;
[email protected]2e2d9632013-12-03 00:55:26146class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04147class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02148class RenderWidget;
149class RenderWidgetFullscreenPepper;
lukaszade802372016-06-16 17:17:23150class ResourceRequestBodyImpl;
[email protected]cf78eda2014-06-13 16:57:41151class ScreenOrientationDispatcher;
nhirokibf6789872016-12-27 05:36:24152class SharedWorkerRepository;
perkj1a2d0432014-09-03 13:52:33153class UserMediaClientImpl;
clamy9bfeef42014-09-30 20:50:42154struct CommonNavigationParams;
[email protected]a09d53ce2014-01-31 00:46:42155struct CustomContextMenuContext;
naskoada75b22016-06-11 16:09:46156struct FileChooserFileInfo;
157struct FileChooserParams;
raymesbba82b32016-07-19 00:41:38158struct FrameOwnerProperties;
alexmosbc7eafa2014-12-06 01:38:09159struct FrameReplicationState;
avi0392dbf52015-03-25 16:55:45160struct NavigationParams;
clamy79b3da62014-10-14 08:50:37161struct RequestNavigationParams;
davidbena5496d62014-10-07 18:52:04162struct ResourceResponseHead;
ccameron2f451532016-09-07 21:49:27163struct ScreenInfo;
clamy34e12782015-03-12 11:26:13164struct StartNavigationParams;
clamyd6983032015-04-29 14:48:12165struct StreamOverrideParameters;
[email protected]227692c52013-05-31 22:43:04166
rockot53be7caf2016-10-04 20:17:08167namespace {
168class CreateFrameWidgetParams;
169}
170
[email protected]85d85fd2013-06-19 00:57:41171class CONTENT_EXPORT RenderFrameImpl
172 : public RenderFrame,
dominickn6c1f1cf2016-12-20 06:13:33173 NON_EXPORTED_BASE(blink::mojom::EngagementClient),
ben76f52b242016-06-18 05:42:48174 NON_EXPORTED_BASE(mojom::Frame),
scottmg276753cf2016-10-27 18:25:22175 NON_EXPORTED_BASE(mojom::HostZoom),
[email protected]96307312014-05-04 01:00:19176 NON_EXPORTED_BASE(public blink::WebFrameClient),
lukasza902fcc52015-12-31 04:45:29177 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) {
[email protected]227692c52013-05-31 22:43:04178 public:
dchengc5ef1a52015-08-26 20:58:30179 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55180 static RenderFrameImpl* CreateMainFrame(
181 RenderViewImpl* render_view,
182 int32_t routing_id,
183 int32_t widget_routing_id,
184 bool hidden,
ccameron2f451532016-09-07 21:49:27185 const ScreenInfo& screen_info,
dcheng9e24bd352016-03-01 19:15:51186 CompositorDependencies* compositor_deps,
187 blink::WebFrame* opener);
[email protected]2f61bdd2013-07-02 18:38:47188
alexmosa181efc2015-09-03 00:39:04189 // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is
190 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
191 // the frame tree after the frame identified by
192 // |previous_sibling_routing_id|, or as the first child if
alexmos9f8705a2015-05-06 19:58:59193 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
194 // semi-orphaned until it commits, at which point it replaces the proxy
alexmosa181efc2015-09-03 00:39:04195 // identified by |proxy_routing_id|. The frame's opener is set to the frame
196 // identified by |opener_routing_id|. The frame is created as a child of the
197 // RenderFrame identified by |parent_routing_id| or as the top-level frame if
198 // the latter is MSG_ROUTING_NONE. Note: This is called only when
alexmos9f8705a2015-05-06 19:58:59199 // RenderFrame is being created in response to IPC message from the browser
200 // process. All other frame creation is driven through Blink and Create.
raymes31457802016-07-20 06:08:09201 static void CreateFrame(int routing_id,
202 int proxy_routing_id,
203 int opener_routing_id,
204 int parent_routing_id,
205 int previous_sibling_routing_id,
206 const FrameReplicationState& replicated_state,
207 CompositorDependencies* compositor_deps,
rockot53be7caf2016-10-04 20:17:08208 const mojom::CreateFrameWidgetParams& params,
raymes31457802016-07-20 06:08:09209 const FrameOwnerProperties& frame_owner_properties);
[email protected]82307f6b2014-08-07 03:30:12210
[email protected]5a7100d2014-05-19 01:29:04211 // Returns the RenderFrameImpl for the given routing ID.
212 static RenderFrameImpl* FromRoutingID(int routing_id);
213
[email protected]a5ac6dc2014-01-15 07:02:14214 // Just like RenderFrame::FromWebFrame but returns the implementation.
215 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09216
[email protected]2f61bdd2013-07-02 18:38:47217 // Used by content_layouttest_support to hook into the creation of
218 // RenderFrameImpls.
jochen664198b2015-06-25 14:13:00219 struct CreateParams {
avi1023d012015-12-25 02:39:14220 CreateParams(RenderViewImpl* render_view, int32_t routing_id)
jochen664198b2015-06-25 14:13:00221 : render_view(render_view), routing_id(routing_id) {}
222 ~CreateParams() {}
223
224 RenderViewImpl* render_view;
avi1023d012015-12-25 02:39:14225 int32_t routing_id;
jochen664198b2015-06-25 14:13:00226 };
227
228 using CreateRenderFrameImplFunction =
229 RenderFrameImpl* (*)(const CreateParams&);
[email protected]2f61bdd2013-07-02 18:38:47230 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50231 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47232
alexmos95733002015-08-24 16:38:09233 // Looks up and returns the WebFrame corresponding to a given opener frame
nick3b5a21f2016-11-22 23:07:11234 // routing ID.
235 static blink::WebFrame* ResolveOpener(int opener_frame_routing_id);
alexmos95733002015-08-24 16:38:09236
kdsilvae0135592016-08-09 17:08:11237 // Overwrites the given URL to use an HTML5 embed if possible.
238 blink::WebURL overrideFlashEmbedWithHTML(const blink::WebURL& url) override;
239
avi5c77d212015-09-25 20:08:25240 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04241
dglazkovf0e1d6d2015-10-10 02:13:48242 // Called by RenderWidget when meaningful layout has happened.
243 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
244 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
245
[email protected]bffc8302014-01-23 20:52:16246 // Out-of-process child frames receive a signal from RenderWidgetCompositor
247 // when a compositor frame has committed.
248 void DidCommitCompositorFrame();
249
lfge0c2792ec2016-05-11 18:52:08250 // Draw commands have been issued by RenderWidgetCompositor.
251 void DidCommitAndDrawCompositorFrame();
252
[email protected]7a4e2532013-12-02 21:30:02253 // TODO(jam): this is a temporary getter until all the code is transitioned
254 // to using RenderFrame instead of RenderView.
wjmaclean2a6cab72016-11-03 18:36:40255 RenderViewImpl* render_view() { return render_view_; }
[email protected]7a4e2532013-12-02 21:30:02256
creis225a7432016-06-03 22:56:27257 const blink::WebHistoryItem& current_history_item() {
258 return current_history_item_;
259 }
260
[email protected]f3add922013-12-20 23:17:16261 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
262
[email protected]7a4e2532013-12-02 21:30:02263 // Returns the RenderWidget associated with this frame.
264 RenderWidget* GetRenderWidget();
265
dgozmancf9039cd2015-04-06 12:01:31266 DevToolsAgent* devtools_agent() { return devtools_agent_; }
267
[email protected]0287e762014-04-11 13:07:58268 // This method must be called after the frame has been added to the frame
269 // tree. It creates all objects that depend on the frame being at its proper
270 // spot.
271 void Initialize();
272
[email protected]de3c5d82014-05-28 22:12:59273 // Notifications from RenderWidget.
274 void WasHidden();
275 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31276 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59277
[email protected]723971b2014-02-12 11:08:25278 // Start/Stop loading notifications.
279 // TODO(nasko): Those are page-level methods at this time and come from
280 // WebViewClient. We should move them to be WebFrameClient calls and put
281 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09282 // |to_different_document| will be true unless the load is a fragment
283 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25284 void didStartLoading(bool to_different_document) override;
285 void didStopLoading() override;
286 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25287
[email protected]95640212014-07-26 18:14:30288 AccessibilityMode accessibility_mode() {
289 return accessibility_mode_;
290 }
291
dmazzoni8e6fe4d2016-06-27 06:35:37292 RenderAccessibilityImpl* render_accessibility() {
293 return render_accessibility_;
[email protected]95640212014-07-26 18:14:30294 }
295
296 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
297 blink::WebAXEvent event);
298
estade31c54342015-01-23 03:34:36299 // The focused node changed to |node|. If focus was lost from this frame,
300 // |node| will be null.
[email protected]95640212014-07-26 18:14:30301 void FocusedNodeChanged(const blink::WebNode& node);
302
estade31c54342015-01-23 03:34:36303 // TODO(dmazzoni): the only reason this is here is to plumb it through to
dmazzoni8e6fe4d2016-06-27 06:35:37304 // RenderAccessibilityImpl. It should use the RenderFrameObserver method, once
estade31c54342015-01-23 03:34:36305 // blink has a separate accessibility tree per frame.
306 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
307
nick5ae4d2d2017-01-06 01:18:35308 // A RenderView opened by this RenderFrame needs to be shown.
309 void ShowCreatedWindow(bool opened_by_user_gesture,
310 RenderWidget* render_widget_to_show,
311 blink::WebNavigationPolicy policy,
312 const gfx::Rect& initial_rect);
313
lfge0c2792ec2016-05-11 18:52:08314 // Called when this frame's widget is focused.
315 void RenderWidgetSetFocus(bool enable);
316
317 // Called when the widget receives a mouse event.
318 void RenderWidgetWillHandleMouseEvent();
319
brettw4b461082016-11-19 18:55:16320#if BUILDFLAG(ENABLE_PLUGINS)
paulmeyer5d0a5f02016-01-21 20:15:52321 // Get/set the plugin which will be used to handle document find requests.
322 void set_plugin_find_handler(PepperPluginInstanceImpl* plugin) {
323 plugin_find_handler_ = plugin;
324 }
325 PepperPluginInstanceImpl* plugin_find_handler() {
326 return plugin_find_handler_;
327 }
328
[email protected]271ff5792013-12-04 22:29:31329 // Notification that a PPAPI plugin has been created.
330 void PepperPluginCreated(RendererPpapiHost* host);
331
[email protected]7a4e2532013-12-02 21:30:02332 // Notifies that |instance| has changed the cursor.
333 // This will update the cursor appearance if it is currently over the plugin
334 // instance.
335 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
336 const blink::WebCursorInfo& cursor);
337
338 // Notifies that |instance| has received a mouse event.
339 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
340
[email protected]7a4e2532013-12-02 21:30:02341 // Informs the render view that a PPAPI plugin has changed text input status.
342 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
343 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
344
345 // Cancels current composition.
346 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
347
348 // Informs the render view that a PPAPI plugin has changed selection.
349 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
350
351 // Creates a fullscreen container for a pepper plugin instance.
352 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
353 PepperPluginInstanceImpl* plugin);
354
[email protected]7a4e2532013-12-02 21:30:02355 bool IsPepperAcceptingCompositionEvents() const;
356
357 // Notification that the given plugin has crashed.
358 void PluginCrashed(const base::FilePath& plugin_path,
359 base::ProcessId plugin_pid);
360
[email protected]7a4e2532013-12-02 21:30:02361 // Simulates IME events for testing purpose.
362 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26363 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02364 const std::vector<blink::WebCompositionUnderline>& underlines,
365 int selection_start,
366 int selection_end);
aelias87b8f7c2016-09-14 03:19:29367 void SimulateImeCommitText(const base::string16& text,
368 const gfx::Range& replacement_range);
369 void SimulateImeFinishComposingText(bool keep_selection);
[email protected]7a4e2532013-12-02 21:30:02370
371 // TODO(jam): remove these once the IPC handler moves from RenderView to
372 // RenderFrame.
373 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42374 const base::string16& text,
375 const std::vector<blink::WebCompositionUnderline>& underlines,
376 int selection_start,
377 int selection_end);
aelias87b8f7c2016-09-14 03:19:29378 void OnImeCommitText(const base::string16& text,
379 const gfx::Range& replacement_range,
380 int relative_cursor_pos);
381 void OnImeFinishComposingText(bool keep_selection);
382
brettw4b461082016-11-19 18:55:16383#endif // BUILDFLAG(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02384
[email protected]977db4a42014-07-17 08:04:32385 // May return NULL in some cases, especially if userMediaClient() returns
386 // NULL.
387 MediaStreamDispatcher* GetMediaStreamDispatcher();
388
thestigcb959ce2016-11-17 05:56:32389 void ScriptedPrint(bool user_initiated);
390
haibinluc643d33c2016-06-03 02:22:34391#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:14392 void DidHideExternalPopupMenu();
393#endif
394
[email protected]227692c52013-05-31 22:43:04395 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52396 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04397
398 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52399 bool OnMessageReceived(const IPC::Message& msg) override;
rockotce2138c2016-09-16 00:09:18400 void OnAssociatedInterfaceRequest(
401 const std::string& interface_name,
402 mojo::ScopedInterfaceEndpointHandle handle) override;
[email protected]227692c52013-05-31 22:43:04403
[email protected]271ff5792013-12-04 22:29:31404 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52405 RenderView* GetRenderView() override;
dmazzoni8e6fe4d2016-06-27 06:35:37406 RenderAccessibility* GetRenderAccessibility() override;
dcheng6d18e402014-10-21 12:32:52407 int GetRoutingID() override;
408 blink::WebLocalFrame* GetWebFrame() override;
409 WebPreferences& GetWebkitPreferences() override;
410 int ShowContextMenu(ContextMenuClient* client,
411 const ContextMenuParams& params) override;
412 void CancelContextMenu(int request_id) override;
tommycli59bd86c2014-12-10 02:09:38413 blink::WebPlugin* CreatePlugin(
414 blink::WebFrame* frame,
415 const WebPluginInfo& info,
416 const blink::WebPluginParams& params,
dchengcedca5612016-04-09 01:40:15417 std::unique_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40418 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52419 blink::WebNavigationPolicy policy) override;
420 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07421 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52422 bool IsHidden() override;
rockot400ea35b2016-10-15 19:15:32423 service_manager::InterfaceRegistry* GetInterfaceRegistry() override;
424 service_manager::InterfaceProvider* GetRemoteInterfaces() override;
rockotf62002a2016-09-15 00:08:59425 AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
426 AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
brettw4b461082016-11-19 18:55:16427#if BUILDFLAG(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38428 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26429 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38430 const base::Closure& unthrottle_callback) override;
tommycli9c7cbd92015-12-18 23:34:34431 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus(
432 const url::Origin& main_frame_origin,
433 const url::Origin& content_origin,
tommycli8a1ef84d2016-08-10 23:05:08434 const gfx::Size& unobscured_size,
435 RecordPeripheralDecision record_decision) const override;
tommyclibae63b92015-10-23 02:56:20436 void WhitelistContentOrigin(const url::Origin& content_origin) override;
nasko2d67b3c2017-01-04 14:48:19437 void PluginDidStartLoading() override;
438 void PluginDidStopLoading() override;
tommyclid481c482014-12-03 01:50:41439#endif
dcheng6d18e402014-10-21 12:32:52440 bool IsFTPDirectoryListing() override;
441 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52442 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52443 void SetSelectedText(const base::string16& selection_text,
444 size_t offset,
445 const gfx::Range& range) override;
446 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19447 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01448 void AddMessageToConsole(ConsoleMessageLevel level,
449 const std::string& message) override;
megjablond5ac7d52015-10-22 23:56:12450 bool IsUsingLoFi() const override;
ellyjonesdb20fae12015-12-04 16:47:55451 bool IsPasting() const override;
lfg717154072016-06-30 15:04:16452 blink::WebPageVisibilityState GetVisibilityState() const override;
jam485372b12016-10-26 19:46:07453 bool IsBrowserSideNavigationPending() override;
[email protected]271ff5792013-12-04 22:29:31454
dominickn6c1f1cf2016-12-20 06:13:33455 // blink::mojom::EngagementClient implementation:
456 void SetEngagementLevel(const url::Origin& origin,
457 blink::mojom::EngagementLevel level) override;
458
ben76f52b242016-06-18 05:42:48459 // mojom::Frame implementation:
460 void GetInterfaceProvider(
rockot400ea35b2016-10-15 19:15:32461 service_manager::mojom::InterfaceProviderRequest request) override;
ben76f52b242016-06-18 05:42:48462
scottmg276753cf2016-10-27 18:25:22463 // mojom::HostZoom implementation:
464 void SetHostZoomLevel(const GURL& url, double zoom_level) override;
465
[email protected]96307312014-05-04 01:00:19466 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25467 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
468 const blink::WebPluginParams& params) override;
469 blink::WebMediaPlayer* createMediaPlayer(
guidou9bfe4e2f2016-04-09 08:31:19470 const blink::WebMediaPlayerSource& source,
srirama.m26f864d02015-07-14 05:21:46471 blink::WebMediaPlayerClient* client,
472 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15473 blink::WebContentDecryptionModule* initial_cdm,
zqzhangf85a8f82016-09-22 19:12:09474 const blink::WebString& sink_id) override;
avi5c77d212015-09-25 20:08:25475 blink::WebApplicationCacheHost* createApplicationCacheHost(
avi5c77d212015-09-25 20:08:25476 blink::WebApplicationCacheHostClient* client) override;
477 blink::WebWorkerContentSettingsClientProxy*
avi01681ef2016-02-16 17:53:57478 createWorkerContentSettingsClientProxy() override;
avi5c77d212015-09-25 20:08:25479 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22480 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25481 blink::WebExternalPopupMenuClient* popup_menu_client) override;
avi5047cd572016-02-16 20:41:12482 blink::WebCookieJar* cookieJar() override;
skyostilb4cce1b2016-03-31 17:56:34483 blink::BlameContext* frameBlameContext() override;
avi01681ef2016-02-16 17:53:57484 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override;
avi5047cd572016-02-16 20:41:12485 void didAccessInitialDocument() override;
dcheng9f8e2f62016-09-29 15:54:50486 blink::WebLocalFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17487 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56488 blink::WebTreeScopeType scope,
489 const blink::WebString& name,
lukasza464d8692016-02-22 19:26:32490 const blink::WebString& unique_name,
491 blink::WebSandboxFlags sandbox_flags,
492 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25493 void didChangeOpener(blink::WebFrame* frame) override;
lfgaf41ee002016-07-05 14:57:24494 void frameDetached(blink::WebLocalFrame* frame, DetachType type) override;
avi5c77d212015-09-25 20:08:25495 void frameFocused() override;
dcheng9f8e2f62016-09-29 15:54:50496 void willCommitProvisionalLoad(blink::WebLocalFrame* frame) override;
lukasza464d8692016-02-22 19:26:32497 void didChangeName(const blink::WebString& name,
498 const blink::WebString& unique_name) override;
mkwstf672e7ef2016-06-09 20:51:07499 void didEnforceInsecureRequestPolicy(
500 blink::WebInsecureRequestPolicy policy) override;
estarkbd8e26f2016-03-16 23:30:37501 void didUpdateToUniqueOrigin(
502 bool is_potentially_trustworthy_unique_origin) override;
avi5c77d212015-09-25 20:08:25503 void didChangeSandboxFlags(blink::WebFrame* child_frame,
504 blink::WebSandboxFlags flags) override;
raymesd405a052016-12-05 23:41:34505 void didSetFeaturePolicyHeader(
506 const blink::WebParsedFeaturePolicy& parsed_header) override;
lukasza8e1c02e42016-05-17 20:05:10507 void didAddContentSecurityPolicy(
508 const blink::WebString& header_value,
509 blink::WebContentSecurityPolicyType type,
510 blink::WebContentSecurityPolicySource source) override;
Avi Drissman09b359e52015-12-07 20:19:21511 void didChangeFrameOwnerProperties(
lazyboy70605c32015-11-03 01:27:31512 blink::WebFrame* child_frame,
513 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25514 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22515 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46516 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25517 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
518 override;
519 bool shouldReportDetailedMessageForSource(
520 const blink::WebString& source) override;
521 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
522 const blink::WebString& source_name,
523 unsigned source_line,
524 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40525 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25526 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40527 const blink::WebString& suggested_name,
528 bool should_replace_current_entry) override;
mkwstb5a70d62016-11-24 19:02:54529 void loadErrorPage(int reason) override;
avi5c77d212015-09-25 20:08:25530 blink::WebNavigationPolicy decidePolicyForNavigation(
531 const NavigationPolicyInfo& info) override;
creise18ce072015-12-02 02:00:02532 blink::WebHistoryItem historyItemForNewChildFrame() override;
avi0fe3a6d2016-02-16 20:57:27533 void willSendSubmitEvent(const blink::WebFormElement& form) override;
534 void willSubmitForm(const blink::WebFormElement& form) override;
avi5c77d212015-09-25 20:08:25535 void didCreateDataSource(blink::WebLocalFrame* frame,
536 blink::WebDataSource* datasource) override;
bmcquade49550fef2016-11-03 18:03:52537 void didStartProvisionalLoad(blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25538 void didReceiveServerRedirectForProvisionalLoad(
539 blink::WebLocalFrame* frame) override;
540 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
541 const blink::WebURLError& error,
542 blink::WebHistoryCommitType commit_type) override;
543 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22544 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52545 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25546 blink::WebHistoryCommitType commit_type) override;
547 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
548 void didClearWindowObject(blink::WebLocalFrame* frame) override;
549 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
rob43ea0642016-03-19 01:05:01550 void runScriptsAtDocumentElementAvailable(
551 blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25552 void didReceiveTitle(blink::WebLocalFrame* frame,
553 const blink::WebString& title,
554 blink::WebTextDirection direction) override;
555 void didChangeIcon(blink::WebLocalFrame* frame,
556 blink::WebIconURL::Type icon_type) override;
rob2718dfc2016-03-25 20:58:27557 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override;
558 void runScriptsAtDocumentReady(blink::WebLocalFrame* frame,
559 bool document_is_empty) override;
avi5c77d212015-09-25 20:08:25560 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
561 void didFailLoad(blink::WebLocalFrame* frame,
562 const blink::WebURLError& error,
563 blink::WebHistoryCommitType commit_type) override;
564 void didFinishLoad(blink::WebLocalFrame* frame) override;
565 void didNavigateWithinPage(blink::WebLocalFrame* frame,
566 const blink::WebHistoryItem& item,
avi68a109ab2016-05-15 01:46:32567 blink::WebHistoryCommitType commit_type,
568 bool content_initiated) override;
avi1008732f2016-02-17 17:28:49569 void didUpdateCurrentHistoryItem() override;
avi5c77d212015-09-25 20:08:25570 void didChangeThemeColor() override;
571 void dispatchLoad() override;
tbansal7b6cf8b2016-05-10 19:27:23572 blink::WebEffectiveConnectionType getEffectiveConnectionType() override;
avi5c77d212015-09-25 20:08:25573 void didChangeSelection(bool is_empty_selection) override;
alexmos56567492016-09-13 00:52:46574 bool handleCurrentKeyboardEvent() override;
avi5c77d212015-09-25 20:08:25575 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19576 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55577 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25578 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
579 void runModalAlertDialog(const blink::WebString& message) override;
580 bool runModalConfirmDialog(const blink::WebString& message) override;
581 bool runModalPromptDialog(const blink::WebString& message,
582 const blink::WebString& default_value,
583 blink::WebString* actual_value) override;
avi141dbc1322016-03-11 22:27:42584 bool runModalBeforeUnloadDialog(bool is_reload) override;
naskoada75b22016-06-11 16:09:46585 bool runFileChooser(
586 const blink::WebFileChooserParams& params,
587 blink::WebFileChooserCompletion* chooser_completion) override;
avi5c77d212015-09-25 20:08:25588 void showContextMenu(const blink::WebContextMenuData& data) override;
brettw8f508f42016-06-20 21:34:21589 void saveImageFromDataURL(const blink::WebString& data_url) override;
avi5c77d212015-09-25 20:08:25590 void willSendRequest(blink::WebLocalFrame* frame,
japhet8489f1b2016-08-24 00:27:59591 blink::WebURLRequest& request) override;
592 void didReceiveResponse(const blink::WebURLResponse& response) override;
avi5c77d212015-09-25 20:08:25593 void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46594 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25595 const blink::WebURLResponse& response) override;
596 void didDisplayInsecureContent() override;
597 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
598 const blink::WebURL& target) override;
estark910b4572015-12-09 20:55:41599 void didDisplayContentWithCertificateErrors(
jamc94a7532016-09-07 19:40:29600 const blink::WebURL& url) override;
601 void didRunContentWithCertificateErrors(const blink::WebURL& url) override;
avi5c77d212015-09-25 20:08:25602 void didChangePerformanceTiming() override;
csharrisonae811ab2016-04-11 11:32:25603 void didObserveLoadingBehavior(
604 blink::WebLoadingBehaviorFlag behavior) override;
avi5c77d212015-09-25 20:08:25605 void didCreateScriptContext(blink::WebLocalFrame* frame,
606 v8::Local<v8::Context> context,
607 int extension_group,
608 int world_id) override;
609 void willReleaseScriptContext(blink::WebLocalFrame* frame,
610 v8::Local<v8::Context> context,
611 int world_id) override;
612 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
613 void willInsertBody(blink::WebLocalFrame* frame) override;
614 void reportFindInPageMatchCount(int request_id,
615 int count,
616 bool final_update) override;
617 void reportFindInPageSelection(int request_id,
618 int active_match_ordinal,
619 const blink::WebRect& sel) override;
avif0d894852016-02-17 17:49:12620 void requestStorageQuota(blink::WebStorageQuotaType type,
avi5c77d212015-09-25 20:08:25621 unsigned long long requested_size,
622 blink::WebStorageQuotaCallbacks callbacks) override;
avi5c77d212015-09-25 20:08:25623 blink::WebPushClient* pushClient() override;
624 blink::WebPresentationClient* presentationClient() override;
625 void willStartUsingPeerConnectionHandler(
avi5c77d212015-09-25 20:08:25626 blink::WebRTCPeerConnectionHandler* handler) override;
627 blink::WebUserMediaClient* userMediaClient() override;
628 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
avif0d894852016-02-17 17:49:12629 blink::WebString userAgentOverride() override;
630 blink::WebString doNotTrackValue() override;
631 bool allowWebGL(bool default_value) override;
avi5c77d212015-09-25 20:08:25632 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
633 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
634 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
635 void postAccessibilityEvent(const blink::WebAXObject& obj,
636 blink::WebAXEvent event) override;
637 void handleAccessibilityFindInPageResult(
638 int identifier,
639 int match_index,
640 const blink::WebAXObject& start_object,
641 int start_offset,
642 const blink::WebAXObject& end_object,
643 int end_offset) override;
avi1008732f2016-02-17 17:28:49644 void didChangeManifest() override;
foolip73101372016-07-13 08:19:22645 void enterFullscreen() override;
646 void exitFullscreen() override;
avi5c77d212015-09-25 20:08:25647 void registerProtocolHandler(const blink::WebString& scheme,
648 const blink::WebURL& url,
649 const blink::WebString& title) override;
650 void unregisterProtocolHandler(const blink::WebString& scheme,
651 const blink::WebURL& url) override;
guidou3906a722015-11-12 22:14:42652 void checkIfAudioSinkExistsAndIsAuthorized(
653 const blink::WebString& sink_id,
654 const blink::WebSecurityOrigin& security_origin,
655 blink::WebSetSinkIdCallbacks* web_callbacks) override;
ben88716142016-07-30 00:03:03656 blink::InterfaceProvider* interfaceProvider() override;
sammc7f964632016-10-14 04:16:21657 blink::InterfaceRegistry* interfaceRegistry() override;
lfg717154072016-06-30 15:04:16658 blink::WebPageVisibilityState visibilityState() const override;
[email protected]85d85fd2013-06-19 00:57:41659
lukasza902fcc52015-12-31 04:45:29660 // WebFrameSerializerClient implementation:
lukasza2e296c32015-09-28 23:29:48661 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48662 const blink::WebCString& data,
lukasza902fcc52015-12-31 04:45:29663 blink::WebFrameSerializerClient::FrameSerializationStatus status)
664 override;
lukasza2e296c32015-09-28 23:29:48665
dominickn6c1f1cf2016-12-20 06:13:33666 // Binds to the site engagement service in the browser.
667 void BindEngagement(blink::mojom::EngagementClientAssociatedRequest request);
668
ben76f52b242016-06-18 05:42:48669 // Binds to the FrameHost in the browser.
dominickn6c1f1cf2016-12-20 06:13:33670 void BindFrame(mojom::FrameRequest request, mojom::FrameHostPtr frame_host);
rockotf8fdd9b2015-12-16 22:22:35671
mlamouri4fff1992014-09-30 11:22:46672 ManifestManager* manifest_manager();
673
avi0392dbf52015-03-25 16:55:45674 // TODO(creis): Remove when the only caller, the HistoryController, is no
675 // more.
676 void SetPendingNavigationParams(
dchengcedca5612016-04-09 01:40:15677 std::unique_ptr<NavigationParams> navigation_params);
avi0392dbf52015-03-25 16:55:45678
xhwang5206d4e62016-02-05 02:09:55679 media::MediaPermission* GetMediaPermission();
guoweisf4282b02015-09-24 23:05:22680
creis69b184a472015-11-26 05:29:51681 // Sends the current frame's navigation state to the browser.
682 void SendUpdateState();
683
sammce2f99982016-03-14 22:38:12684 // Creates a MojoBindingsController if Mojo bindings have been enabled for
685 // this frame. For WebUI, this allows the page to communicate with the browser
686 // process; for layout tests, this allows the test to mock out services at
687 // the Mojo IPC layer.
688 void MaybeEnableMojoBindings();
jsbell14785d902016-10-26 21:37:26689 // Adds the given file chooser request to the file_chooser_completion_ queue
690 // (see that var for more) and requests the chooser be displayed if there are
691 // no other waiting items in the queue.
692 //
693 // Returns true if the chooser was successfully scheduled. False means we
694 // didn't schedule anything.
695 bool ScheduleFileChooser(const FileChooserParams& params,
696 blink::WebFileChooserCompletion* completion);
nasko1fa0fb62015-12-09 01:49:57697
lfge0c2792ec2016-05-11 18:52:08698 // Plugin-related functions --------------------------------------------------
699
brettw4b461082016-11-19 18:55:16700#if BUILDFLAG(ENABLE_PLUGINS)
lfge0c2792ec2016-05-11 18:52:08701 PepperPluginInstanceImpl* focused_pepper_plugin() {
702 return focused_pepper_plugin_;
703 }
704 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
705 return pepper_last_mouse_event_target_;
706 }
707 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
708 pepper_last_mouse_event_target_ = plugin;
709 }
710
711 // Indicates that the given instance has been created.
712 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
713
714 // Indicates that the given instance is being destroyed. This is called from
715 // the destructor, so it's important that the instance is not dereferenced
716 // from this call.
717 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
718
719 // Notification that the given plugin is focused or unfocused.
720 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
zqzhangc885f6b2016-06-23 19:44:46721
722 void PepperStartsPlayback(PepperPluginInstanceImpl* instance);
723 void PepperStopsPlayback(PepperPluginInstanceImpl* instance);
724 void OnSetPepperVolume(int32_t pp_instance, double volume);
lfge0c2792ec2016-05-11 18:52:08725#endif // ENABLE_PLUGINS
726
[email protected]2f61bdd2013-07-02 18:38:47727 protected:
jochen664198b2015-06-25 14:13:00728 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47729
[email protected]227692c52013-05-31 22:43:04730 private:
kenrbf98a4d22015-04-01 21:59:35731 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26732 friend class RenderFrameObserver;
dmazzoni8e6fe4d2016-06-27 06:35:37733 friend class RenderAccessibilityImplTest;
clamy98a9dee02015-06-24 16:09:10734 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14735 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
736 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
737 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
738 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
dmazzoni8e6fe4d2016-06-27 06:35:37739 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
[email protected]66bbadaf2014-03-28 16:25:54740 AccessibilityMessagesQueueWhileSwappedOut);
scottmg276753cf2016-10-27 18:25:22741 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, ZoomLimit);
[email protected]2e2d9632013-12-03 00:55:26742
twellington376424ad2015-05-04 18:57:25743 // A wrapper class used as the callback for JavaScript executed
744 // in an isolated world.
745 class JavaScriptIsolatedWorldRequest
746 : public blink::WebScriptExecutionCallback {
747 public:
748 JavaScriptIsolatedWorldRequest(
749 int id,
750 bool notify_result,
751 int routing_id,
752 base::WeakPtr<RenderFrameImpl> render_frame_impl);
753 void completed(
754 const blink::WebVector<v8::Local<v8::Value>>& result) override;
755
756 private:
avi5c77d212015-09-25 20:08:25757 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25758
759 int id_;
760 bool notify_result_;
761 int routing_id_;
762 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
763
764 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
765 };
766
[email protected]37567b432014-02-12 01:12:22767 typedef std::map<GURL, double> HostZoomLevels;
dominickn6c1f1cf2016-12-20 06:13:33768 typedef std::map<url::Origin, blink::mojom::EngagementLevel> EngagementLevels;
[email protected]37567b432014-02-12 01:12:22769
dchengc5ef1a52015-08-26 20:58:30770 // Creates a new RenderFrame. |render_view| is the RenderView object that this
771 // frame belongs to.
ddorwinf63505e2016-01-08 00:54:50772 // Callers *must* call |BindToWebFrame| immediately after creation.
avi1023d012015-12-25 02:39:14773 static RenderFrameImpl* Create(RenderViewImpl* render_view,
774 int32_t routing_id);
dchengc5ef1a52015-08-26 20:58:30775
ddorwinf63505e2016-01-08 00:54:50776 // This is called right after creation with the WebLocalFrame for this
777 // RenderFrame. It must be called before Initialize.
778 void BindToWebFrame(blink::WebLocalFrame* web_frame);
779
[email protected]2e2d9632013-12-03 00:55:26780 // Functions to add and remove observers for this object.
781 void AddObserver(RenderFrameObserver* observer);
782 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34783
dcheng3d886b732015-11-05 19:16:01784 bool IsLocalRoot() const;
csharrison12975f12016-12-08 18:54:17785 const RenderFrameImpl* GetLocalRoot() const;
dcheng3d886b732015-11-05 19:16:01786
[email protected]f0906a02014-08-07 07:18:55787 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35788 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08789 blink::WebHistoryCommitType commit_type,
790 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22791
[email protected]b70da4c2014-01-06 19:57:09792 // IPC message handlers ------------------------------------------------------
793 //
794 // The documentation for these functions should be in
795 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10796 void OnNavigate(const CommonNavigationParams& common_params,
797 const StartNavigationParams& start_params,
798 const RequestNavigationParams& request_params);
clamybfd6a812016-05-30 16:25:17799 void OnBeforeUnload(bool is_reload);
alexmosbc7eafa2014-12-06 01:38:09800 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56801 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09802 const FrameReplicationState& replicated_frame_state);
naskoeab5c5582015-12-15 05:20:00803 void OnDeleteFrame();
Nasko Oskov85f60222014-08-28 22:53:30804 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42805 void OnShowContextMenu(const gfx::Point& location);
806 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
807 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
808 unsigned action);
[email protected]4ee64622014-03-21 22:34:15809 void OnUndo();
810 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07811 void OnCut();
812 void OnCopy();
813 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15814 void OnPasteAndMatchStyle();
815 void OnDelete();
816 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14817 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38818 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15819 void OnUnselect();
christiankaeed9862014-11-05 10:49:14820 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17821 void OnReplace(const base::string16& text);
822 void OnReplaceMisspelling(const base::string16& text);
brettw8f508f42016-06-20 21:34:21823 void OnCopyImageAt(int x, int y);
824 void OnSaveImageAt(int x, int y);
peter4eb242002015-06-02 12:45:13825 void OnAddMessageToConsole(ConsoleMessageLevel level,
826 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52827 void OnJavaScriptExecuteRequest(const base::string16& javascript,
828 int id,
829 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28830 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
831 int id,
jochen2e7d95b2015-05-04 15:28:50832 bool notify_result,
833 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25834 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
835 int id,
836 bool notify_result,
837 int world_id);
avi1023d012015-12-25 02:39:14838 void OnVisualStateRequest(uint64_t key);
[email protected]4ee64622014-03-21 22:34:15839 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16840 void OnSetCompositionFromExistingText(
841 int start, int end,
842 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24843 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16844 void OnExtendSelectionAndDelete(int before, int after);
yabinh90f1be12016-10-14 03:04:39845 void OnDeleteSurroundingText(int before, int after);
toyoshim24a4c7ab2016-04-05 09:24:14846 void OnReload(bool bypass_cache);
megjablon3f5941072016-02-04 23:27:52847 void OnReloadLoFiImages();
jam973236102016-02-09 00:47:05848 void OnTextSurroundingSelectionRequest(uint32_t max_length);
dpranke32d4b3a472016-11-21 17:45:37849 void OnFocusedFormFieldDataRequest(int request_id);
[email protected]95640212014-07-26 18:14:30850 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51851 void OnSnapshotAccessibilityTree(int callback_id);
alexmos95733002015-08-24 16:38:09852 void OnUpdateOpener(int opener_routing_id);
dcheng5f60abb2015-05-28 01:39:36853 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
lazyboy70605c32015-11-03 01:27:31854 void OnSetFrameOwnerProperties(
raymesbba82b32016-07-19 00:41:38855 const FrameOwnerProperties& frame_owner_properties);
alexmos401f0aba2015-12-06 10:07:39856 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id);
alexmos5357efb2015-12-16 21:44:00857 void OnSetFocusedFrame();
dspelle736c9db2015-04-03 04:53:16858 void OnTextTrackSettingsChanged(
859 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16860 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
davidbena5496d62014-10-07 18:52:04861 void OnCommitNavigation(const ResourceResponseHead& response,
862 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42863 const CommonNavigationParams& common_params,
lukaszad04640f2016-05-25 17:08:44864 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57865 void OnFailedNavigation(const CommonNavigationParams& common_params,
866 const RequestNavigationParams& request_params,
867 bool has_stale_copy_in_cache,
868 int error_code);
lukasza6af746b72015-09-18 23:37:22869 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48870 void OnGetSerializedHtmlWithLocalLinks(
lukasza777a7dd2016-01-25 23:55:47871 const std::map<GURL, base::FilePath>& url_to_local_path,
872 const std::map<int, base::FilePath>& frame_routing_id_to_local_path);
lukaszaede9cc02015-12-30 23:48:32873 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params);
paulmeyer5d0a5f02016-01-21 20:15:52874 void OnFind(int request_id,
875 const base::string16& search_text,
876 const blink::WebFindOptions& options);
paulmeyerc8cb7cb2016-06-07 01:14:19877 void OnClearActiveFindMatch();
paulmeyer5d0a5f02016-01-21 20:15:52878 void OnStopFinding(StopFindAction action);
clamy91b7abf2016-03-24 15:17:45879 void OnEnableViewSourceMode();
avi6b8dbb32016-04-08 18:59:35880 void OnSuppressFurtherDialogs();
japhet74e6d692016-10-27 00:44:30881 void OnSetHasReceivedUserGesture();
naskoada75b22016-06-11 16:09:46882 void OnFileChooserResponse(
883 const std::vector<content::FileChooserFileInfo>& files);
ekaramada110f642016-12-21 19:47:28884 void OnClearFocusedElement();
paulmeyer5d0a5f02016-01-21 20:15:52885#if defined(OS_ANDROID)
886 void OnActivateNearestFindResult(int request_id, float x, float y);
paulmeyerc8cb7cb2016-06-07 01:14:19887 void OnGetNearestFindResult(int request_id, float x, float y);
paulmeyer5d0a5f02016-01-21 20:15:52888 void OnFindMatchRects(int current_version);
haibinluc643d33c2016-06-03 02:22:34889#endif
890
891#if defined(USE_EXTERNAL_POPUP_MENU)
892#if defined(OS_MACOSX)
893 void OnSelectPopupMenuItem(int selected_index);
894#else
paulmeyer5d0a5f02016-01-21 20:15:52895 void OnSelectPopupMenuItems(bool canceled,
896 const std::vector<int>& selected_indices);
haibinluc643d33c2016-06-03 02:22:34897#endif
898#endif
899
900#if defined(OS_MACOSX)
paulmeyer5d0a5f02016-01-21 20:15:52901 void OnCopyToFindPboard();
902#endif
clamy9bfeef42014-09-30 20:50:42903
carlosk27fa0652016-10-05 23:10:36904 // Callback scheduled from OnSerializeAsMHTML for when writing serialized
905 // MHTML to file has been completed in the file thread.
906 void OnWriteMHTMLToDiskComplete(
907 int job_id,
908 std::set<std::string> serialized_resources_uri_digests,
909 base::TimeDelta main_thread_use_time,
carlosk29da4fe2016-11-29 00:01:29910 MhtmlSaveStatus save_status);
carlosk27fa0652016-10-05 23:10:36911
creise18ce072015-12-02 02:00:02912 // Requests that the browser process navigates to |url|. If
913 // |is_history_navigation_in_new_child| is true, the browser process should
914 // look for a matching FrameNavigationEntry in the last committed entry to use
915 // instead of |url|.
lukaszabb2101b82016-06-17 16:52:25916 void OpenURL(
917 const GURL& url,
918 bool uses_post,
919 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
lukasza4a07d3a2016-10-19 21:03:22920 const std::string& extra_headers,
lukaszabb2101b82016-06-17 16:52:25921 const Referrer& referrer,
922 blink::WebNavigationPolicy policy,
923 bool should_replace_current_entry,
924 bool is_history_navigation_in_new_child);
[email protected]a09d53ce2014-01-31 00:46:42925
clamyd6983032015-04-29 14:48:12926 // Performs a navigation in the frame. This provides a unified function for
927 // the current code path and the browser-side navigation path (in
928 // development). Currently used by OnNavigate, with all *NavigationParams
929 // provided by the browser. |stream_params| should be null.
930 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
931 // |request_params| received by the browser. |stream_params| should be non
932 // null and created from the information provided by the browser.
933 // |start_params| is not used.
dchengcedca5612016-04-09 01:40:15934 void NavigateInternal(
935 const CommonNavigationParams& common_params,
936 const StartNavigationParams& start_params,
937 const RequestNavigationParams& request_params,
lukaszad04640f2016-05-25 17:08:44938 std::unique_ptr<StreamOverrideParameters> stream_params);
clamyd6983032015-04-29 14:48:12939
[email protected]ef3adfc2014-05-11 00:04:54940 // Update current main frame's encoding and send it to browser window.
941 // Since we want to let users see the right encoding info from menu
942 // before finishing loading, we call the UpdateEncoding in
943 // a) function:DidCommitLoadForFrame. When this function is called,
944 // that means we have got first data. In here we try to get encoding
945 // of page if it has been specified in http header.
946 // b) function:DidReceiveTitle. When this function is called,
947 // that means we have got specified title. Because in most of webpages,
948 // title tags will follow meta tags. In here we try to get encoding of
949 // page if it has been specified in meta tag.
950 // c) function:DidFinishDocumentLoadForFrame. When this function is
951 // called, that means we have got whole html page. In here we should
952 // finally get right encoding of page.
953 void UpdateEncoding(blink::WebFrame* frame,
954 const std::string& encoding_name);
955
[email protected]4ee64622014-03-21 22:34:15956 // Dispatches the current state of selection on the webpage to the browser if
957 // it has changed.
958 // TODO(varunjain): delete this method once we figure out how to keep
959 // selection handles in sync with the webpage.
960 void SyncSelectionIfRequired();
961
[email protected]87de04b02014-04-08 22:14:49962 bool RunJavaScriptMessage(JavaScriptMessageType type,
963 const base::string16& message,
964 const base::string16& default_value,
965 const GURL& frame_url,
966 base::string16* result);
967
[email protected]457736d2014-04-30 15:54:27968 // Loads the appropriate error page for the specified failure into the frame.
yzshen0424e6952016-09-06 16:48:58969 // |entry| is only used by PlzNavigate when navigating to a history item.
[email protected]457736d2014-04-30 15:54:27970 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
971 const blink::WebURLError& error,
yzshen0424e6952016-09-06 16:48:58972 bool replace,
973 HistoryEntry* entry);
[email protected]457736d2014-04-30 15:54:27974
zeeshanq3454e9c2014-09-04 21:30:28975 void HandleJavascriptExecutionResult(const base::string16& javascript,
976 int id,
977 bool notify_result,
deepak.s750d68f2015-04-30 07:32:41978 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:28979
[email protected]977db4a42014-07-17 08:04:32980 // Initializes |web_user_media_client_|. If this fails, because it wasn't
981 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
982 // |web_user_media_client_| will remain NULL.
983 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:19984
985 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:15986 blink::WebMediaPlayerClient* client,
987 const blink::WebString& sink_id,
988 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:19989
[email protected]ae2477e2014-05-27 23:47:08990 // Creates a factory object used for creating audio and video renderers.
dchengcedca5612016-04-09 01:40:15991 std::unique_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:08992
avi5cad4912015-06-19 05:25:44993 // Does preparation for the navigation to |url|.
994 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:25995 const GURL& url,
toyoshimf3f7f682016-04-08 07:47:48996 const RequestNavigationParams& request_params);
clamyda97e8322014-10-07 21:57:25997
clamyece38882014-11-19 15:00:20998 // PlzNavigate
arthursonzogni69824eb2016-07-13 16:22:03999 // Sends a FrameHostMsg_BeginNavigation to the browser
1000 void BeginNavigation(const NavigationPolicyInfo& info);
clamyece38882014-11-19 15:00:201001
clamy4cc9b8202015-03-02 13:51:361002 // Loads a data url.
1003 void LoadDataURL(const CommonNavigationParams& params,
mnaganovbf087422015-12-16 05:10:031004 const RequestNavigationParams& request_params,
clamy0f4ccc82016-02-24 12:43:531005 blink::WebLocalFrame* frame,
1006 blink::WebFrameLoadType load_type,
1007 blink::WebHistoryItem item_for_history_navigation,
1008 blink::WebHistoryLoadType history_load_type,
1009 bool is_client_redirect);
clamy4cc9b8202015-03-02 13:51:361010
clamy62b271d2015-04-16 11:54:571011 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
1012 // the failed request |request|.
1013 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
1014 const blink::WebURLError& error,
1015 blink::WebLocalFrame* frame);
1016
1017 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
1018 const GURL& unreachable_url);
1019
[email protected]f3a95312014-06-12 16:46:581020 // Returns the URL being loaded by the |frame_|'s request.
1021 GURL GetLoadingUrl() const;
1022
avi0392dbf52015-03-25 16:55:451023 // If we initiated a navigation, this function will populate |document_state|
1024 // with the navigation information saved in OnNavigate().
1025 void PopulateDocumentStateFromPending(DocumentState* document_state);
1026
1027 // Returns a new NavigationState populated with the navigation information
1028 // saved in OnNavigate().
1029 NavigationState* CreateNavigationStateFromPending();
1030
csharrison1ce0e852015-11-07 16:45:131031 // Sets the NavigationState on the DocumentState based on
1032 // the value of |pending_navigation_params_|.
boliuac512fd2016-03-16 23:33:351033 void UpdateNavigationState(DocumentState* document_state,
avi68a109ab2016-05-15 01:46:321034 bool was_within_same_page,
1035 bool content_initiated);
csharrison1ce0e852015-11-07 16:45:131036
[email protected]96307312014-05-04 01:00:191037#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:001038 blink::WebMediaPlayer* CreateAndroidWebMediaPlayer(
jrummell65b7d272014-09-24 20:49:271039 blink::WebMediaPlayerClient* client,
srirama.m26f864d02015-07-14 05:21:461040 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
dalecurtis49f363882015-08-25 21:05:381041 const media::WebMediaPlayerParams& params);
[email protected]a017938b2014-05-27 21:17:171042
[email protected]65f3d1aa2014-05-29 01:57:001043 RendererMediaPlayerManager* GetMediaPlayerManager();
davve859f4f92015-11-27 10:16:191044
1045 RendererMediaSessionManager* GetMediaSessionManager();
[email protected]4b556cf2014-06-10 23:21:531046#endif
1047
sandersd02d9aea2015-05-12 02:29:261048 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:421049
xhwange70b7ee12015-06-25 09:17:171050#if defined(ENABLE_MOJO_MEDIA)
rockot400ea35b2016-10-15 19:15:321051 service_manager::mojom::InterfaceProvider* GetMediaInterfaceProvider();
xhwang33f939e2015-06-23 04:33:421052#endif
1053
xjzd3fe45a2016-10-12 18:26:371054#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
miu1ddf18c62016-09-24 01:39:411055 media::mojom::RemoterFactory* GetRemoterFactory();
xjzd3fe45a2016-10-12 18:26:371056#endif
1057
xhwangd7180832015-04-03 05:38:151058 media::CdmFactory* GetCdmFactory();
xhwang409e53552016-02-23 00:52:441059 media::DecoderFactory* GetDecoderFactory();
[email protected]96307312014-05-04 01:00:191060
brettw4b461082016-11-19 18:55:161061#if BUILDFLAG(ENABLE_PLUGINS)
dominicknf7d1f952016-11-19 01:52:091062 void HandlePepperImeCommit(const base::string16& text);
1063#endif // ENABLE_PLUGINS
1064
ben155ecf82016-06-21 22:43:261065 void RegisterMojoInterfaces();
halton.huoca2eabd2015-07-06 08:17:401066
xhwang6bca21e2016-02-06 00:21:451067 // Connect to an interface provided by the service registry.
1068 template <typename Interface>
bene3bc9022016-02-10 17:38:241069 void GetInterface(mojo::InterfaceRequest<Interface> request);
xhwang6bca21e2016-02-06 00:21:451070
scottmg276753cf2016-10-27 18:25:221071 void OnHostZoomClientRequest(mojom::HostZoomAssociatedRequest request);
1072
dalecurtisa12e6062015-11-10 23:13:141073 // Returns the media delegate for WebMediaPlayer usage. If
1074 // |media_player_delegate_| is NULL, one is created.
1075 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
1076
paulmeyer5d0a5f02016-01-21 20:15:521077 // Called to get the WebPlugin to handle find requests in the document.
1078 // Returns nullptr if there is no such WebPlugin.
1079 blink::WebPlugin* GetWebPluginForFind();
1080
1081 // Sends a reply to the current find operation handling if it was a
1082 // synchronous find request.
1083 void SendFindReply(int request_id,
1084 int match_count,
1085 int ordinal,
1086 const blink::WebRect& selection_rect,
1087 bool final_status_update);
1088
skyostilb4cce1b2016-03-31 17:56:341089 void InitializeBlameContext(RenderFrameImpl* parent_frame);
1090
xjzd3fe45a2016-10-12 18:26:371091#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
xjzdf8ea422016-11-08 22:00:521092 // Creates the RemotingRendererController to control whether to switch to/from
1093 // media remoting from/to local playback.
1094 std::unique_ptr<media::RemotingRendererController>
1095 CreateRemotingRendererController();
xjzd3fe45a2016-10-12 18:26:371096#endif
1097
creiscfaa4462015-03-16 19:27:181098 // Stores the WebLocalFrame we are associated with. This is null from the
ddorwinf63505e2016-01-08 00:54:501099 // constructor until BindToWebFrame is called, and it is null after
creiscfaa4462015-03-16 19:27:181100 // frameDetached is called until destruction (which is asynchronous in the
1101 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:221102 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:091103
dglazkov2e140f52015-09-28 16:10:071104 // Boolean value indicating whether this RenderFrameImpl object is for the
1105 // main frame or not. It remains accurate during destruction, even when
1106 // |frame_| has been invalidated.
1107 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:191108
naskoeab5c5582015-12-15 05:20:001109 // When a frame is detached in response to a message from the browser process,
1110 // this RenderFrame should not be sending notifications back to it. This
1111 // boolean is used to indicate this case.
1112 bool in_browser_initiated_detach_;
1113
1114 // Indicates whether the frame has been inserted into the frame tree yet or
1115 // not.
1116 //
1117 // When a frame is created by the browser process, it is for a pending
1118 // navigation. In this case, it is not immediately attached to the frame tree
1119 // if there is a RenderFrameProxy for the same frame. It is inserted into the
1120 // frame tree at the time the pending navigation commits.
1121 // Frames added by the parent document are created from the renderer process
1122 // and are immediately inserted in the frame tree.
1123 // TODO(dcheng): Remove this once we have FrameTreeHandle and can use the
1124 // Blink Web* layer to check for provisional frames.
1125 bool in_frame_tree_;
1126
wjmaclean2a6cab72016-11-03 18:36:401127 RenderViewImpl* render_view_;
[email protected]227692c52013-05-31 22:43:041128 int routing_id_;
nasko8b9d9bd2015-05-06 19:23:191129
japhete6adf142014-10-31 00:01:491130 // If this frame was created to replace a proxy, this will store the routing
1131 // id of the proxy to replace at commit-time, at which time it will be
1132 // cleared.
1133 // TODO(creis): Remove this after switching to PlzNavigate.
1134 int proxy_routing_id_;
1135
dcheng3d886b732015-11-05 19:16:011136 // Non-null when the RenderFrame is a local root for compositing, input,
1137 // layout, etc. A local frame is also a local root iff it does not have a
1138 // parent that is a local frame.
kenrba7199832015-01-22 23:44:591139 scoped_refptr<RenderWidget> render_widget_;
1140
avi0392dbf52015-03-25 16:55:451141 // Temporarily holds state pertaining to a navigation that has been initiated
1142 // until the NavigationState corresponding to the new navigation is created in
1143 // didCreateDataSource().
dchengcedca5612016-04-09 01:40:151144 std::unique_ptr<NavigationParams> pending_navigation_params_;
avi0392dbf52015-03-25 16:55:451145
creisc8ca51e2016-09-29 23:10:281146 // Keeps track of which future subframes the browser process has history items
Charles Reis37c95492016-10-21 20:38:581147 // for during a history navigation, as well as whether those items are for
1148 // about:blank. The renderer process should ask the browser for history items
1149 // when subframes with these names are created (as long as they are not
1150 // staying at about:blank), and directly load the initial URLs for any other
1151 // subframes.
1152 //
1153 // This state is incrementally cleared as it is used and then reset in
1154 // didStopLoading, since it is not needed after the first load completes and
1155 // is never used after the initial navigation.
creisc8ca51e2016-09-29 23:10:281156 // TODO(creis): Expand this to include any corresponding same-process
1157 // PageStates for the whole subtree in https://crbug.com/639842.
Charles Reis37c95492016-10-21 20:38:581158 std::map<std::string, bool> history_subframe_unique_names_;
creis45b3bba2016-09-22 22:47:131159
creis8eb8ef22015-11-04 22:51:381160 // Stores the current history item for this frame, so that updates to it can
1161 // be reported to the browser process via SendUpdateState.
1162 blink::WebHistoryItem current_history_item_;
1163
brettw4b461082016-11-19 18:55:161164#if BUILDFLAG(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:021165 // Current text input composition text. Empty if no composition is in
1166 // progress.
[email protected]fcf75d42013-12-03 20:11:261167 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:091168
tommycli59bd86c2014-12-10 02:09:381169 PluginPowerSaverHelper* plugin_power_saver_helper_;
paulmeyer5d0a5f02016-01-21 20:15:521170
1171 PepperPluginInstanceImpl* plugin_find_handler_;
[email protected]7a4e2532013-12-02 21:30:021172#endif
1173
[email protected]f3add922013-12-20 23:17:161174 RendererWebCookieJarImpl cookie_jar_;
1175
[email protected]2e2d9632013-12-03 00:55:261176 // All the registered observers.
brettw236d3172015-06-03 16:31:431177 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:261178
[email protected]bffc8302014-01-23 20:52:161179 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
1180
[email protected]a09d53ce2014-01-31 00:46:421181 // External context menu requests we're waiting for. "Internal"
1182 // (WebKit-originated) context menu events will have an ID of 0 and will not
1183 // be in this map.
1184 //
1185 // We don't want to add internal ones since some of the "special" page
1186 // handlers in the browser process just ignore the context menu requests so
1187 // avoid showing context menus, and so this will cause right clicks to leak
1188 // entries in this map. Most users of the custom context menu (e.g. Pepper
1189 // plugins) are normally only on "regular" pages and the regular pages will
1190 // always respond properly to the request, so we don't have to worry so
1191 // much about leaks.
rlandayde24c6d2016-12-01 03:05:401192 IDMap<ContextMenuClient*> pending_context_menus_;
[email protected]a09d53ce2014-01-31 00:46:421193
[email protected]4ee64622014-03-21 22:34:151194 // The text selection the last time DidChangeSelection got called. May contain
1195 // additional characters before and after the selected text, for IMEs. The
1196 // portion of this string that is the actual selected text starts at index
1197 // |selection_range_.GetMin() - selection_text_offset_| and has length
1198 // |selection_range_.length()|.
1199 base::string16 selection_text_;
1200 // The offset corresponding to the start of |selection_text_| in the document.
1201 size_t selection_text_offset_;
1202 // Range over the document corresponding to the actual selected text (which
1203 // could correspond to a substring of |selection_text_|; see above).
1204 gfx::Range selection_range_;
1205 // Used to inform didChangeSelection() when it is called in the context
1206 // of handling a InputMsg_SelectRange IPC.
1207 bool handling_select_range_;
1208
[email protected]2626d142014-04-22 17:24:021209 // The next group of objects all implement RenderFrameObserver, so are deleted
1210 // along with the RenderFrame automatically. This is why we just store weak
1211 // references.
1212
[email protected]977db4a42014-07-17 08:04:321213 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:331214 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191215
jrummell109c3a602014-12-18 01:08:501216 // EncryptedMediaClient attached to this frame; lazily initialized.
dchengcedca5612016-04-09 01:40:151217 std::unique_ptr<media::WebEncryptedMediaClientImpl>
1218 web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501219
xhwang6bca21e2016-02-06 00:21:451220 // The media permission dispatcher attached to this frame.
dchengcedca5612016-04-09 01:40:151221 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011222
xhwange70b7ee12015-06-25 09:17:171223#if defined(ENABLE_MOJO_MEDIA)
xhwanga5967e552016-02-26 00:54:081224 // The media interface provider attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151225 std::unique_ptr<MediaInterfaceProvider> media_interface_provider_;
xhwang065b54b2015-06-03 22:25:551226#endif
1227
[email protected]a017938b2014-05-27 21:17:171228#if defined(OS_ANDROID)
davve859f4f92015-11-27 10:16:191229 // Manages all media players and sessions in this render frame for
1230 // communicating with the real media player and sessions in the
1231 // browser process. It's okay to use raw pointers since they're both
1232 // RenderFrameObservers.
[email protected]a017938b2014-05-27 21:17:171233 RendererMediaPlayerManager* media_player_manager_;
davve859f4f92015-11-27 10:16:191234 RendererMediaSessionManager* media_session_manager_;
[email protected]4b556cf2014-06-10 23:21:531235#endif
1236
watkdee516f2016-02-18 02:22:191237 media::SurfaceManager* media_surface_manager_;
1238
xjzd3fe45a2016-10-12 18:26:371239#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
miu1ddf18c62016-09-24 01:39:411240 // Lazy-bound pointer to the RemoterFactory service in the browser
1241 // process. Always use the GetRemoterFactory() accessor instead of this.
1242 media::mojom::RemoterFactoryPtr remoter_factory_;
xjzdf8ea422016-11-08 22:00:521243 // An observer for the remoting sink availability that is used by
1244 // media::RemotingCdmFactory to initialize media::RemotingSourceImpl. Created
1245 // in the constructor of RenderFrameImpl to make sure
1246 // media::RemotingSourceImpl be intialized with correct availability info.
1247 // Own by media::RemotingCdmFactory after it is created.
1248 std::unique_ptr<media::RemotingSinkObserver> remoting_sink_observer_;
xjzd3fe45a2016-10-12 18:26:371249#endif
miu1ddf18c62016-09-24 01:39:411250
xhwang409e53552016-02-23 00:52:441251 // The CDM and decoder factory attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151252 std::unique_ptr<media::CdmFactory> cdm_factory_;
1253 std::unique_ptr<media::DecoderFactory> decoder_factory_;
xhwangd7180832015-04-03 05:38:151254
hubbe5f0ad43b2015-12-14 20:57:261255 // Media resource cache, lazily initialized.
1256 linked_ptr<media::UrlIndex> url_index_;
1257
dgozman358ba322015-03-26 15:05:301258 // The devtools agent for this frame; only created for main frame and
1259 // local roots.
1260 DevToolsAgent* devtools_agent_;
1261
[email protected]45920862014-07-02 12:53:021262 // The push messaging dispatcher attached to this frame, lazily initialized.
1263 PushMessagingDispatcher* push_messaging_dispatcher_;
1264
avayvodbca35fad2015-01-29 20:20:571265 // The presentation dispatcher implementation attached to this frame, lazily
1266 // initialized.
1267 PresentationDispatcher* presentation_dispatcher_;
1268
rockot400ea35b2016-10-15 19:15:321269 std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
1270 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
ben88716142016-07-30 00:03:031271 std::unique_ptr<BlinkInterfaceProviderImpl> blink_interface_provider_;
sammc7f964632016-10-14 04:16:211272 std::unique_ptr<BlinkInterfaceRegistryImpl> blink_interface_registry_;
rockot400ea35b2016-10-15 19:15:321273 service_manager::mojom::InterfaceProviderRequest
ben155ecf82016-06-21 22:43:261274 pending_remote_interface_provider_request_;
[email protected]c52a1412014-06-25 06:09:251275
ben275a5652016-10-28 16:55:501276 service_manager::ServiceInfo local_info_;
1277 service_manager::ServiceInfo remote_info_;
1278
rockot3860a852016-10-17 04:57:331279 // The Connector proxy used to connect to services.
rockot400ea35b2016-10-15 19:15:321280 service_manager::mojom::ConnectorPtr connector_;
rockotd9260982015-08-21 22:26:301281
[email protected]45920862014-07-02 12:53:021282 // The screen orientation dispatcher attached to the frame, lazily
1283 // initialized.
[email protected]cf78eda2014-06-13 16:57:411284 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1285
mlamouriefdca9d2014-09-16 16:55:401286 // The Manifest Manager handles the manifest requests from the browser
1287 // process.
1288 ManifestManager* manifest_manager_;
1289
[email protected]95640212014-07-26 18:14:301290 // The current accessibility mode.
1291 AccessibilityMode accessibility_mode_;
1292
1293 // Only valid if |accessibility_mode_| is anything other than
1294 // AccessibilityModeOff.
dmazzoni8e6fe4d2016-06-27 06:35:371295 RenderAccessibilityImpl* render_accessibility_;
[email protected]95640212014-07-26 18:14:301296
dalecurtisa12e6062015-11-10 23:13:141297 // Manages play, pause notifications for WebMediaPlayer implementations; its
1298 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1299 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1300
megjablond5ac7d52015-10-22 23:56:121301 // Whether or not this RenderFrame is using Lo-Fi mode.
1302 bool is_using_lofi_;
1303
tbansal7b6cf8b2016-05-10 19:27:231304 // Effective connection type when the document of this frame was fetched.
1305 blink::WebEffectiveConnectionType effective_connection_type_;
1306
ellyjonesdb20fae12015-12-04 16:47:551307 // Whether or not this RenderFrame is currently pasting.
1308 bool is_pasting_;
1309
avi6b8dbb32016-04-08 18:59:351310 // Whether we must stop creating nested message loops for modal dialogs. This
1311 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the
1312 // stack that interferes with swapping out.
1313 bool suppress_further_dialogs_;
1314
naskoada75b22016-06-11 16:09:461315 // The current and pending file chooser completion objects. If the queue is
1316 // nonempty, the first item represents the currently running file chooser
1317 // callback, and the remaining elements are the other file chooser completion
1318 // still waiting to be run (in order).
1319 struct PendingFileChooser;
1320 std::deque<std::unique_ptr<PendingFileChooser>> file_chooser_completions_;
1321
haibinluc643d33c2016-06-03 02:22:341322#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:141323 // The external popup for the currently showing select popup.
dchengcedca5612016-04-09 01:40:151324 std::unique_ptr<ExternalPopupMenu> external_popup_menu_;
avi485e5fd62014-08-25 23:26:141325#endif
1326
xiaochengh01c3b102016-06-13 23:56:081327 std::unique_ptr<FrameBlameContext> blame_context_;
nhirokibf6789872016-12-27 05:36:241328 std::unique_ptr<SharedWorkerRepository> shared_worker_repository_;
skyostilb4cce1b2016-03-31 17:56:341329
lfge0c2792ec2016-05-11 18:52:081330 // Plugins -------------------------------------------------------------------
brettw4b461082016-11-19 18:55:161331#if BUILDFLAG(ENABLE_PLUGINS)
lfge0c2792ec2016-05-11 18:52:081332 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1333 PepperPluginSet active_pepper_instances_;
1334
1335 // Whether or not the focus is on a PPAPI plugin
1336 PepperPluginInstanceImpl* focused_pepper_plugin_;
1337
1338 // The plugin instance that received the last mouse event. It is set to NULL
1339 // if the last mouse event went to elements other than Pepper plugins.
1340 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1341 // the RenderFrameImpl to NULL it out when it destructs.
1342 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
1343#endif
1344
scottmg276753cf2016-10-27 18:25:221345 HostZoomLevels host_zoom_levels_;
dominickn6c1f1cf2016-12-20 06:13:331346 EngagementLevels engagement_levels_;
scottmg276753cf2016-10-27 18:25:221347
dominickn6c1f1cf2016-12-20 06:13:331348 mojo::AssociatedBinding<blink::mojom::EngagementClient> engagement_binding_;
ben76f52b242016-06-18 05:42:481349 mojo::Binding<mojom::Frame> frame_binding_;
scottmg276753cf2016-10-27 18:25:221350 mojo::AssociatedBinding<mojom::HostZoom> host_zoom_binding_;
ben76f52b242016-06-18 05:42:481351 mojom::FrameHostPtr frame_host_;
1352
ahesteacad602016-08-30 21:25:541353 // Indicates whether |didAccessInitialDocument| was called.
1354 bool has_accessed_initial_document_;
1355
rockotf62002a2016-09-15 00:08:591356 AssociatedInterfaceRegistryImpl associated_interfaces_;
1357 std::unique_ptr<AssociatedInterfaceProviderImpl>
1358 remote_associated_interfaces_;
1359
dcheng77df1082016-10-06 02:54:171360 // TODO(dcheng): Remove these members.
1361 bool committed_first_load_ = false;
1362 bool name_changed_before_first_commit_ = false;
1363
jam485372b12016-10-26 19:46:071364 bool browser_side_navigation_pending_ = false;
1365
[email protected]96307312014-05-04 01:00:191366 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1367
[email protected]227692c52013-05-31 22:43:041368 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1369};
1370
1371} // namespace content
1372
[email protected]85d85fd2013-06-19 00:57:411373#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_