blob: cc28f1f41ab015f8dbed479de9a5fb226d4e22dc [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"
altimin06fe10c2017-01-20 11:28:1527#include "base/single_thread_task_runner.h"
avi1023d012015-12-25 02:39:1428#include "build/build_config.h"
[email protected]95640212014-07-26 18:14:3029#include "content/common/accessibility_mode_enums.h"
rockotf62002a2016-09-15 00:08:5930#include "content/common/associated_interface_registry_impl.h"
carlosk29da4fe2016-11-29 00:01:2931#include "content/common/download/mhtml_save_status.h"
ben76f52b242016-06-18 05:42:4832#include "content/common/frame.mojom.h"
clamyda97e8322014-10-07 21:57:2533#include "content/common/frame_message_enums.h"
scottmg276753cf2016-10-27 18:25:2234#include "content/common/host_zoom.mojom.h"
rockot53be7caf2016-10-04 20:17:0835#include "content/common/renderer.mojom.h"
peter4eb242002015-06-02 12:45:1336#include "content/public/common/console_message_level.h"
avi777ff452017-02-09 19:04:4837#include "content/public/common/javascript_dialog_type.h"
megjabloncaf312f2017-01-12 18:47:4938#include "content/public/common/previews_state.h"
[email protected]65920f332014-03-04 21:14:1839#include "content/public/common/referrer.h"
paulmeyer5d0a5f02016-01-21 20:15:5240#include "content/public/common/stop_find_action.h"
[email protected]227692c52013-05-31 22:43:0441#include "content/public/renderer/render_frame.h"
skyostilb4cce1b2016-03-31 17:56:3442#include "content/renderer/frame_blame_context.h"
ben88716142016-07-30 00:03:0343#include "content/renderer/mojo/blink_interface_provider_impl.h"
[email protected]f3add922013-12-20 23:17:1644#include "content/renderer/renderer_webcookiejar_impl.h"
[email protected]227692c52013-05-31 22:43:0445#include "ipc/ipc_message.h"
lukasza70b79c82015-12-14 20:24:1346#include "ipc/ipc_platform_file.h"
acolwell9e0840d2014-09-06 19:01:3247#include "media/blink/webmediaplayer_delegate.h"
dalecurtis49f363882015-08-25 21:05:3848#include "media/blink/webmediaplayer_params.h"
miu1ddf18c62016-09-24 01:39:4149#include "media/mojo/interfaces/remoting.mojom.h"
scottmg276753cf2016-10-27 18:25:2250#include "mojo/public/cpp/bindings/associated_binding.h"
ben155ecf82016-06-21 22:43:2651#include "mojo/public/cpp/bindings/binding.h"
brettw4b461082016-11-19 18:55:1652#include "ppapi/features/features.h"
sammc406822fa2017-02-07 22:22:0353#include "services/service_manager/public/cpp/service_info.h"
rockot734fb662016-10-15 16:41:3054#include "services/service_manager/public/interfaces/connector.mojom.h"
55#include "services/service_manager/public/interfaces/interface_provider.mojom.h"
tbansal7b6cf8b2016-05-10 19:27:2356#include "third_party/WebKit/public/platform/WebEffectiveConnectionType.h"
raymesd405a052016-12-05 23:41:3457#include "third_party/WebKit/public/platform/WebFeaturePolicy.h"
alexmos401f0aba2015-12-06 10:07:3958#include "third_party/WebKit/public/platform/WebFocusType.h"
csharrisonae811ab2016-04-11 11:32:2559#include "third_party/WebKit/public/platform/WebLoadingBehaviorFlag.h"
sandersdf92f4e5c2016-01-22 20:57:2260#include "third_party/WebKit/public/platform/WebMediaPlayer.h"
lfg717154072016-06-30 15:04:1661#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
dominickn6c1f1cf2016-12-20 06:13:3362#include "third_party/WebKit/public/platform/site_engagement.mojom.h"
[email protected]95640212014-07-26 18:14:3063#include "third_party/WebKit/public/web/WebAXObject.h"
[email protected]85d85fd2013-06-19 00:57:4164#include "third_party/WebKit/public/web/WebDataSource.h"
65#include "third_party/WebKit/public/web/WebFrameClient.h"
boliu15890e42015-11-24 23:08:0566#include "third_party/WebKit/public/web/WebFrameLoadType.h"
lukasza902fcc52015-12-31 04:45:2967#include "third_party/WebKit/public/web/WebFrameSerializerClient.h"
[email protected]680575542014-04-03 17:12:5268#include "third_party/WebKit/public/web/WebHistoryCommitType.h"
skyostilc3ed5652015-10-19 16:28:4669#include "third_party/WebKit/public/web/WebMeaningfulLayout.h"
twellington376424ad2015-05-04 18:57:2570#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
[email protected]4ee64622014-03-21 22:34:1571#include "ui/gfx/range/range.h"
lukaszaede9cc02015-12-30 23:48:3272#include "url/gurl.h"
dominickn6c1f1cf2016-12-20 06:13:3373#include "url/origin.h"
[email protected]227692c52013-05-31 22:43:0474
brettw4b461082016-11-19 18:55:1675#if BUILDFLAG(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:3876#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:4177#endif
78
[email protected]a017938b2014-05-27 21:17:1779#if defined(OS_ANDROID)
80#include "content/renderer/media/android/renderer_media_player_manager.h"
81#endif
82
alexmose7da5a12015-04-09 02:22:1683struct FrameMsg_PostMessage_Params;
lukaszaede9cc02015-12-30 23:48:3284struct FrameMsg_SerializeAsMHTML_Params;
dspelle736c9db2015-04-03 04:53:1685struct FrameMsg_TextTrackSettings_Params;
[email protected]7a4e2532013-12-02 21:30:0286
87namespace blink {
[email protected]82ce5b92014-03-22 05:15:2688class WebContentDecryptionModule;
avayvodbca35fad2015-01-29 20:20:5789class WebPresentationClient;
[email protected]45920862014-07-02 12:53:0290class WebPushClient;
[email protected]82ce5b92014-03-22 05:15:2691class WebSecurityOrigin;
toyoshimf3f7f682016-04-08 07:47:4892enum class WebCachePolicy;
[email protected]7a4e2532013-12-02 21:30:0293struct WebCompositionUnderline;
[email protected]a09d53ce2014-01-31 00:46:4294struct WebContextMenuData;
[email protected]7a4e2532013-12-02 21:30:0295struct WebCursorInfo;
paulmeyer5d0a5f02016-01-21 20:15:5296struct WebFindOptions;
thestig4c8f2a72016-08-13 01:39:1197} // namespace blink
[email protected]7a4e2532013-12-02 21:30:0298
99namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:42100class Point;
[email protected]7a4e2532013-12-02 21:30:02101class Range;
[email protected]7a4e2532013-12-02 21:30:02102}
103
jrummell109c3a602014-12-18 01:08:50104namespace media {
xhwangd7180832015-04-03 05:38:15105class CdmFactory;
xhwang409e53552016-02-23 00:52:44106class DecoderFactory;
xhwang60b430a2015-02-01 05:20:46107class MediaPermission;
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;
miu9f7788e2017-01-25 00:46:09112
113namespace remoting {
114class SinkAvailabilityObserver;
115} // namespace remoting
116
thestige62f7382016-11-08 18:31:39117} // namespace media
jrummell109c3a602014-12-18 01:08:50118
rockot400ea35b2016-10-15 19:15:32119namespace service_manager {
ben155ecf82016-06-21 22:43:26120class InterfaceRegistry;
121class InterfaceProvider;
xhwang33f939e2015-06-23 04:33:42122}
123
tommycli58e3172c2015-09-15 18:18:26124namespace url {
125class Origin;
126}
127
[email protected]227692c52013-05-31 22:43:04128namespace content {
129
rockotf62002a2016-09-15 00:08:59130class AssociatedInterfaceProviderImpl;
sammc7f964632016-10-14 04:16:21131class BlinkInterfaceRegistryImpl;
[email protected]bffc8302014-01-23 20:52:16132class ChildFrameCompositingHelper;
kenrba7199832015-01-22 23:44:59133class CompositorDependencies;
dgozman358ba322015-03-26 15:05:30134class DevToolsAgent;
avi0392dbf52015-03-25 16:55:45135class DocumentState;
avi485e5fd62014-08-25 23:26:14136class ExternalPopupMenu;
yzshen0424e6952016-09-06 16:48:58137class HistoryEntry;
mlamouriefdca9d2014-09-16 16:55:40138class ManifestManager;
xhwanga5967e552016-02-26 00:54:08139class MediaInterfaceProvider;
[email protected]977db4a42014-07-17 08:04:32140class MediaStreamDispatcher;
[email protected]ae2477e2014-05-27 23:47:08141class MediaStreamRendererFactory;
xhwang5206d4e62016-02-05 02:09:55142class MediaPermissionDispatcher;
avi0392dbf52015-03-25 16:55:45143class NavigationState;
[email protected]7a4e2532013-12-02 21:30:02144class PepperPluginInstanceImpl;
avayvodbca35fad2015-01-29 20:20:57145class PresentationDispatcher;
[email protected]45920862014-07-02 12:53:02146class PushMessagingDispatcher;
dmazzoni8e6fe4d2016-06-27 06:35:37147class RenderAccessibilityImpl;
[email protected]4b556cf2014-06-10 23:21:53148class RendererMediaPlayerManager;
[email protected]7a4e2532013-12-02 21:30:02149class RendererPpapiHost;
[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;
nhirokibf6789872016-12-27 05:36:24156class SharedWorkerRepository;
perkj1a2d0432014-09-03 13:52:33157class UserMediaClientImpl;
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,
dominickn6c1f1cf2016-12-20 06:13:33177 NON_EXPORTED_BASE(blink::mojom::EngagementClient),
ben76f52b242016-06-18 05:42:48178 NON_EXPORTED_BASE(mojom::Frame),
scottmg276753cf2016-10-27 18:25:22179 NON_EXPORTED_BASE(mojom::HostZoom),
sammc7f6c6a02017-01-30 00:53:51180 NON_EXPORTED_BASE(mojom::FrameBindingsControl),
[email protected]96307312014-05-04 01:00:19181 NON_EXPORTED_BASE(public blink::WebFrameClient),
lukasza902fcc52015-12-31 04:45:29182 NON_EXPORTED_BASE(public blink::WebFrameSerializerClient) {
[email protected]227692c52013-05-31 22:43:04183 public:
dchengc5ef1a52015-08-26 20:58:30184 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55185 static RenderFrameImpl* CreateMainFrame(
186 RenderViewImpl* render_view,
187 int32_t routing_id,
188 int32_t widget_routing_id,
189 bool hidden,
ccameron2f451532016-09-07 21:49:27190 const ScreenInfo& screen_info,
dcheng9e24bd352016-03-01 19:15:51191 CompositorDependencies* compositor_deps,
192 blink::WebFrame* opener);
[email protected]2f61bdd2013-07-02 18:38:47193
alexmosa181efc2015-09-03 00:39:04194 // Creates a new RenderFrame with |routing_id|. If |proxy_routing_id| is
195 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
196 // the frame tree after the frame identified by
197 // |previous_sibling_routing_id|, or as the first child if
alexmos9f8705a2015-05-06 19:58:59198 // |previous_sibling_routing_id| is MSG_ROUTING_NONE. Otherwise, the frame is
199 // semi-orphaned until it commits, at which point it replaces the proxy
alexmosa181efc2015-09-03 00:39:04200 // identified by |proxy_routing_id|. The frame's opener is set to the frame
201 // identified by |opener_routing_id|. The frame is created as a child of the
202 // RenderFrame identified by |parent_routing_id| or as the top-level frame if
203 // the latter is MSG_ROUTING_NONE. Note: This is called only when
alexmos9f8705a2015-05-06 19:58:59204 // RenderFrame is being created in response to IPC message from the browser
205 // process. All other frame creation is driven through Blink and Create.
raymes31457802016-07-20 06:08:09206 static void CreateFrame(int routing_id,
207 int proxy_routing_id,
208 int opener_routing_id,
209 int parent_routing_id,
210 int previous_sibling_routing_id,
211 const FrameReplicationState& replicated_state,
212 CompositorDependencies* compositor_deps,
rockot53be7caf2016-10-04 20:17:08213 const mojom::CreateFrameWidgetParams& params,
raymes31457802016-07-20 06:08:09214 const FrameOwnerProperties& frame_owner_properties);
[email protected]82307f6b2014-08-07 03:30:12215
[email protected]5a7100d2014-05-19 01:29:04216 // Returns the RenderFrameImpl for the given routing ID.
217 static RenderFrameImpl* FromRoutingID(int routing_id);
218
[email protected]a5ac6dc2014-01-15 07:02:14219 // Just like RenderFrame::FromWebFrame but returns the implementation.
220 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09221
[email protected]2f61bdd2013-07-02 18:38:47222 // Used by content_layouttest_support to hook into the creation of
223 // RenderFrameImpls.
jochen664198b2015-06-25 14:13:00224 struct CreateParams {
avi1023d012015-12-25 02:39:14225 CreateParams(RenderViewImpl* render_view, int32_t routing_id)
jochen664198b2015-06-25 14:13:00226 : render_view(render_view), routing_id(routing_id) {}
227 ~CreateParams() {}
228
229 RenderViewImpl* render_view;
avi1023d012015-12-25 02:39:14230 int32_t routing_id;
jochen664198b2015-06-25 14:13:00231 };
232
233 using CreateRenderFrameImplFunction =
234 RenderFrameImpl* (*)(const CreateParams&);
[email protected]2f61bdd2013-07-02 18:38:47235 static void InstallCreateHook(
dongseong.hwangb721ddf2014-12-10 21:22:50236 CreateRenderFrameImplFunction create_render_frame_impl);
[email protected]2f61bdd2013-07-02 18:38:47237
alexmos95733002015-08-24 16:38:09238 // Looks up and returns the WebFrame corresponding to a given opener frame
nick3b5a21f2016-11-22 23:07:11239 // routing ID.
240 static blink::WebFrame* ResolveOpener(int opener_frame_routing_id);
alexmos95733002015-08-24 16:38:09241
kdsilvae0135592016-08-09 17:08:11242 // Overwrites the given URL to use an HTML5 embed if possible.
243 blink::WebURL overrideFlashEmbedWithHTML(const blink::WebURL& url) override;
244
avi5c77d212015-09-25 20:08:25245 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04246
dglazkovf0e1d6d2015-10-10 02:13:48247 // Called by RenderWidget when meaningful layout has happened.
248 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
249 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
250
[email protected]bffc8302014-01-23 20:52:16251 // Out-of-process child frames receive a signal from RenderWidgetCompositor
252 // when a compositor frame has committed.
253 void DidCommitCompositorFrame();
254
lfge0c2792ec2016-05-11 18:52:08255 // Draw commands have been issued by RenderWidgetCompositor.
256 void DidCommitAndDrawCompositorFrame();
257
[email protected]7a4e2532013-12-02 21:30:02258 // TODO(jam): this is a temporary getter until all the code is transitioned
259 // to using RenderFrame instead of RenderView.
wjmaclean2a6cab72016-11-03 18:36:40260 RenderViewImpl* render_view() { return render_view_; }
[email protected]7a4e2532013-12-02 21:30:02261
creis225a7432016-06-03 22:56:27262 const blink::WebHistoryItem& current_history_item() {
263 return current_history_item_;
264 }
265
[email protected]f3add922013-12-20 23:17:16266 RendererWebCookieJarImpl* cookie_jar() { return &cookie_jar_; }
267
[email protected]7a4e2532013-12-02 21:30:02268 // Returns the RenderWidget associated with this frame.
269 RenderWidget* GetRenderWidget();
270
dgozmancf9039cd2015-04-06 12:01:31271 DevToolsAgent* devtools_agent() { return devtools_agent_; }
272
[email protected]0287e762014-04-11 13:07:58273 // This method must be called after the frame has been added to the frame
274 // tree. It creates all objects that depend on the frame being at its proper
275 // spot.
276 void Initialize();
277
[email protected]de3c5d82014-05-28 22:12:59278 // Notifications from RenderWidget.
279 void WasHidden();
280 void WasShown();
dgozmancf9039cd2015-04-06 12:01:31281 void WidgetWillClose();
[email protected]de3c5d82014-05-28 22:12:59282
[email protected]723971b2014-02-12 11:08:25283 // Start/Stop loading notifications.
284 // TODO(nasko): Those are page-level methods at this time and come from
285 // WebViewClient. We should move them to be WebFrameClient calls and put
286 // logic in the browser side to balance starts/stops.
[email protected]e3b10d12014-03-28 16:06:09287 // |to_different_document| will be true unless the load is a fragment
288 // navigation, or triggered by history.pushState/replaceState.
avi5c77d212015-09-25 20:08:25289 void didStartLoading(bool to_different_document) override;
290 void didStopLoading() override;
291 void didChangeLoadProgress(double load_progress) override;
[email protected]723971b2014-02-12 11:08:25292
[email protected]95640212014-07-26 18:14:30293 AccessibilityMode accessibility_mode() {
294 return accessibility_mode_;
295 }
296
dmazzoni8e6fe4d2016-06-27 06:35:37297 RenderAccessibilityImpl* render_accessibility() {
298 return render_accessibility_;
[email protected]95640212014-07-26 18:14:30299 }
300
301 void HandleWebAccessibilityEvent(const blink::WebAXObject& obj,
302 blink::WebAXEvent event);
303
estade31c54342015-01-23 03:34:36304 // The focused node changed to |node|. If focus was lost from this frame,
305 // |node| will be null.
[email protected]95640212014-07-26 18:14:30306 void FocusedNodeChanged(const blink::WebNode& node);
307
estade31c54342015-01-23 03:34:36308 // TODO(dmazzoni): the only reason this is here is to plumb it through to
dmazzoni8e6fe4d2016-06-27 06:35:37309 // RenderAccessibilityImpl. It should use the RenderFrameObserver method, once
estade31c54342015-01-23 03:34:36310 // blink has a separate accessibility tree per frame.
311 void FocusedNodeChangedForAccessibility(const blink::WebNode& node);
312
nick5ae4d2d2017-01-06 01:18:35313 // A RenderView opened by this RenderFrame needs to be shown.
314 void ShowCreatedWindow(bool opened_by_user_gesture,
315 RenderWidget* render_widget_to_show,
316 blink::WebNavigationPolicy policy,
317 const gfx::Rect& initial_rect);
318
lfge0c2792ec2016-05-11 18:52:08319 // Called when this frame's widget is focused.
320 void RenderWidgetSetFocus(bool enable);
321
322 // Called when the widget receives a mouse event.
323 void RenderWidgetWillHandleMouseEvent();
324
brettw4b461082016-11-19 18:55:16325#if BUILDFLAG(ENABLE_PLUGINS)
paulmeyer5d0a5f02016-01-21 20:15:52326 // Get/set the plugin which will be used to handle document find requests.
327 void set_plugin_find_handler(PepperPluginInstanceImpl* plugin) {
328 plugin_find_handler_ = plugin;
329 }
330 PepperPluginInstanceImpl* plugin_find_handler() {
331 return plugin_find_handler_;
332 }
333
[email protected]271ff5792013-12-04 22:29:31334 // Notification that a PPAPI plugin has been created.
335 void PepperPluginCreated(RendererPpapiHost* host);
336
[email protected]7a4e2532013-12-02 21:30:02337 // Notifies that |instance| has changed the cursor.
338 // This will update the cursor appearance if it is currently over the plugin
339 // instance.
340 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
341 const blink::WebCursorInfo& cursor);
342
343 // Notifies that |instance| has received a mouse event.
344 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
345
[email protected]7a4e2532013-12-02 21:30:02346 // Informs the render view that a PPAPI plugin has changed text input status.
347 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
348 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
349
350 // Cancels current composition.
351 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
352
353 // Informs the render view that a PPAPI plugin has changed selection.
354 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
355
356 // Creates a fullscreen container for a pepper plugin instance.
357 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
358 PepperPluginInstanceImpl* plugin);
359
[email protected]7a4e2532013-12-02 21:30:02360 bool IsPepperAcceptingCompositionEvents() const;
361
362 // Notification that the given plugin has crashed.
363 void PluginCrashed(const base::FilePath& plugin_path,
364 base::ProcessId plugin_pid);
365
[email protected]7a4e2532013-12-02 21:30:02366 // Simulates IME events for testing purpose.
367 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26368 const base::string16& text,
[email protected]7a4e2532013-12-02 21:30:02369 const std::vector<blink::WebCompositionUnderline>& underlines,
370 int selection_start,
371 int selection_end);
rlanday7efe2302017-01-11 00:14:28372 void SimulateImeCommitText(
373 const base::string16& text,
374 const std::vector<blink::WebCompositionUnderline>& underlines,
375 const gfx::Range& replacement_range);
aelias87b8f7c2016-09-14 03:19:29376 void SimulateImeFinishComposingText(bool keep_selection);
[email protected]7a4e2532013-12-02 21:30:02377
378 // TODO(jam): remove these once the IPC handler moves from RenderView to
379 // RenderFrame.
380 void OnImeSetComposition(
tommyclie6633ca72014-10-31 00:40:42381 const base::string16& text,
382 const std::vector<blink::WebCompositionUnderline>& underlines,
383 int selection_start,
384 int selection_end);
aelias87b8f7c2016-09-14 03:19:29385 void OnImeCommitText(const base::string16& text,
386 const gfx::Range& replacement_range,
387 int relative_cursor_pos);
388 void OnImeFinishComposingText(bool keep_selection);
389
brettw4b461082016-11-19 18:55:16390#endif // BUILDFLAG(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02391
[email protected]977db4a42014-07-17 08:04:32392 // May return NULL in some cases, especially if userMediaClient() returns
393 // NULL.
394 MediaStreamDispatcher* GetMediaStreamDispatcher();
395
thestigcb959ce2016-11-17 05:56:32396 void ScriptedPrint(bool user_initiated);
397
haibinluc643d33c2016-06-03 02:22:34398#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:14399 void DidHideExternalPopupMenu();
400#endif
401
[email protected]227692c52013-05-31 22:43:04402 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52403 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04404
405 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52406 bool OnMessageReceived(const IPC::Message& msg) override;
rockotce2138c2016-09-16 00:09:18407 void OnAssociatedInterfaceRequest(
408 const std::string& interface_name,
409 mojo::ScopedInterfaceEndpointHandle handle) override;
[email protected]227692c52013-05-31 22:43:04410
[email protected]271ff5792013-12-04 22:29:31411 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52412 RenderView* GetRenderView() override;
dmazzoni8e6fe4d2016-06-27 06:35:37413 RenderAccessibility* GetRenderAccessibility() override;
dcheng6d18e402014-10-21 12:32:52414 int GetRoutingID() override;
415 blink::WebLocalFrame* GetWebFrame() override;
416 WebPreferences& GetWebkitPreferences() override;
417 int ShowContextMenu(ContextMenuClient* client,
418 const ContextMenuParams& params) override;
419 void CancelContextMenu(int request_id) override;
tommycli59bd86c2014-12-10 02:09:38420 blink::WebPlugin* CreatePlugin(
421 blink::WebFrame* frame,
422 const WebPluginInfo& info,
423 const blink::WebPluginParams& params,
dchengcedca5612016-04-09 01:40:15424 std::unique_ptr<PluginInstanceThrottler> throttler) override;
japhetb0bae9d82015-10-19 20:43:40425 void LoadURLExternally(const blink::WebURLRequest& request,
dcheng6d18e402014-10-21 12:32:52426 blink::WebNavigationPolicy policy) override;
427 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07428 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52429 bool IsHidden() override;
rockot400ea35b2016-10-15 19:15:32430 service_manager::InterfaceRegistry* GetInterfaceRegistry() override;
431 service_manager::InterfaceProvider* GetRemoteInterfaces() override;
rockotf62002a2016-09-15 00:08:59432 AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
433 AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
brettw4b461082016-11-19 18:55:16434#if BUILDFLAG(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38435 void RegisterPeripheralPlugin(
tommycli58e3172c2015-09-15 18:18:26436 const url::Origin& content_origin,
tommycli59bd86c2014-12-10 02:09:38437 const base::Closure& unthrottle_callback) override;
tommycli9c7cbd92015-12-18 23:34:34438 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus(
439 const url::Origin& main_frame_origin,
440 const url::Origin& content_origin,
tommycli8a1ef84d2016-08-10 23:05:08441 const gfx::Size& unobscured_size,
442 RecordPeripheralDecision record_decision) const override;
tommyclibae63b92015-10-23 02:56:20443 void WhitelistContentOrigin(const url::Origin& content_origin) override;
nasko2d67b3c2017-01-04 14:48:19444 void PluginDidStartLoading() override;
445 void PluginDidStopLoading() override;
tommyclid481c482014-12-03 01:50:41446#endif
dcheng6d18e402014-10-21 12:32:52447 bool IsFTPDirectoryListing() override;
448 void AttachGuest(int element_instance_id) override;
fsamuela95fef42014-12-03 20:16:52449 void DetachGuest(int element_instance_id) override;
dcheng6d18e402014-10-21 12:32:52450 void SetSelectedText(const base::string16& selection_text,
451 size_t offset,
452 const gfx::Range& range) override;
453 void EnsureMojoBuiltinsAreAvailable(v8::Isolate* isolate,
dcarney4410a7c92015-04-20 11:28:19454 v8::Local<v8::Context> context) override;
rdevlin.croninb2cec912015-06-24 20:36:01455 void AddMessageToConsole(ConsoleMessageLevel level,
456 const std::string& message) override;
megjabloncaf312f2017-01-12 18:47:49457 PreviewsState GetPreviewsState() const override;
ellyjonesdb20fae12015-12-04 16:47:55458 bool IsPasting() const override;
lfg717154072016-06-30 15:04:16459 blink::WebPageVisibilityState GetVisibilityState() const override;
jam485372b12016-10-26 19:46:07460 bool IsBrowserSideNavigationPending() override;
altimin06fe10c2017-01-20 11:28:15461 base::SingleThreadTaskRunner* GetTimerTaskRunner() override;
462 base::SingleThreadTaskRunner* GetLoadingTaskRunner() override;
463 base::SingleThreadTaskRunner* GetUnthrottledTaskRunner() override;
sammc7f6c6a02017-01-30 00:53:51464 int GetEnabledBindings() const override;
[email protected]271ff5792013-12-04 22:29:31465
dominickn6c1f1cf2016-12-20 06:13:33466 // blink::mojom::EngagementClient implementation:
467 void SetEngagementLevel(const url::Origin& origin,
468 blink::mojom::EngagementLevel level) override;
469
ben76f52b242016-06-18 05:42:48470 // mojom::Frame implementation:
471 void GetInterfaceProvider(
rockot400ea35b2016-10-15 19:15:32472 service_manager::mojom::InterfaceProviderRequest request) override;
ben76f52b242016-06-18 05:42:48473
sammc7f6c6a02017-01-30 00:53:51474 // mojom::FrameBindingsControl implementation:
475 void AllowBindings(int32_t enabled_bindings_flags) override;
476
scottmg276753cf2016-10-27 18:25:22477 // mojom::HostZoom implementation:
478 void SetHostZoomLevel(const GURL& url, double zoom_level) override;
479
[email protected]96307312014-05-04 01:00:19480 // blink::WebFrameClient implementation:
avi5c77d212015-09-25 20:08:25481 blink::WebPlugin* createPlugin(blink::WebLocalFrame* frame,
482 const blink::WebPluginParams& params) override;
483 blink::WebMediaPlayer* createMediaPlayer(
guidou9bfe4e2f2016-04-09 08:31:19484 const blink::WebMediaPlayerSource& source,
srirama.m26f864d02015-07-14 05:21:46485 blink::WebMediaPlayerClient* client,
486 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15487 blink::WebContentDecryptionModule* initial_cdm,
zqzhangf85a8f82016-09-22 19:12:09488 const blink::WebString& sink_id) override;
avi5c77d212015-09-25 20:08:25489 blink::WebApplicationCacheHost* createApplicationCacheHost(
avi5c77d212015-09-25 20:08:25490 blink::WebApplicationCacheHostClient* client) override;
491 blink::WebWorkerContentSettingsClientProxy*
avi01681ef2016-02-16 17:53:57492 createWorkerContentSettingsClientProxy() override;
avi5c77d212015-09-25 20:08:25493 blink::WebExternalPopupMenu* createExternalPopupMenu(
[email protected]b20c3222014-08-22 00:50:22494 const blink::WebPopupMenuInfo& popup_menu_info,
avi5c77d212015-09-25 20:08:25495 blink::WebExternalPopupMenuClient* popup_menu_client) override;
avi5047cd572016-02-16 20:41:12496 blink::WebCookieJar* cookieJar() override;
skyostilb4cce1b2016-03-31 17:56:34497 blink::BlameContext* frameBlameContext() override;
avi01681ef2016-02-16 17:53:57498 blink::WebServiceWorkerProvider* createServiceWorkerProvider() override;
avi5047cd572016-02-16 20:41:12499 void didAccessInitialDocument() override;
dcheng9f8e2f62016-09-29 15:54:50500 blink::WebLocalFrame* createChildFrame(
alexmose48b1df932015-01-16 01:34:17501 blink::WebLocalFrame* parent,
dcheng860817a2015-05-22 03:16:56502 blink::WebTreeScopeType scope,
503 const blink::WebString& name,
lukasza464d8692016-02-22 19:26:32504 const blink::WebString& unique_name,
505 blink::WebSandboxFlags sandbox_flags,
506 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25507 void didChangeOpener(blink::WebFrame* frame) override;
lfgaf41ee002016-07-05 14:57:24508 void frameDetached(blink::WebLocalFrame* frame, DetachType type) override;
avi5c77d212015-09-25 20:08:25509 void frameFocused() override;
dcheng9f8e2f62016-09-29 15:54:50510 void willCommitProvisionalLoad(blink::WebLocalFrame* frame) override;
lukasza464d8692016-02-22 19:26:32511 void didChangeName(const blink::WebString& name,
512 const blink::WebString& unique_name) override;
mkwstf672e7ef2016-06-09 20:51:07513 void didEnforceInsecureRequestPolicy(
514 blink::WebInsecureRequestPolicy policy) override;
estarkbd8e26f2016-03-16 23:30:37515 void didUpdateToUniqueOrigin(
516 bool is_potentially_trustworthy_unique_origin) override;
avi5c77d212015-09-25 20:08:25517 void didChangeSandboxFlags(blink::WebFrame* child_frame,
518 blink::WebSandboxFlags flags) override;
raymesd405a052016-12-05 23:41:34519 void didSetFeaturePolicyHeader(
iclelland4dbcfdcb2017-02-02 23:51:49520 const blink::WebParsedFeaturePolicyHeader& parsed_header) override;
lukasza8e1c02e42016-05-17 20:05:10521 void didAddContentSecurityPolicy(
522 const blink::WebString& header_value,
523 blink::WebContentSecurityPolicyType type,
524 blink::WebContentSecurityPolicySource source) override;
Avi Drissman09b359e52015-12-07 20:19:21525 void didChangeFrameOwnerProperties(
lazyboy70605c32015-11-03 01:27:31526 blink::WebFrame* child_frame,
527 const blink::WebFrameOwnerProperties& frame_owner_properties) override;
avi5c77d212015-09-25 20:08:25528 void didMatchCSS(
[email protected]35b2a972014-04-04 15:50:22529 blink::WebLocalFrame* frame,
[email protected]180ef242013-11-07 06:50:46530 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25531 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
532 override;
japhet61835ae12017-01-20 01:25:39533 void setHasReceivedUserGesture() override;
avi5c77d212015-09-25 20:08:25534 bool shouldReportDetailedMessageForSource(
535 const blink::WebString& source) override;
536 void didAddMessageToConsole(const blink::WebConsoleMessage& message,
537 const blink::WebString& source_name,
538 unsigned source_line,
539 const blink::WebString& stack_trace) override;
japhetb0bae9d82015-10-19 20:43:40540 void loadURLExternally(const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25541 blink::WebNavigationPolicy policy,
japhetb0bae9d82015-10-19 20:43:40542 const blink::WebString& suggested_name,
543 bool should_replace_current_entry) override;
mkwstb5a70d62016-11-24 19:02:54544 void loadErrorPage(int reason) override;
avi5c77d212015-09-25 20:08:25545 blink::WebNavigationPolicy decidePolicyForNavigation(
546 const NavigationPolicyInfo& info) override;
creise18ce072015-12-02 02:00:02547 blink::WebHistoryItem historyItemForNewChildFrame() override;
avi0fe3a6d2016-02-16 20:57:27548 void willSendSubmitEvent(const blink::WebFormElement& form) override;
549 void willSubmitForm(const blink::WebFormElement& form) override;
avi5c77d212015-09-25 20:08:25550 void didCreateDataSource(blink::WebLocalFrame* frame,
551 blink::WebDataSource* datasource) override;
ananta1a023a382017-02-07 19:34:01552 void didStartProvisionalLoad(blink::WebDataSource* data_source) override;
avi5c77d212015-09-25 20:08:25553 void didReceiveServerRedirectForProvisionalLoad(
554 blink::WebLocalFrame* frame) override;
555 void didFailProvisionalLoad(blink::WebLocalFrame* frame,
556 const blink::WebURLError& error,
557 blink::WebHistoryCommitType commit_type) override;
558 void didCommitProvisionalLoad(
[email protected]45d877f2014-04-05 07:36:22559 blink::WebLocalFrame* frame,
[email protected]680575542014-04-03 17:12:52560 const blink::WebHistoryItem& item,
avi5c77d212015-09-25 20:08:25561 blink::WebHistoryCommitType commit_type) override;
562 void didCreateNewDocument(blink::WebLocalFrame* frame) override;
563 void didClearWindowObject(blink::WebLocalFrame* frame) override;
564 void didCreateDocumentElement(blink::WebLocalFrame* frame) override;
rob43ea0642016-03-19 01:05:01565 void runScriptsAtDocumentElementAvailable(
566 blink::WebLocalFrame* frame) override;
avi5c77d212015-09-25 20:08:25567 void didReceiveTitle(blink::WebLocalFrame* frame,
568 const blink::WebString& title,
569 blink::WebTextDirection direction) override;
570 void didChangeIcon(blink::WebLocalFrame* frame,
571 blink::WebIconURL::Type icon_type) override;
rob2718dfc2016-03-25 20:58:27572 void didFinishDocumentLoad(blink::WebLocalFrame* frame) override;
573 void runScriptsAtDocumentReady(blink::WebLocalFrame* frame,
574 bool document_is_empty) override;
avi5c77d212015-09-25 20:08:25575 void didHandleOnloadEvents(blink::WebLocalFrame* frame) override;
576 void didFailLoad(blink::WebLocalFrame* frame,
577 const blink::WebURLError& error,
578 blink::WebHistoryCommitType commit_type) override;
579 void didFinishLoad(blink::WebLocalFrame* frame) override;
580 void didNavigateWithinPage(blink::WebLocalFrame* frame,
581 const blink::WebHistoryItem& item,
avi68a109ab2016-05-15 01:46:32582 blink::WebHistoryCommitType commit_type,
583 bool content_initiated) override;
avi1008732f2016-02-17 17:28:49584 void didUpdateCurrentHistoryItem() override;
avi5c77d212015-09-25 20:08:25585 void didChangeThemeColor() override;
586 void dispatchLoad() override;
tbansal7b6cf8b2016-05-10 19:27:23587 blink::WebEffectiveConnectionType getEffectiveConnectionType() override;
avi5c77d212015-09-25 20:08:25588 void didChangeSelection(bool is_empty_selection) override;
alexmos56567492016-09-13 00:52:46589 bool handleCurrentKeyboardEvent() override;
avi5c77d212015-09-25 20:08:25590 blink::WebColorChooser* createColorChooser(
[email protected]eb8c216a2014-04-09 19:19:19591 blink::WebColorChooserClient* client,
[email protected]f3c59d62014-04-09 16:33:55592 const blink::WebColor& initial_color,
avi5c77d212015-09-25 20:08:25593 const blink::WebVector<blink::WebColorSuggestion>& suggestions) override;
594 void runModalAlertDialog(const blink::WebString& message) override;
595 bool runModalConfirmDialog(const blink::WebString& message) override;
596 bool runModalPromptDialog(const blink::WebString& message,
597 const blink::WebString& default_value,
598 blink::WebString* actual_value) override;
avi141dbc1322016-03-11 22:27:42599 bool runModalBeforeUnloadDialog(bool is_reload) override;
naskoada75b22016-06-11 16:09:46600 bool runFileChooser(
601 const blink::WebFileChooserParams& params,
602 blink::WebFileChooserCompletion* chooser_completion) override;
avi5c77d212015-09-25 20:08:25603 void showContextMenu(const blink::WebContextMenuData& data) override;
brettw8f508f42016-06-20 21:34:21604 void saveImageFromDataURL(const blink::WebString& data_url) override;
avi5c77d212015-09-25 20:08:25605 void willSendRequest(blink::WebLocalFrame* frame,
japhet8489f1b2016-08-24 00:27:59606 blink::WebURLRequest& request) override;
607 void didReceiveResponse(const blink::WebURLResponse& response) override;
avi5c77d212015-09-25 20:08:25608 void didLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46609 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25610 const blink::WebURLResponse& response) override;
611 void didDisplayInsecureContent() override;
612 void didRunInsecureContent(const blink::WebSecurityOrigin& origin,
613 const blink::WebURL& target) override;
estark910b4572015-12-09 20:55:41614 void didDisplayContentWithCertificateErrors(
jamc94a7532016-09-07 19:40:29615 const blink::WebURL& url) override;
616 void didRunContentWithCertificateErrors(const blink::WebURL& url) override;
avi5c77d212015-09-25 20:08:25617 void didChangePerformanceTiming() override;
csharrisonae811ab2016-04-11 11:32:25618 void didObserveLoadingBehavior(
619 blink::WebLoadingBehaviorFlag behavior) override;
avi5c77d212015-09-25 20:08:25620 void didCreateScriptContext(blink::WebLocalFrame* frame,
621 v8::Local<v8::Context> context,
avi5c77d212015-09-25 20:08:25622 int world_id) override;
623 void willReleaseScriptContext(blink::WebLocalFrame* frame,
624 v8::Local<v8::Context> context,
625 int world_id) override;
626 void didChangeScrollOffset(blink::WebLocalFrame* frame) override;
627 void willInsertBody(blink::WebLocalFrame* frame) override;
628 void reportFindInPageMatchCount(int request_id,
629 int count,
630 bool final_update) override;
631 void reportFindInPageSelection(int request_id,
632 int active_match_ordinal,
633 const blink::WebRect& sel) override;
avif0d894852016-02-17 17:49:12634 void requestStorageQuota(blink::WebStorageQuotaType type,
avi5c77d212015-09-25 20:08:25635 unsigned long long requested_size,
636 blink::WebStorageQuotaCallbacks callbacks) override;
avi5c77d212015-09-25 20:08:25637 blink::WebPushClient* pushClient() override;
638 blink::WebPresentationClient* presentationClient() override;
639 void willStartUsingPeerConnectionHandler(
avi5c77d212015-09-25 20:08:25640 blink::WebRTCPeerConnectionHandler* handler) override;
641 blink::WebUserMediaClient* userMediaClient() override;
642 blink::WebEncryptedMediaClient* encryptedMediaClient() override;
avif0d894852016-02-17 17:49:12643 blink::WebString userAgentOverride() override;
644 blink::WebString doNotTrackValue() override;
645 bool allowWebGL(bool default_value) override;
avi5c77d212015-09-25 20:08:25646 blink::WebScreenOrientationClient* webScreenOrientationClient() override;
647 bool isControlledByServiceWorker(blink::WebDataSource& data_source) override;
648 int64_t serviceWorkerID(blink::WebDataSource& data_source) override;
649 void postAccessibilityEvent(const blink::WebAXObject& obj,
650 blink::WebAXEvent event) override;
651 void handleAccessibilityFindInPageResult(
652 int identifier,
653 int match_index,
654 const blink::WebAXObject& start_object,
655 int start_offset,
656 const blink::WebAXObject& end_object,
657 int end_offset) override;
avi1008732f2016-02-17 17:28:49658 void didChangeManifest() override;
foolip73101372016-07-13 08:19:22659 void enterFullscreen() override;
660 void exitFullscreen() override;
avi5c77d212015-09-25 20:08:25661 void registerProtocolHandler(const blink::WebString& scheme,
662 const blink::WebURL& url,
663 const blink::WebString& title) override;
664 void unregisterProtocolHandler(const blink::WebString& scheme,
665 const blink::WebURL& url) override;
guidou3906a722015-11-12 22:14:42666 void checkIfAudioSinkExistsAndIsAuthorized(
667 const blink::WebString& sink_id,
668 const blink::WebSecurityOrigin& security_origin,
669 blink::WebSetSinkIdCallbacks* web_callbacks) override;
lfg717154072016-06-30 15:04:16670 blink::WebPageVisibilityState visibilityState() const override;
[email protected]85d85fd2013-06-19 00:57:41671
lukasza902fcc52015-12-31 04:45:29672 // WebFrameSerializerClient implementation:
lukasza2e296c32015-09-28 23:29:48673 void didSerializeDataForFrame(
lukasza2e296c32015-09-28 23:29:48674 const blink::WebCString& data,
lukasza902fcc52015-12-31 04:45:29675 blink::WebFrameSerializerClient::FrameSerializationStatus status)
676 override;
lukasza2e296c32015-09-28 23:29:48677
dominickn6c1f1cf2016-12-20 06:13:33678 // Binds to the site engagement service in the browser.
679 void BindEngagement(blink::mojom::EngagementClientAssociatedRequest request);
680
ben76f52b242016-06-18 05:42:48681 // Binds to the FrameHost in the browser.
dominickn6c1f1cf2016-12-20 06:13:33682 void BindFrame(mojom::FrameRequest request, mojom::FrameHostPtr frame_host);
rockotf8fdd9b2015-12-16 22:22:35683
sammc7f6c6a02017-01-30 00:53:51684 void BindFrameBindingsControl(
685 mojom::FrameBindingsControlAssociatedRequest request);
686
mlamouri4fff1992014-09-30 11:22:46687 ManifestManager* manifest_manager();
688
avi0392dbf52015-03-25 16:55:45689 // TODO(creis): Remove when the only caller, the HistoryController, is no
690 // more.
691 void SetPendingNavigationParams(
dchengcedca5612016-04-09 01:40:15692 std::unique_ptr<NavigationParams> navigation_params);
avi0392dbf52015-03-25 16:55:45693
xhwang5206d4e62016-02-05 02:09:55694 media::MediaPermission* GetMediaPermission();
guoweisf4282b02015-09-24 23:05:22695
creis69b184a472015-11-26 05:29:51696 // Sends the current frame's navigation state to the browser.
697 void SendUpdateState();
698
sammce2f99982016-03-14 22:38:12699 // Creates a MojoBindingsController if Mojo bindings have been enabled for
700 // this frame. For WebUI, this allows the page to communicate with the browser
701 // process; for layout tests, this allows the test to mock out services at
702 // the Mojo IPC layer.
703 void MaybeEnableMojoBindings();
jsbell14785d902016-10-26 21:37:26704 // Adds the given file chooser request to the file_chooser_completion_ queue
705 // (see that var for more) and requests the chooser be displayed if there are
706 // no other waiting items in the queue.
707 //
708 // Returns true if the chooser was successfully scheduled. False means we
709 // didn't schedule anything.
710 bool ScheduleFileChooser(const FileChooserParams& params,
711 blink::WebFileChooserCompletion* completion);
nasko1fa0fb62015-12-09 01:49:57712
lfge0c2792ec2016-05-11 18:52:08713 // Plugin-related functions --------------------------------------------------
714
brettw4b461082016-11-19 18:55:16715#if BUILDFLAG(ENABLE_PLUGINS)
lfge0c2792ec2016-05-11 18:52:08716 PepperPluginInstanceImpl* focused_pepper_plugin() {
717 return focused_pepper_plugin_;
718 }
719 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
720 return pepper_last_mouse_event_target_;
721 }
722 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
723 pepper_last_mouse_event_target_ = plugin;
724 }
725
726 // Indicates that the given instance has been created.
727 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
728
729 // Indicates that the given instance is being destroyed. This is called from
730 // the destructor, so it's important that the instance is not dereferenced
731 // from this call.
732 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
733
734 // Notification that the given plugin is focused or unfocused.
735 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
zqzhangc885f6b2016-06-23 19:44:46736
737 void PepperStartsPlayback(PepperPluginInstanceImpl* instance);
738 void PepperStopsPlayback(PepperPluginInstanceImpl* instance);
739 void OnSetPepperVolume(int32_t pp_instance, double volume);
lfge0c2792ec2016-05-11 18:52:08740#endif // ENABLE_PLUGINS
741
[email protected]2f61bdd2013-07-02 18:38:47742 protected:
jochen664198b2015-06-25 14:13:00743 explicit RenderFrameImpl(const CreateParams& params);
[email protected]2f61bdd2013-07-02 18:38:47744
[email protected]227692c52013-05-31 22:43:04745 private:
kenrbf98a4d22015-04-01 21:59:35746 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26747 friend class RenderFrameObserver;
dmazzoni8e6fe4d2016-06-27 06:35:37748 friend class RenderAccessibilityImplTest;
clamy98a9dee02015-06-24 16:09:10749 friend class TestRenderFrame;
avi485e5fd62014-08-25 23:26:14750 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuDisplayNoneTest, SelectItem);
751 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuRemoveTest, RemoveOnChange);
752 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, NormalCase);
753 FRIEND_TEST_ALL_PREFIXES(ExternalPopupMenuTest, ShowPopupThenNavigate);
dmazzoni8e6fe4d2016-06-27 06:35:37754 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
[email protected]66bbadaf2014-03-28 16:25:54755 AccessibilityMessagesQueueWhileSwappedOut);
scottmg276753cf2016-10-27 18:25:22756 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, ZoomLimit);
[email protected]2e2d9632013-12-03 00:55:26757
twellington376424ad2015-05-04 18:57:25758 // A wrapper class used as the callback for JavaScript executed
759 // in an isolated world.
760 class JavaScriptIsolatedWorldRequest
761 : public blink::WebScriptExecutionCallback {
762 public:
763 JavaScriptIsolatedWorldRequest(
764 int id,
765 bool notify_result,
766 int routing_id,
767 base::WeakPtr<RenderFrameImpl> render_frame_impl);
768 void completed(
769 const blink::WebVector<v8::Local<v8::Value>>& result) override;
770
771 private:
avi5c77d212015-09-25 20:08:25772 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25773
774 int id_;
775 bool notify_result_;
776 int routing_id_;
777 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
778
779 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
780 };
781
[email protected]37567b432014-02-12 01:12:22782 typedef std::map<GURL, double> HostZoomLevels;
dominickn89fba272017-01-19 00:40:46783 typedef std::pair<url::Origin, blink::mojom::EngagementLevel>
784 EngagementOriginAndLevel;
[email protected]37567b432014-02-12 01:12:22785
dchengc5ef1a52015-08-26 20:58:30786 // Creates a new RenderFrame. |render_view| is the RenderView object that this
787 // frame belongs to.
ddorwinf63505e2016-01-08 00:54:50788 // Callers *must* call |BindToWebFrame| immediately after creation.
avi1023d012015-12-25 02:39:14789 static RenderFrameImpl* Create(RenderViewImpl* render_view,
790 int32_t routing_id);
dchengc5ef1a52015-08-26 20:58:30791
ddorwinf63505e2016-01-08 00:54:50792 // This is called right after creation with the WebLocalFrame for this
793 // RenderFrame. It must be called before Initialize.
794 void BindToWebFrame(blink::WebLocalFrame* web_frame);
795
[email protected]2e2d9632013-12-03 00:55:26796 // Functions to add and remove observers for this object.
797 void AddObserver(RenderFrameObserver* observer);
798 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34799
dcheng3d886b732015-11-05 19:16:01800 bool IsLocalRoot() const;
csharrison12975f12016-12-08 18:54:17801 const RenderFrameImpl* GetLocalRoot() const;
dcheng3d886b732015-11-05 19:16:01802
[email protected]f0906a02014-08-07 07:18:55803 // Builds and sends DidCommitProvisionalLoad to the host.
avi8c46f7e2015-02-03 18:27:35804 void SendDidCommitProvisionalLoad(blink::WebFrame* frame,
creis8b5cd4c2015-06-19 00:11:08805 blink::WebHistoryCommitType commit_type,
806 const blink::WebHistoryItem& item);
[email protected]37567b432014-02-12 01:12:22807
alexmosf65a795a2017-01-12 22:04:00808 // Swaps the current frame into the frame tree, replacing the
809 // RenderFrameProxy it is associated with. Return value indicates whether
810 // the swap operation succeeded. This should only be used for provisional
811 // frames associated with a proxy, while the proxy is still in the frame
812 // tree. If the associated proxy has been detached before this is called,
813 // this returns false and aborts the swap.
814 bool SwapIn();
815
[email protected]b70da4c2014-01-06 19:57:09816 // IPC message handlers ------------------------------------------------------
817 //
818 // The documentation for these functions should be in
819 // content/common/*_messages.h for the message that the function is handling.
clamy98a9dee02015-06-24 16:09:10820 void OnNavigate(const CommonNavigationParams& common_params,
821 const StartNavigationParams& start_params,
822 const RequestNavigationParams& request_params);
clamybfd6a812016-05-30 16:25:17823 void OnBeforeUnload(bool is_reload);
alexmosf65a795a2017-01-12 22:04:00824 void OnSwapIn();
alexmosbc7eafa2014-12-06 01:38:09825 void OnSwapOut(int proxy_routing_id,
nasko3e8c20e2014-12-18 06:54:56826 bool is_loading,
alexmosbc7eafa2014-12-06 01:38:09827 const FrameReplicationState& replicated_frame_state);
naskoeab5c5582015-12-15 05:20:00828 void OnDeleteFrame();
Nasko Oskov85f60222014-08-28 22:53:30829 void OnStop();
[email protected]a09d53ce2014-01-31 00:46:42830 void OnShowContextMenu(const gfx::Point& location);
831 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
832 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
833 unsigned action);
[email protected]4ee64622014-03-21 22:34:15834 void OnUndo();
835 void OnRedo();
[email protected]9c9343b2014-03-08 02:56:07836 void OnCut();
837 void OnCopy();
838 void OnPaste();
[email protected]4ee64622014-03-21 22:34:15839 void OnPasteAndMatchStyle();
840 void OnDelete();
841 void OnSelectAll();
christiankaeed9862014-11-05 10:49:14842 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
aurimasab0319022015-07-10 21:57:38843 void OnAdjustSelectionByCharacterOffset(int start_adjust, int end_adjust);
[email protected]4ee64622014-03-21 22:34:15844 void OnUnselect();
christiankaeed9862014-11-05 10:49:14845 void OnMoveRangeSelectionExtent(const gfx::Point& point);
[email protected]1f3fc1d2014-04-03 14:50:17846 void OnReplace(const base::string16& text);
847 void OnReplaceMisspelling(const base::string16& text);
brettw8f508f42016-06-20 21:34:21848 void OnCopyImageAt(int x, int y);
849 void OnSaveImageAt(int x, int y);
peter4eb242002015-06-02 12:45:13850 void OnAddMessageToConsole(ConsoleMessageLevel level,
851 const std::string& message);
[email protected]f13ab892014-03-12 06:48:52852 void OnJavaScriptExecuteRequest(const base::string16& javascript,
853 int id,
854 bool notify_result);
zeeshanq3454e9c2014-09-04 21:30:28855 void OnJavaScriptExecuteRequestForTests(const base::string16& javascript,
856 int id,
jochen2e7d95b2015-05-04 15:28:50857 bool notify_result,
858 bool has_user_gesture);
twellington376424ad2015-05-04 18:57:25859 void OnJavaScriptExecuteRequestInIsolatedWorld(const base::string16& jscript,
860 int id,
861 bool notify_result,
862 int world_id);
avi1023d012015-12-25 02:39:14863 void OnVisualStateRequest(uint64_t key);
[email protected]4ee64622014-03-21 22:34:15864 void OnSetEditableSelectionOffsets(int start, int end);
[email protected]e5e438d62014-03-27 21:47:16865 void OnSetCompositionFromExistingText(
866 int start, int end,
867 const std::vector<blink::WebCompositionUnderline>& underlines);
sammcbc9e99332014-12-18 00:55:24868 void OnExecuteNoValueEditCommand(const std::string& name);
[email protected]e5e438d62014-03-27 21:47:16869 void OnExtendSelectionAndDelete(int before, int after);
yabinh90f1be12016-10-14 03:04:39870 void OnDeleteSurroundingText(int before, int after);
toyoshim24a4c7ab2016-04-05 09:24:14871 void OnReload(bool bypass_cache);
megjablon3f5941072016-02-04 23:27:52872 void OnReloadLoFiImages();
jam973236102016-02-09 00:47:05873 void OnTextSurroundingSelectionRequest(uint32_t max_length);
dpranke32d4b3a472016-11-21 17:45:37874 void OnFocusedFormFieldDataRequest(int request_id);
[email protected]95640212014-07-26 18:14:30875 void OnSetAccessibilityMode(AccessibilityMode new_mode);
dmazzoni83ba5c82015-04-14 07:11:51876 void OnSnapshotAccessibilityTree(int callback_id);
aeliasa3d72e62017-02-08 00:27:56877 void OnExtractSmartClipData(uint32_t callback_id, const gfx::Rect& rect);
alexmos95733002015-08-24 16:38:09878 void OnUpdateOpener(int opener_routing_id);
dcheng5f60abb2015-05-28 01:39:36879 void OnDidUpdateSandboxFlags(blink::WebSandboxFlags flags);
lazyboy70605c32015-11-03 01:27:31880 void OnSetFrameOwnerProperties(
raymesbba82b32016-07-19 00:41:38881 const FrameOwnerProperties& frame_owner_properties);
alexmos401f0aba2015-12-06 10:07:39882 void OnAdvanceFocus(blink::WebFocusType type, int32_t source_routing_id);
alexmos5357efb2015-12-16 21:44:00883 void OnSetFocusedFrame();
dspelle736c9db2015-04-03 04:53:16884 void OnTextTrackSettingsChanged(
885 const FrameMsg_TextTrackSettings_Params& params);
alexmose7da5a12015-04-09 02:22:16886 void OnPostMessageEvent(const FrameMsg_PostMessage_Params& params);
davidbena5496d62014-10-07 18:52:04887 void OnCommitNavigation(const ResourceResponseHead& response,
888 const GURL& stream_url,
clamy9bfeef42014-09-30 20:50:42889 const CommonNavigationParams& common_params,
lukaszad04640f2016-05-25 17:08:44890 const RequestNavigationParams& request_params);
clamy62b271d2015-04-16 11:54:57891 void OnFailedNavigation(const CommonNavigationParams& common_params,
892 const RequestNavigationParams& request_params,
893 bool has_stale_copy_in_cache,
894 int error_code);
lukasza6af746b72015-09-18 23:37:22895 void OnGetSavableResourceLinks();
lukasza2e296c32015-09-28 23:29:48896 void OnGetSerializedHtmlWithLocalLinks(
lukasza777a7dd2016-01-25 23:55:47897 const std::map<GURL, base::FilePath>& url_to_local_path,
898 const std::map<int, base::FilePath>& frame_routing_id_to_local_path);
lukaszaede9cc02015-12-30 23:48:32899 void OnSerializeAsMHTML(const FrameMsg_SerializeAsMHTML_Params& params);
paulmeyer5d0a5f02016-01-21 20:15:52900 void OnFind(int request_id,
901 const base::string16& search_text,
902 const blink::WebFindOptions& options);
paulmeyerc8cb7cb2016-06-07 01:14:19903 void OnClearActiveFindMatch();
paulmeyer5d0a5f02016-01-21 20:15:52904 void OnStopFinding(StopFindAction action);
clamy91b7abf2016-03-24 15:17:45905 void OnEnableViewSourceMode();
avi6b8dbb32016-04-08 18:59:35906 void OnSuppressFurtherDialogs();
naskoada75b22016-06-11 16:09:46907 void OnFileChooserResponse(
908 const std::vector<content::FileChooserFileInfo>& files);
ekaramada110f642016-12-21 19:47:28909 void OnClearFocusedElement();
paulmeyer5d0a5f02016-01-21 20:15:52910#if defined(OS_ANDROID)
911 void OnActivateNearestFindResult(int request_id, float x, float y);
paulmeyerc8cb7cb2016-06-07 01:14:19912 void OnGetNearestFindResult(int request_id, float x, float y);
paulmeyer5d0a5f02016-01-21 20:15:52913 void OnFindMatchRects(int current_version);
haibinluc643d33c2016-06-03 02:22:34914#endif
915
916#if defined(USE_EXTERNAL_POPUP_MENU)
917#if defined(OS_MACOSX)
918 void OnSelectPopupMenuItem(int selected_index);
919#else
paulmeyer5d0a5f02016-01-21 20:15:52920 void OnSelectPopupMenuItems(bool canceled,
921 const std::vector<int>& selected_indices);
haibinluc643d33c2016-06-03 02:22:34922#endif
923#endif
924
925#if defined(OS_MACOSX)
paulmeyer5d0a5f02016-01-21 20:15:52926 void OnCopyToFindPboard();
927#endif
clamy9bfeef42014-09-30 20:50:42928
carlosk27fa0652016-10-05 23:10:36929 // Callback scheduled from OnSerializeAsMHTML for when writing serialized
930 // MHTML to file has been completed in the file thread.
931 void OnWriteMHTMLToDiskComplete(
932 int job_id,
933 std::set<std::string> serialized_resources_uri_digests,
934 base::TimeDelta main_thread_use_time,
carlosk29da4fe2016-11-29 00:01:29935 MhtmlSaveStatus save_status);
carlosk27fa0652016-10-05 23:10:36936
creise18ce072015-12-02 02:00:02937 // Requests that the browser process navigates to |url|. If
938 // |is_history_navigation_in_new_child| is true, the browser process should
939 // look for a matching FrameNavigationEntry in the last committed entry to use
940 // instead of |url|.
lukaszabb2101b82016-06-17 16:52:25941 void OpenURL(
942 const GURL& url,
943 bool uses_post,
944 const scoped_refptr<ResourceRequestBodyImpl>& resource_request_body,
lukasza4a07d3a2016-10-19 21:03:22945 const std::string& extra_headers,
lukaszabb2101b82016-06-17 16:52:25946 const Referrer& referrer,
947 blink::WebNavigationPolicy policy,
948 bool should_replace_current_entry,
949 bool is_history_navigation_in_new_child);
[email protected]a09d53ce2014-01-31 00:46:42950
clamyd6983032015-04-29 14:48:12951 // Performs a navigation in the frame. This provides a unified function for
952 // the current code path and the browser-side navigation path (in
953 // development). Currently used by OnNavigate, with all *NavigationParams
954 // provided by the browser. |stream_params| should be null.
955 // PlzNavigate: used by OnCommitNavigation, with |common_params| and
956 // |request_params| received by the browser. |stream_params| should be non
957 // null and created from the information provided by the browser.
958 // |start_params| is not used.
dchengcedca5612016-04-09 01:40:15959 void NavigateInternal(
960 const CommonNavigationParams& common_params,
961 const StartNavigationParams& start_params,
962 const RequestNavigationParams& request_params,
lukaszad04640f2016-05-25 17:08:44963 std::unique_ptr<StreamOverrideParameters> stream_params);
clamyd6983032015-04-29 14:48:12964
[email protected]ef3adfc2014-05-11 00:04:54965 // Update current main frame's encoding and send it to browser window.
966 // Since we want to let users see the right encoding info from menu
967 // before finishing loading, we call the UpdateEncoding in
968 // a) function:DidCommitLoadForFrame. When this function is called,
969 // that means we have got first data. In here we try to get encoding
970 // of page if it has been specified in http header.
971 // b) function:DidReceiveTitle. When this function is called,
972 // that means we have got specified title. Because in most of webpages,
973 // title tags will follow meta tags. In here we try to get encoding of
974 // page if it has been specified in meta tag.
975 // c) function:DidFinishDocumentLoadForFrame. When this function is
976 // called, that means we have got whole html page. In here we should
977 // finally get right encoding of page.
978 void UpdateEncoding(blink::WebFrame* frame,
979 const std::string& encoding_name);
980
[email protected]4ee64622014-03-21 22:34:15981 // Dispatches the current state of selection on the webpage to the browser if
982 // it has changed.
983 // TODO(varunjain): delete this method once we figure out how to keep
984 // selection handles in sync with the webpage.
985 void SyncSelectionIfRequired();
986
avi777ff452017-02-09 19:04:48987 bool RunJavaScriptDialog(JavaScriptDialogType type,
988 const base::string16& message,
989 const base::string16& default_value,
990 const GURL& frame_url,
991 base::string16* result);
[email protected]87de04b02014-04-08 22:14:49992
[email protected]457736d2014-04-30 15:54:27993 // Loads the appropriate error page for the specified failure into the frame.
yzshen0424e6952016-09-06 16:48:58994 // |entry| is only used by PlzNavigate when navigating to a history item.
[email protected]457736d2014-04-30 15:54:27995 void LoadNavigationErrorPage(const blink::WebURLRequest& failed_request,
996 const blink::WebURLError& error,
yzshen0424e6952016-09-06 16:48:58997 bool replace,
998 HistoryEntry* entry);
[email protected]457736d2014-04-30 15:54:27999
zeeshanq3454e9c2014-09-04 21:30:281000 void HandleJavascriptExecutionResult(const base::string16& javascript,
1001 int id,
1002 bool notify_result,
deepak.s750d68f2015-04-30 07:32:411003 v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:281004
[email protected]977db4a42014-07-17 08:04:321005 // Initializes |web_user_media_client_|. If this fails, because it wasn't
1006 // possible to create a MediaStreamClient (e.g., WebRTC is disabled), then
1007 // |web_user_media_client_| will remain NULL.
1008 void InitializeUserMediaClient();
[email protected]96307312014-05-04 01:00:191009
1010 blink::WebMediaPlayer* CreateWebMediaPlayerForMediaStream(
guidou9c3cc3e2015-10-27 13:38:151011 blink::WebMediaPlayerClient* client,
1012 const blink::WebString& sink_id,
1013 const blink::WebSecurityOrigin& security_origin);
[email protected]96307312014-05-04 01:00:191014
[email protected]ae2477e2014-05-27 23:47:081015 // Creates a factory object used for creating audio and video renderers.
dchengcedca5612016-04-09 01:40:151016 std::unique_ptr<MediaStreamRendererFactory> CreateRendererFactory();
[email protected]ae2477e2014-05-27 23:47:081017
avi5cad4912015-06-19 05:25:441018 // Does preparation for the navigation to |url|.
1019 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:251020 const GURL& url,
toyoshimf3f7f682016-04-08 07:47:481021 const RequestNavigationParams& request_params);
clamyda97e8322014-10-07 21:57:251022
clamyece38882014-11-19 15:00:201023 // PlzNavigate
arthursonzogni69824eb2016-07-13 16:22:031024 // Sends a FrameHostMsg_BeginNavigation to the browser
1025 void BeginNavigation(const NavigationPolicyInfo& info);
clamyece38882014-11-19 15:00:201026
clamy4cc9b8202015-03-02 13:51:361027 // Loads a data url.
1028 void LoadDataURL(const CommonNavigationParams& params,
mnaganovbf087422015-12-16 05:10:031029 const RequestNavigationParams& request_params,
clamy0f4ccc82016-02-24 12:43:531030 blink::WebLocalFrame* frame,
1031 blink::WebFrameLoadType load_type,
1032 blink::WebHistoryItem item_for_history_navigation,
1033 blink::WebHistoryLoadType history_load_type,
1034 bool is_client_redirect);
clamy4cc9b8202015-03-02 13:51:361035
clamy62b271d2015-04-16 11:54:571036 // Sends a proper FrameHostMsg_DidFailProvisionalLoadWithError_Params IPC for
1037 // the failed request |request|.
1038 void SendFailedProvisionalLoad(const blink::WebURLRequest& request,
1039 const blink::WebURLError& error,
1040 blink::WebLocalFrame* frame);
1041
1042 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
1043 const GURL& unreachable_url);
1044
[email protected]f3a95312014-06-12 16:46:581045 // Returns the URL being loaded by the |frame_|'s request.
1046 GURL GetLoadingUrl() const;
1047
avi0392dbf52015-03-25 16:55:451048 // If we initiated a navigation, this function will populate |document_state|
1049 // with the navigation information saved in OnNavigate().
1050 void PopulateDocumentStateFromPending(DocumentState* document_state);
1051
1052 // Returns a new NavigationState populated with the navigation information
1053 // saved in OnNavigate().
1054 NavigationState* CreateNavigationStateFromPending();
1055
csharrison1ce0e852015-11-07 16:45:131056 // Sets the NavigationState on the DocumentState based on
1057 // the value of |pending_navigation_params_|.
boliuac512fd2016-03-16 23:33:351058 void UpdateNavigationState(DocumentState* document_state,
avi68a109ab2016-05-15 01:46:321059 bool was_within_same_page,
1060 bool content_initiated);
csharrison1ce0e852015-11-07 16:45:131061
[email protected]96307312014-05-04 01:00:191062#if defined(OS_ANDROID)
[email protected]65f3d1aa2014-05-29 01:57:001063 RendererMediaPlayerManager* GetMediaPlayerManager();
[email protected]4b556cf2014-06-10 23:21:531064#endif
1065
sandersd02d9aea2015-05-12 02:29:261066 bool AreSecureCodecsSupported();
xhwang33f939e2015-06-23 04:33:421067
xhwange70b7ee12015-06-25 09:17:171068#if defined(ENABLE_MOJO_MEDIA)
rockot400ea35b2016-10-15 19:15:321069 service_manager::mojom::InterfaceProvider* GetMediaInterfaceProvider();
xhwang33f939e2015-06-23 04:33:421070#endif
1071
xjzd3fe45a2016-10-12 18:26:371072#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
miu1ddf18c62016-09-24 01:39:411073 media::mojom::RemoterFactory* GetRemoterFactory();
xjzd3fe45a2016-10-12 18:26:371074#endif
1075
xhwangd7180832015-04-03 05:38:151076 media::CdmFactory* GetCdmFactory();
xhwang409e53552016-02-23 00:52:441077 media::DecoderFactory* GetDecoderFactory();
[email protected]96307312014-05-04 01:00:191078
brettw4b461082016-11-19 18:55:161079#if BUILDFLAG(ENABLE_PLUGINS)
dominicknf7d1f952016-11-19 01:52:091080 void HandlePepperImeCommit(const base::string16& text);
1081#endif // ENABLE_PLUGINS
1082
ben155ecf82016-06-21 22:43:261083 void RegisterMojoInterfaces();
halton.huoca2eabd2015-07-06 08:17:401084
xhwang6bca21e2016-02-06 00:21:451085 // Connect to an interface provided by the service registry.
1086 template <typename Interface>
bene3bc9022016-02-10 17:38:241087 void GetInterface(mojo::InterfaceRequest<Interface> request);
xhwang6bca21e2016-02-06 00:21:451088
scottmg276753cf2016-10-27 18:25:221089 void OnHostZoomClientRequest(mojom::HostZoomAssociatedRequest request);
1090
dalecurtisa12e6062015-11-10 23:13:141091 // Returns the media delegate for WebMediaPlayer usage. If
1092 // |media_player_delegate_| is NULL, one is created.
1093 media::RendererWebMediaPlayerDelegate* GetWebMediaPlayerDelegate();
1094
paulmeyer5d0a5f02016-01-21 20:15:521095 // Called to get the WebPlugin to handle find requests in the document.
1096 // Returns nullptr if there is no such WebPlugin.
1097 blink::WebPlugin* GetWebPluginForFind();
1098
1099 // Sends a reply to the current find operation handling if it was a
1100 // synchronous find request.
1101 void SendFindReply(int request_id,
1102 int match_count,
1103 int ordinal,
1104 const blink::WebRect& selection_rect,
1105 bool final_status_update);
1106
skyostilb4cce1b2016-03-31 17:56:341107 void InitializeBlameContext(RenderFrameImpl* parent_frame);
1108
creiscfaa4462015-03-16 19:27:181109 // Stores the WebLocalFrame we are associated with. This is null from the
ddorwinf63505e2016-01-08 00:54:501110 // constructor until BindToWebFrame is called, and it is null after
creiscfaa4462015-03-16 19:27:181111 // frameDetached is called until destruction (which is asynchronous in the
1112 // case of the main frame, but not subframes).
[email protected]35b2a972014-04-04 15:50:221113 blink::WebLocalFrame* frame_;
[email protected]b70da4c2014-01-06 19:57:091114
dglazkov2e140f52015-09-28 16:10:071115 // Boolean value indicating whether this RenderFrameImpl object is for the
1116 // main frame or not. It remains accurate during destruction, even when
1117 // |frame_| has been invalidated.
1118 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:191119
naskoeab5c5582015-12-15 05:20:001120 // When a frame is detached in response to a message from the browser process,
1121 // this RenderFrame should not be sending notifications back to it. This
1122 // boolean is used to indicate this case.
1123 bool in_browser_initiated_detach_;
1124
1125 // Indicates whether the frame has been inserted into the frame tree yet or
1126 // not.
1127 //
1128 // When a frame is created by the browser process, it is for a pending
1129 // navigation. In this case, it is not immediately attached to the frame tree
1130 // if there is a RenderFrameProxy for the same frame. It is inserted into the
1131 // frame tree at the time the pending navigation commits.
1132 // Frames added by the parent document are created from the renderer process
1133 // and are immediately inserted in the frame tree.
1134 // TODO(dcheng): Remove this once we have FrameTreeHandle and can use the
1135 // Blink Web* layer to check for provisional frames.
1136 bool in_frame_tree_;
1137
wjmaclean2a6cab72016-11-03 18:36:401138 RenderViewImpl* render_view_;
[email protected]227692c52013-05-31 22:43:041139 int routing_id_;
nasko8b9d9bd2015-05-06 19:23:191140
japhete6adf142014-10-31 00:01:491141 // If this frame was created to replace a proxy, this will store the routing
1142 // id of the proxy to replace at commit-time, at which time it will be
1143 // cleared.
1144 // TODO(creis): Remove this after switching to PlzNavigate.
1145 int proxy_routing_id_;
1146
dcheng3d886b732015-11-05 19:16:011147 // Non-null when the RenderFrame is a local root for compositing, input,
1148 // layout, etc. A local frame is also a local root iff it does not have a
1149 // parent that is a local frame.
kenrba7199832015-01-22 23:44:591150 scoped_refptr<RenderWidget> render_widget_;
1151
avi0392dbf52015-03-25 16:55:451152 // Temporarily holds state pertaining to a navigation that has been initiated
1153 // until the NavigationState corresponding to the new navigation is created in
1154 // didCreateDataSource().
dchengcedca5612016-04-09 01:40:151155 std::unique_ptr<NavigationParams> pending_navigation_params_;
avi0392dbf52015-03-25 16:55:451156
creisc8ca51e2016-09-29 23:10:281157 // Keeps track of which future subframes the browser process has history items
Charles Reis37c95492016-10-21 20:38:581158 // for during a history navigation, as well as whether those items are for
1159 // about:blank. The renderer process should ask the browser for history items
1160 // when subframes with these names are created (as long as they are not
1161 // staying at about:blank), and directly load the initial URLs for any other
1162 // subframes.
1163 //
1164 // This state is incrementally cleared as it is used and then reset in
1165 // didStopLoading, since it is not needed after the first load completes and
1166 // is never used after the initial navigation.
creisc8ca51e2016-09-29 23:10:281167 // TODO(creis): Expand this to include any corresponding same-process
1168 // PageStates for the whole subtree in https://crbug.com/639842.
Charles Reis37c95492016-10-21 20:38:581169 std::map<std::string, bool> history_subframe_unique_names_;
creis45b3bba2016-09-22 22:47:131170
creis8eb8ef22015-11-04 22:51:381171 // Stores the current history item for this frame, so that updates to it can
1172 // be reported to the browser process via SendUpdateState.
1173 blink::WebHistoryItem current_history_item_;
1174
brettw4b461082016-11-19 18:55:161175#if BUILDFLAG(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:021176 // Current text input composition text. Empty if no composition is in
1177 // progress.
[email protected]fcf75d42013-12-03 20:11:261178 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:091179
tommycli59bd86c2014-12-10 02:09:381180 PluginPowerSaverHelper* plugin_power_saver_helper_;
paulmeyer5d0a5f02016-01-21 20:15:521181
1182 PepperPluginInstanceImpl* plugin_find_handler_;
[email protected]7a4e2532013-12-02 21:30:021183#endif
1184
[email protected]f3add922013-12-20 23:17:161185 RendererWebCookieJarImpl cookie_jar_;
1186
[email protected]2e2d9632013-12-03 00:55:261187 // All the registered observers.
brettw236d3172015-06-03 16:31:431188 base::ObserverList<RenderFrameObserver> observers_;
[email protected]2e2d9632013-12-03 00:55:261189
[email protected]bffc8302014-01-23 20:52:161190 scoped_refptr<ChildFrameCompositingHelper> compositing_helper_;
1191
[email protected]a09d53ce2014-01-31 00:46:421192 // External context menu requests we're waiting for. "Internal"
1193 // (WebKit-originated) context menu events will have an ID of 0 and will not
1194 // be in this map.
1195 //
1196 // We don't want to add internal ones since some of the "special" page
1197 // handlers in the browser process just ignore the context menu requests so
1198 // avoid showing context menus, and so this will cause right clicks to leak
1199 // entries in this map. Most users of the custom context menu (e.g. Pepper
1200 // plugins) are normally only on "regular" pages and the regular pages will
1201 // always respond properly to the request, so we don't have to worry so
1202 // much about leaks.
rlandayde24c6d2016-12-01 03:05:401203 IDMap<ContextMenuClient*> pending_context_menus_;
[email protected]a09d53ce2014-01-31 00:46:421204
[email protected]4ee64622014-03-21 22:34:151205 // The text selection the last time DidChangeSelection got called. May contain
1206 // additional characters before and after the selected text, for IMEs. The
1207 // portion of this string that is the actual selected text starts at index
1208 // |selection_range_.GetMin() - selection_text_offset_| and has length
1209 // |selection_range_.length()|.
1210 base::string16 selection_text_;
1211 // The offset corresponding to the start of |selection_text_| in the document.
1212 size_t selection_text_offset_;
1213 // Range over the document corresponding to the actual selected text (which
1214 // could correspond to a substring of |selection_text_|; see above).
1215 gfx::Range selection_range_;
1216 // Used to inform didChangeSelection() when it is called in the context
1217 // of handling a InputMsg_SelectRange IPC.
1218 bool handling_select_range_;
1219
[email protected]2626d142014-04-22 17:24:021220 // The next group of objects all implement RenderFrameObserver, so are deleted
1221 // along with the RenderFrame automatically. This is why we just store weak
1222 // references.
1223
[email protected]977db4a42014-07-17 08:04:321224 // Destroyed via the RenderFrameObserver::OnDestruct() mechanism.
perkj1a2d0432014-09-03 13:52:331225 UserMediaClientImpl* web_user_media_client_;
[email protected]96307312014-05-04 01:00:191226
jrummell109c3a602014-12-18 01:08:501227 // EncryptedMediaClient attached to this frame; lazily initialized.
dchengcedca5612016-04-09 01:40:151228 std::unique_ptr<media::WebEncryptedMediaClientImpl>
1229 web_encrypted_media_client_;
jrummell109c3a602014-12-18 01:08:501230
xhwang6bca21e2016-02-06 00:21:451231 // The media permission dispatcher attached to this frame.
dchengcedca5612016-04-09 01:40:151232 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011233
xhwange70b7ee12015-06-25 09:17:171234#if defined(ENABLE_MOJO_MEDIA)
xhwanga5967e552016-02-26 00:54:081235 // The media interface provider attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151236 std::unique_ptr<MediaInterfaceProvider> media_interface_provider_;
xhwang065b54b2015-06-03 22:25:551237#endif
1238
[email protected]a017938b2014-05-27 21:17:171239#if defined(OS_ANDROID)
davve859f4f92015-11-27 10:16:191240 // Manages all media players and sessions in this render frame for
1241 // communicating with the real media player and sessions in the
1242 // browser process. It's okay to use raw pointers since they're both
1243 // RenderFrameObservers.
[email protected]a017938b2014-05-27 21:17:171244 RendererMediaPlayerManager* media_player_manager_;
[email protected]4b556cf2014-06-10 23:21:531245#endif
1246
watkdee516f2016-02-18 02:22:191247 media::SurfaceManager* media_surface_manager_;
1248
xjzd3fe45a2016-10-12 18:26:371249#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
miu1ddf18c62016-09-24 01:39:411250 // Lazy-bound pointer to the RemoterFactory service in the browser
1251 // process. Always use the GetRemoterFactory() accessor instead of this.
1252 media::mojom::RemoterFactoryPtr remoter_factory_;
miu9f7788e2017-01-25 00:46:091253
xjzdf8ea422016-11-08 22:00:521254 // An observer for the remoting sink availability that is used by
1255 // media::RemotingCdmFactory to initialize media::RemotingSourceImpl. Created
1256 // in the constructor of RenderFrameImpl to make sure
1257 // media::RemotingSourceImpl be intialized with correct availability info.
1258 // Own by media::RemotingCdmFactory after it is created.
miu9f7788e2017-01-25 00:46:091259 std::unique_ptr<media::remoting::SinkAvailabilityObserver>
1260 remoting_sink_observer_;
xjzd3fe45a2016-10-12 18:26:371261#endif
miu1ddf18c62016-09-24 01:39:411262
xhwang409e53552016-02-23 00:52:441263 // The CDM and decoder factory attached to this frame, lazily initialized.
dchengcedca5612016-04-09 01:40:151264 std::unique_ptr<media::CdmFactory> cdm_factory_;
1265 std::unique_ptr<media::DecoderFactory> decoder_factory_;
xhwangd7180832015-04-03 05:38:151266
hubbe5f0ad43b2015-12-14 20:57:261267 // Media resource cache, lazily initialized.
1268 linked_ptr<media::UrlIndex> url_index_;
1269
dgozman358ba322015-03-26 15:05:301270 // The devtools agent for this frame; only created for main frame and
1271 // local roots.
1272 DevToolsAgent* devtools_agent_;
1273
[email protected]45920862014-07-02 12:53:021274 // The push messaging dispatcher attached to this frame, lazily initialized.
1275 PushMessagingDispatcher* push_messaging_dispatcher_;
1276
avayvodbca35fad2015-01-29 20:20:571277 // The presentation dispatcher implementation attached to this frame, lazily
1278 // initialized.
1279 PresentationDispatcher* presentation_dispatcher_;
1280
rockot400ea35b2016-10-15 19:15:321281 std::unique_ptr<service_manager::InterfaceRegistry> interface_registry_;
1282 std::unique_ptr<service_manager::InterfaceProvider> remote_interfaces_;
ben88716142016-07-30 00:03:031283 std::unique_ptr<BlinkInterfaceProviderImpl> blink_interface_provider_;
sammc7f964632016-10-14 04:16:211284 std::unique_ptr<BlinkInterfaceRegistryImpl> blink_interface_registry_;
rockot400ea35b2016-10-15 19:15:321285 service_manager::mojom::InterfaceProviderRequest
ben155ecf82016-06-21 22:43:261286 pending_remote_interface_provider_request_;
[email protected]c52a1412014-06-25 06:09:251287
ben275a5652016-10-28 16:55:501288 service_manager::ServiceInfo local_info_;
1289 service_manager::ServiceInfo remote_info_;
1290
rockot3860a852016-10-17 04:57:331291 // The Connector proxy used to connect to services.
rockot400ea35b2016-10-15 19:15:321292 service_manager::mojom::ConnectorPtr connector_;
rockotd9260982015-08-21 22:26:301293
[email protected]45920862014-07-02 12:53:021294 // The screen orientation dispatcher attached to the frame, lazily
1295 // initialized.
[email protected]cf78eda2014-06-13 16:57:411296 ScreenOrientationDispatcher* screen_orientation_dispatcher_;
1297
mlamouriefdca9d2014-09-16 16:55:401298 // The Manifest Manager handles the manifest requests from the browser
1299 // process.
1300 ManifestManager* manifest_manager_;
1301
[email protected]95640212014-07-26 18:14:301302 // The current accessibility mode.
1303 AccessibilityMode accessibility_mode_;
1304
1305 // Only valid if |accessibility_mode_| is anything other than
1306 // AccessibilityModeOff.
dmazzoni8e6fe4d2016-06-27 06:35:371307 RenderAccessibilityImpl* render_accessibility_;
[email protected]95640212014-07-26 18:14:301308
dalecurtisa12e6062015-11-10 23:13:141309 // Manages play, pause notifications for WebMediaPlayer implementations; its
1310 // lifetime is tied to the RenderFrame via the RenderFrameObserver interface.
1311 media::RendererWebMediaPlayerDelegate* media_player_delegate_;
1312
megjabloncaf312f2017-01-12 18:47:491313 // The PreviewsState of this RenderFrame that indicates which Previews can
1314 // be used. The PreviewsState is a bitmask of potentially several Previews
1315 // optimizations.
1316 PreviewsState previews_state_;
megjablond5ac7d52015-10-22 23:56:121317
tbansal7b6cf8b2016-05-10 19:27:231318 // Effective connection type when the document of this frame was fetched.
1319 blink::WebEffectiveConnectionType effective_connection_type_;
1320
ellyjonesdb20fae12015-12-04 16:47:551321 // Whether or not this RenderFrame is currently pasting.
1322 bool is_pasting_;
1323
avi6b8dbb32016-04-08 18:59:351324 // Whether we must stop creating nested message loops for modal dialogs. This
1325 // is necessary because modal dialogs have a ScopedPageLoadDeferrer on the
1326 // stack that interferes with swapping out.
1327 bool suppress_further_dialogs_;
1328
naskoada75b22016-06-11 16:09:461329 // The current and pending file chooser completion objects. If the queue is
1330 // nonempty, the first item represents the currently running file chooser
1331 // callback, and the remaining elements are the other file chooser completion
1332 // still waiting to be run (in order).
1333 struct PendingFileChooser;
1334 std::deque<std::unique_ptr<PendingFileChooser>> file_chooser_completions_;
1335
haibinluc643d33c2016-06-03 02:22:341336#if defined(USE_EXTERNAL_POPUP_MENU)
avi485e5fd62014-08-25 23:26:141337 // The external popup for the currently showing select popup.
dchengcedca5612016-04-09 01:40:151338 std::unique_ptr<ExternalPopupMenu> external_popup_menu_;
avi485e5fd62014-08-25 23:26:141339#endif
1340
xiaochengh01c3b102016-06-13 23:56:081341 std::unique_ptr<FrameBlameContext> blame_context_;
nhirokibf6789872016-12-27 05:36:241342 std::unique_ptr<SharedWorkerRepository> shared_worker_repository_;
skyostilb4cce1b2016-03-31 17:56:341343
lfge0c2792ec2016-05-11 18:52:081344 // Plugins -------------------------------------------------------------------
brettw4b461082016-11-19 18:55:161345#if BUILDFLAG(ENABLE_PLUGINS)
lfge0c2792ec2016-05-11 18:52:081346 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1347 PepperPluginSet active_pepper_instances_;
1348
1349 // Whether or not the focus is on a PPAPI plugin
1350 PepperPluginInstanceImpl* focused_pepper_plugin_;
1351
1352 // The plugin instance that received the last mouse event. It is set to NULL
1353 // if the last mouse event went to elements other than Pepper plugins.
1354 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1355 // the RenderFrameImpl to NULL it out when it destructs.
1356 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
1357#endif
1358
scottmg276753cf2016-10-27 18:25:221359 HostZoomLevels host_zoom_levels_;
dominickn89fba272017-01-19 00:40:461360 EngagementOriginAndLevel engagement_level_;
scottmg276753cf2016-10-27 18:25:221361
dominickn6c1f1cf2016-12-20 06:13:331362 mojo::AssociatedBinding<blink::mojom::EngagementClient> engagement_binding_;
ben76f52b242016-06-18 05:42:481363 mojo::Binding<mojom::Frame> frame_binding_;
scottmg276753cf2016-10-27 18:25:221364 mojo::AssociatedBinding<mojom::HostZoom> host_zoom_binding_;
sammc7f6c6a02017-01-30 00:53:511365 mojo::AssociatedBinding<mojom::FrameBindingsControl>
1366 frame_bindings_control_binding_;
ben76f52b242016-06-18 05:42:481367 mojom::FrameHostPtr frame_host_;
1368
ahesteacad602016-08-30 21:25:541369 // Indicates whether |didAccessInitialDocument| was called.
1370 bool has_accessed_initial_document_;
1371
rockotf62002a2016-09-15 00:08:591372 AssociatedInterfaceRegistryImpl associated_interfaces_;
1373 std::unique_ptr<AssociatedInterfaceProviderImpl>
1374 remote_associated_interfaces_;
1375
dcheng77df1082016-10-06 02:54:171376 // TODO(dcheng): Remove these members.
1377 bool committed_first_load_ = false;
1378 bool name_changed_before_first_commit_ = false;
1379
jam485372b12016-10-26 19:46:071380 bool browser_side_navigation_pending_ = false;
1381
sammc7f6c6a02017-01-30 00:53:511382 // A bitwise OR of bindings types that have been enabled for this RenderFrame.
1383 // See BindingsPolicy for details.
1384 int enabled_bindings_ = 0;
1385
[email protected]96307312014-05-04 01:00:191386 base::WeakPtrFactory<RenderFrameImpl> weak_factory_;
1387
[email protected]227692c52013-05-31 22:43:041388 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1389};
1390
1391} // namespace content
1392
[email protected]85d85fd2013-06-19 00:57:411393#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_