blob: 8bd0812eae248d0708a52b6b429d2d61a119e066 [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
Charles Reis37c95492016-10-21 20:38:5811#include <map>
dchengcedca5612016-04-09 01:40:1512#include <memory>
thestige62f7382016-11-08 18:31:3913#include <set>
guidou3906a722015-11-12 22:14:4214#include <string>
Mark Lieu6cf3e8fa2019-03-09 02:09:0115#include <unordered_set>
Balazs Engedyba034e72017-10-27 22:26:2816#include <utility>
[email protected]7a4e2532013-12-02 21:30:0217#include <vector>
18
liberatoa8da3b52017-05-02 20:23:5119#include "base/callback.h"
Brett Wilsonf976d3f2017-08-18 17:23:3920#include "base/containers/id_map.h"
[email protected]7a4e2532013-12-02 21:30:0221#include "base/files/file_path.h"
[email protected]a09d53ce2014-01-31 00:46:4222#include "base/gtest_prod_util.h"
avi1023d012015-12-25 02:39:1423#include "base/macros.h"
lukaszabb2101b82016-06-17 16:52:2524#include "base/memory/ref_counted.h"
[email protected]abc501e2014-01-27 19:27:2625#include "base/memory/weak_ptr.h"
[email protected]2e2d9632013-12-03 00:55:2626#include "base/observer_list.h"
liberatoa8da3b52017-05-02 20:23:5127#include "base/optional.h"
[email protected]7a4e2532013-12-02 21:30:0228#include "base/process/process_handle.h"
altimin06fe10c2017-01-20 11:28:1529#include "base/single_thread_task_runner.h"
liberatoa8da3b52017-05-02 20:23:5130#include "base/unguessable_token.h"
Avi Drissman4544828f2019-03-11 20:37:3231#include "base/values.h"
avi1023d012015-12-25 02:39:1432#include "build/build_config.h"
Scott Violetc78fef732018-03-06 17:42:5333#include "content/common/buildflags.h"
Mark Lieuc48b6cc2019-03-13 22:55:5734#include "content/common/download/mhtml_file_writer.mojom.h"
ben76f52b242016-06-18 05:42:4835#include "content/common/frame.mojom.h"
danakjf2342432019-05-15 21:46:0936#include "content/common/frame_delete_intention.h"
Lucas Furukawa Gadania9c45682019-07-31 22:05:1437#include "content/common/navigation_params.mojom.h"
Mario Sanchez Prada60a014b72020-02-20 19:08:0638#include "content/common/render_accessibility.mojom.h"
rockot53be7caf2016-10-04 20:17:0839#include "content/common/renderer.mojom.h"
dcheng61b2c9222017-05-25 23:10:1140#include "content/common/unique_name_helper.h"
Miyoung Shin072d4052020-07-13 07:52:4441#include "content/common/web_ui.mojom.h"
Scott Violet0de3837c2019-09-06 22:51:5442#include "content/public/common/browser_controls_state.h"
Adam Parker6a19ba342018-01-08 23:40:2043#include "content/public/common/fullscreen_video_element.mojom.h"
[email protected]65920f332014-03-04 21:14:1844#include "content/public/common/referrer.h"
paulmeyer5d0a5f02016-01-21 20:15:5245#include "content/public/common/stop_find_action.h"
danakj6a816592018-09-25 18:30:5646#include "content/public/common/widget_type.h"
[email protected]227692c52013-05-31 22:43:0447#include "content/public/renderer/render_frame.h"
Sergey Volk8b09c2c52018-12-12 23:20:4048#include "content/public/renderer/render_frame_media_playback_options.h"
Hiroki Nakagawaea68b642018-04-13 06:24:4249#include "content/public/renderer/websocket_handshake_throttle_provider.h"
Andy Paicucd1e4e02018-05-16 09:59:2050#include "content/renderer/content_security_policy_util.h"
skyostilb4cce1b2016-03-31 17:56:3451#include "content/renderer/frame_blame_context.h"
Navid Zolghadre71b8ec82017-12-16 07:03:3652#include "content/renderer/input/input_target_client_impl.h"
Yuzhu Shen0c1715f2018-01-27 03:48:5053#include "content/renderer/loader/child_url_loader_factory_bundle.h"
chcunningham86f025e32017-05-30 20:43:2354#include "content/renderer/media/media_factory.h"
Erik Chen10e9b022019-08-21 23:33:2355#include "content/renderer/render_widget.h"
[email protected]227692c52013-05-31 22:43:0456#include "ipc/ipc_message.h"
lukasza70b79c82015-12-14 20:24:1357#include "ipc/ipc_platform_file.h"
liberatoa8da3b52017-05-02 20:23:5158#include "media/base/routing_token_callback.h"
Evan Liu47f798a2020-06-23 20:27:0959#include "media/base/speech_recognition_client.h"
Shimi Zhangbb738072019-07-09 18:54:4060#include "mojo/public/cpp/bindings/associated_receiver.h"
Mario Sanchez Pradab3b852f2019-10-04 17:53:2461#include "mojo/public/cpp/bindings/associated_remote.h"
Julie Jeongeun Kimed2e5ba72019-09-12 10:14:1762#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
Julie Jeongeun Kim02291d732019-09-07 03:08:5863#include "mojo/public/cpp/bindings/pending_receiver.h"
Miyoung Shin2be9da72019-09-04 09:04:1064#include "mojo/public/cpp/bindings/pending_remote.h"
Henrique Ferreiro3a9751c2019-09-30 13:54:0765#include "mojo/public/cpp/bindings/receiver.h"
Gyuyoung Kim6c9ce9022019-11-26 05:40:0866#include "mojo/public/cpp/bindings/receiver_set.h"
Julie Jeongeun Kim44b804b22019-08-15 06:14:5567#include "mojo/public/cpp/bindings/remote.h"
scottmgefb697302017-04-12 22:37:3068#include "mojo/public/cpp/system/data_pipe.h"
Scott Violet02e38b92018-03-27 23:42:1469#include "ppapi/buildflags/buildflags.h"
Ken Rockot54311e62018-02-10 19:01:5270#include "services/network/public/mojom/url_loader_factory.mojom.h"
Lucas Furukawa Gadania6917ab2019-10-01 17:37:3171#include "services/network/public/mojom/url_response_head.mojom-forward.h"
ben803dba302017-04-27 20:41:4972#include "services/service_manager/public/cpp/binder_registry.h"
Balazs Engedyba034e72017-10-27 22:26:2873#include "services/service_manager/public/cpp/interface_provider.h"
Ken Rockot543f5e32018-02-04 02:13:5074#include "services/service_manager/public/mojom/interface_provider.mojom.h"
Ken Rockot26e4e802018-07-31 15:03:3375#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
76#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
Oksana Zhuravlovafee097c2019-07-26 17:01:3077#include "third_party/blink/public/common/browser_interface_broker_proxy.h"
Blink Reformata30d4232018-04-07 15:31:0678#include "third_party/blink/public/common/feature_policy/feature_policy.h"
Sergio Villar Senin0c142fa2019-10-16 08:18:5979#include "third_party/blink/public/common/loader/loading_behavior_flag.h"
Hiroki Nakagawa41366152020-07-27 18:31:4080#include "third_party/blink/public/common/loader/previews_state.h"
Sergio Villar Senind7f2ee7f2019-10-17 09:02:4181#include "third_party/blink/public/common/navigation/triggering_event_info.h"
Julie Jeongeun Kimdaa631e2019-02-21 14:17:2582#include "third_party/blink/public/mojom/autoplay/autoplay.mojom.h"
Kent Tamura48c549d02018-09-27 17:19:5483#include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h"
Julie Jeongeun Kim42a90df2019-03-20 23:13:1084#include "third_party/blink/public/mojom/commit_result/commit_result.mojom.h"
Abhijeet Kandalkara5928a0a2019-03-13 05:04:4285#include "third_party/blink/public/mojom/devtools/console_message.mojom.h"
Antonio Gomes7096ac02020-02-14 14:29:5486#include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-forward.h"
Richard Lie6899952018-11-30 08:42:0087#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom.h"
Antonio Gomes58d38062020-04-30 01:50:1488#include "third_party/blink/public/mojom/frame/frame_owner_element_type.mojom.h"
Julie Jeongeun Kim70a2e4e2020-02-21 05:09:5489#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-forward.h"
Antonio Gomes4b2c5132020-01-16 11:49:4890#include "third_party/blink/public/mojom/frame/user_activation_update_types.mojom.h"
Miyoung Shinff5aff32020-01-25 04:15:2591#include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h"
Minggang Wangd712a912020-07-10 08:12:3592#include "third_party/blink/public/mojom/loader/resource_load_info.mojom.h"
93#include "third_party/blink/public/mojom/loader/resource_load_info_notifier.mojom.h"
Guido Urdaneta3a7cd9e62020-07-21 08:31:2894#include "third_party/blink/public/mojom/media/renderer_audio_input_stream_factory.mojom.h"
Leon Hanc819dc62019-01-28 04:30:1995#include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
Matt Falkenhagen98515e972018-06-20 08:12:4896#include "third_party/blink/public/mojom/service_worker/service_worker_object.mojom.h"
Majid Valipourb9ee0972019-08-22 15:16:2397#include "third_party/blink/public/mojom/use_counter/css_property_id.mojom.h"
Blink Reformata30d4232018-04-07 15:31:0698#include "third_party/blink/public/platform/web_media_player.h"
Blink Reformata30d4232018-04-07 15:31:0699#include "third_party/blink/public/web/web_ax_object.h"
100#include "third_party/blink/public/web/web_document_loader.h"
Blink Reformata30d4232018-04-07 15:31:06101#include "third_party/blink/public/web/web_frame_load_type.h"
102#include "third_party/blink/public/web/web_frame_serializer_client.h"
103#include "third_party/blink/public/web/web_history_commit_type.h"
Mustaq Ahmed55944cb2018-05-25 20:44:27104#include "third_party/blink/public/web/web_local_frame_client.h"
Blink Reformata30d4232018-04-07 15:31:06105#include "third_party/blink/public/web/web_meaningful_layout.h"
106#include "third_party/blink/public/web/web_script_execution_callback.h"
Nektarios Paisios56ee9982020-04-22 07:53:06107#include "ui/accessibility/ax_event.h"
Dominic Mazzoni90501482018-09-05 22:43:31108#include "ui/accessibility/ax_mode.h"
[email protected]4ee64622014-03-21 22:34:15109#include "ui/gfx/range/range.h"
lukaszaede9cc02015-12-30 23:48:32110#include "url/gurl.h"
dominickn6c1f1cf2016-12-20 06:13:33111#include "url/origin.h"
[email protected]227692c52013-05-31 22:43:04112
brettw4b461082016-11-19 18:55:16113#if BUILDFLAG(ENABLE_PLUGINS)
tommycli59bd86c2014-12-10 02:09:38114#include "content/renderer/pepper/plugin_power_saver_helper.h"
tommyclid481c482014-12-03 01:50:41115#endif
116
dimich6bca00ee2017-03-21 04:54:31117struct FrameMsg_MixedContentFound_Params;
[email protected]7a4e2532013-12-02 21:30:02118
119namespace blink {
Meredith Lane4947b2d72018-01-24 20:54:28120class WebComputedAXTree;
[email protected]82ce5b92014-03-22 05:15:26121class WebContentDecryptionModule;
Ehsan Karamaded879582018-08-08 02:02:29122class WebElement;
Hiroki Nakagawa8600c372020-07-23 01:53:26123class WebFrameRequestBlocker;
lukasza2f44efa2017-06-06 23:49:51124class WebLocalFrame;
Guido Urdanetadc7090372019-07-29 17:59:54125class WebMediaStreamDeviceObserver;
[email protected]82ce5b92014-03-22 05:15:26126class WebSecurityOrigin;
Ehsan Karamaded879582018-08-08 02:02:29127class WebString;
128class WebURL;
Avi Drissman6ed86dc32018-03-03 00:29:24129struct FramePolicy;
[email protected]a09d53ce2014-01-31 00:46:42130struct WebContextMenuData;
thestig4c8f2a72016-08-13 01:39:11131} // namespace blink
[email protected]7a4e2532013-12-02 21:30:02132
133namespace gfx {
[email protected]a09d53ce2014-01-31 00:46:42134class Point;
[email protected]7a4e2532013-12-02 21:30:02135class Range;
Adithya Srinivasan57f44d0d2019-03-22 15:36:02136} // namespace gfx
[email protected]7a4e2532013-12-02 21:30:02137
jrummell109c3a602014-12-18 01:08:50138namespace media {
xhwang60b430a2015-02-01 05:20:46139class MediaPermission;
chcunningham86f025e32017-05-30 20:43:23140}
jrummell109c3a602014-12-18 01:08:50141
rockot400ea35b2016-10-15 19:15:32142namespace service_manager {
ben155ecf82016-06-21 22:43:26143class InterfaceProvider;
xhwang33f939e2015-06-23 04:33:42144}
145
Henrique Ferreiro86c9e8f2020-03-05 12:28:18146namespace ui {
147class Cursor;
148}
149
tommycli58e3172c2015-09-15 18:18:26150namespace url {
151class Origin;
152}
153
[email protected]227692c52013-05-31 22:43:04154namespace content {
155
sammc7f964632016-10-14 04:16:21156class BlinkInterfaceRegistryImpl;
kenrba7199832015-01-22 23:44:59157class CompositorDependencies;
Dmitry Gozmanf5b5c5c2019-02-07 00:32:32158class DocumentState;
xhwang5206d4e62016-02-05 02:09:55159class MediaPermissionDispatcher;
Arthur Hemeryd3011f62018-05-30 10:38:44160class NavigationClient;
[email protected]7a4e2532013-12-02 21:30:02161class PepperPluginInstanceImpl;
162class RendererPpapiHost;
Mario Sanchez Prada60a014b72020-02-20 19:08:06163class RenderAccessibilityManager;
[email protected]2e2d9632013-12-03 00:55:26164class RenderFrameObserver;
[email protected]227692c52013-05-31 22:43:04165class RenderViewImpl;
[email protected]7a4e2532013-12-02 21:30:02166class RenderWidget;
167class RenderWidgetFullscreenPepper;
[email protected]a09d53ce2014-01-31 00:46:42168struct CustomContextMenuContext;
alexmosbc7eafa2014-12-06 01:38:09169struct FrameReplicationState;
[email protected]227692c52013-05-31 22:43:04170
[email protected]85d85fd2013-06-19 00:57:41171class CONTENT_EXPORT RenderFrameImpl
172 : public RenderFrame,
Becca Hughes3da69b742018-04-13 19:05:06173 blink::mojom::AutoplayConfigurationClient,
Minggang Wangd712a912020-07-10 08:12:35174 blink::mojom::ResourceLoadInfoNotifier,
Nico Weber43ddd7a32017-08-15 19:19:27175 mojom::Frame,
Ken Rockot48785452017-10-25 19:33:14176 mojom::FrameNavigationControl,
Adam Parker6a19ba342018-01-08 23:40:20177 mojom::FullscreenVideoElementHandler,
Nico Weber43ddd7a32017-08-15 19:19:27178 mojom::FrameBindingsControl,
Mark Lieu6cf3e8fa2019-03-09 02:09:01179 mojom::MhtmlFileWriter,
Mustaq Ahmed55944cb2018-05-25 20:44:27180 public blink::WebLocalFrameClient,
Nico Weber43ddd7a32017-08-15 19:19:27181 service_manager::mojom::InterfaceProvider {
[email protected]227692c52013-05-31 22:43:04182 public:
dchengc5ef1a52015-08-26 20:58:30183 // Creates a new RenderFrame as the main frame of |render_view|.
dcheng3ce04b62015-10-26 23:30:55184 static RenderFrameImpl* CreateMainFrame(
185 RenderViewImpl* render_view,
dcheng9e24bd352016-03-01 19:15:51186 CompositorDependencies* compositor_deps,
Daniel Chengd5e56ff2017-06-24 07:44:02187 blink::WebFrame* opener,
Erik Chen10e9b022019-08-21 23:33:23188 mojom::CreateViewParamsPtr* params,
189 RenderWidget::ShowCallback show_callback);
[email protected]2f61bdd2013-07-02 18:38:47190
arthursonzogni1efc7b962019-03-14 09:36:33191 // Creates a new RenderFrame with |routing_id|. If |previous_routing_id| is
alexmosa181efc2015-09-03 00:39:04192 // MSG_ROUTING_NONE, it creates the Blink WebLocalFrame and inserts it into
arthursonzogni1efc7b962019-03-14 09:36:33193 // the frame tree after the frame identified by |previous_sibling_routing_id|,
194 // or as the first child if |previous_sibling_routing_id| is MSG_ROUTING_NONE.
195 // Otherwise, the frame is semi-orphaned until it commits, at which point it
196 // replaces the previous object identified by |previous_routing_id|. The
197 // previous object can either be a RenderFrame or a RenderFrameProxy.
Pavel Feldman25234722017-10-11 02:49:06198 // The frame's opener is set to the frame identified by |opener_routing_id|.
199 // The frame is created as a child of the RenderFrame identified by
200 // |parent_routing_id| or as the top-level frame if
201 // the latter is MSG_ROUTING_NONE.
202 // |devtools_frame_token| is passed from the browser and corresponds to the
arthursonzogni1efc7b962019-03-14 09:36:33203 // owner FrameTreeNode. It can only be used for tagging requests and calls
Pavel Feldman25234722017-10-11 02:49:06204 // for context frame attribution. It should never be passed back to the
205 // browser as a frame identifier in the control flows calls.
danakjcbf13042019-09-18 21:01:47206 // The |widget_params| is not null if the frame is to be a local root, which
207 // means it will own a RenderWidget, in which case the |widget_params| hold
208 // the routing id and initialization properties for the RenderWidget.
Pavel Feldman25234722017-10-11 02:49:06209 //
210 // Note: This is called only when RenderFrame is being created in response
211 // to IPC message from the browser process. All other frame creation is driven
212 // through Blink and Create.
Balazs Engedyba034e72017-10-27 22:26:28213 static void CreateFrame(
214 int routing_id,
Gyuyoung Kim6c9ce9022019-11-26 05:40:08215 mojo::PendingRemote<service_manager::mojom::InterfaceProvider>
216 interface_provider,
Oksana Zhuravlovafee097c2019-07-26 17:01:30217 mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
218 browser_interface_broker,
arthursonzogni1efc7b962019-03-14 09:36:33219 int previous_routing_id,
Antonio Gomes9d150542020-05-25 18:32:11220 const base::UnguessableToken& opener_frame_token,
Balazs Engedyba034e72017-10-27 22:26:28221 int parent_routing_id,
222 int previous_sibling_routing_id,
Dave Tapuska84449382020-05-01 00:39:04223 const base::UnguessableToken& frame_token,
Balazs Engedyba034e72017-10-27 22:26:28224 const base::UnguessableToken& devtools_frame_token,
225 const FrameReplicationState& replicated_state,
226 CompositorDependencies* compositor_deps,
Dave Tapuska8499eec2020-03-16 17:54:30227 mojom::CreateFrameWidgetParamsPtr widget_params,
Julie Jeongeun Kim70a2e4e2020-02-21 05:09:54228 blink::mojom::FrameOwnerPropertiesPtr frame_owner_properties,
Daniel Chenge0555e192018-01-18 20:00:05229 bool has_committed_real_load);
[email protected]82307f6b2014-08-07 03:30:12230
[email protected]5a7100d2014-05-19 01:29:04231 // Returns the RenderFrameImpl for the given routing ID.
232 static RenderFrameImpl* FromRoutingID(int routing_id);
233
[email protected]a5ac6dc2014-01-15 07:02:14234 // Just like RenderFrame::FromWebFrame but returns the implementation.
235 static RenderFrameImpl* FromWebFrame(blink::WebFrame* web_frame);
[email protected]b70da4c2014-01-06 19:57:09236
danakj5a7b1932018-07-20 15:44:09237 // Constructor parameters are bundled into a struct.
Balazs Engedyba034e72017-10-27 22:26:28238 struct CONTENT_EXPORT CreateParams {
Gyuyoung Kim6c9ce9022019-11-26 05:40:08239 CreateParams(RenderViewImpl* render_view,
240 int32_t routing_id,
241 mojo::PendingRemote<service_manager::mojom::InterfaceProvider>
242 interface_provider,
243 mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
244 browser_interface_broker,
245 const base::UnguessableToken& devtools_frame_token);
Balazs Engedyba034e72017-10-27 22:26:28246 ~CreateParams();
247
248 CreateParams(CreateParams&&);
249 CreateParams& operator=(CreateParams&&);
jochen664198b2015-06-25 14:13:00250
251 RenderViewImpl* render_view;
avi1023d012015-12-25 02:39:14252 int32_t routing_id;
Gyuyoung Kim6c9ce9022019-11-26 05:40:08253 mojo::PendingRemote<service_manager::mojom::InterfaceProvider>
254 interface_provider;
Oksana Zhuravlovafee097c2019-07-26 17:01:30255 mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
256 browser_interface_broker;
Pavel Feldman25234722017-10-11 02:49:06257 base::UnguessableToken devtools_frame_token;
jochen664198b2015-06-25 14:13:00258 };
259
Balazs Engedyba034e72017-10-27 22:26:28260 using CreateRenderFrameImplFunction = RenderFrameImpl* (*)(CreateParams);
danakj6a816592018-09-25 18:30:56261
Albert J. Wong2727e8a82019-02-15 16:56:11262 // Web tests override the creation of RenderFrames in order to inject a
263 // partial testing fake.
264 static void InstallCreateHook(CreateRenderFrameImplFunction create_frame);
[email protected]2f61bdd2013-07-02 18:38:47265
arthursonzogni7fe226e2020-03-09 15:24:37266 // Looks up and returns the WebFrame corresponding to a given frame routing
267 // ID.
268 static blink::WebFrame* ResolveWebFrame(int opener_frame_routing_id);
alexmos95733002015-08-24 16:38:09269
Yao Xiaoaf79ca9b2019-03-12 19:54:18270 // Possibly set the kOpenerCrossOrigin and kSandboxNoGesture policy in
271 // |download_policy|.
Yao Xiao2c1171a2019-04-01 23:44:32272 static void MaybeSetDownloadFramePolicy(
Charlie Harrison8c113a32019-01-07 16:08:29273 bool is_opener_navigation,
274 const blink::WebURLRequest& request,
Yao Xiaoaf79ca9b2019-03-12 19:54:18275 const blink::WebSecurityOrigin& current_origin,
276 bool has_download_sandbox_flag,
Yao Xiao2cc17412019-11-25 09:04:40277 bool blocking_downloads_in_sandbox_enabled,
Yao Xiao2c1171a2019-04-01 23:44:32278 bool from_ad,
Yao Xiaoaf79ca9b2019-03-12 19:54:18279 NavigationDownloadPolicy* download_policy);
Charlie Harrison8c113a32019-01-07 16:08:29280
kdsilvae0135592016-08-09 17:08:11281 // Overwrites the given URL to use an HTML5 embed if possible.
Blink Reformat1c4d759e2017-04-09 16:34:54282 blink::WebURL OverrideFlashEmbedWithHTML(const blink::WebURL& url) override;
kdsilvae0135592016-08-09 17:08:11283
avi5c77d212015-09-25 20:08:25284 ~RenderFrameImpl() override;
[email protected]227692c52013-05-31 22:43:04285
dglazkovf0e1d6d2015-10-10 02:13:48286 // Called by RenderWidget when meaningful layout has happened.
287 // See RenderFrameObserver::DidMeaningfulLayout declaration for details.
288 void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type);
289
danakja6c10012018-07-06 14:25:36290 // Draw commands have been issued by blink::LayerTreeView.
lfge0c2792ec2016-05-11 18:52:08291 void DidCommitAndDrawCompositorFrame();
292
Daniel Cheng999698bd2017-03-22 04:56:37293 // Returns the unique name of the RenderFrame.
294 const std::string& unique_name() const { return unique_name_helper_.value(); }
295
[email protected]7a4e2532013-12-02 21:30:02296 // TODO(jam): this is a temporary getter until all the code is transitioned
297 // to using RenderFrame instead of RenderView.
wjmaclean2a6cab72016-11-03 18:36:40298 RenderViewImpl* render_view() { return render_view_; }
[email protected]7a4e2532013-12-02 21:30:02299
creis225a7432016-06-03 22:56:27300 const blink::WebHistoryItem& current_history_item() {
301 return current_history_item_;
302 }
303
[email protected]7a4e2532013-12-02 21:30:02304 // Returns the RenderWidget associated with this frame.
Albert J. Wong7bbf22d2018-12-20 00:27:27305 RenderWidget* GetLocalRootRenderWidget();
danakjd370dbb2020-05-21 17:54:38306 // Returns the blink::WebFrameWidget attached to the RenderWidget that is
307 // associated with this frame.
308 blink::WebFrameWidget* GetLocalRootWebFrameWidget();
[email protected]7a4e2532013-12-02 21:30:02309
danakjdb106b22020-04-24 15:56:31310 // This method must be called after the WebLocalFrame backing this RenderFrame
311 // has been created and added to the frame tree. It creates all objects that
312 // depend on the frame being at its proper spot.
313 //
314 // Virtual for web tests to inject their own behaviour into the WebLocalFrame.
315 virtual void Initialize();
[email protected]0287e762014-04-11 13:07:58316
[email protected]de3c5d82014-05-28 22:12:59317 // Notifications from RenderWidget.
318 void WasHidden();
319 void WasShown();
320
[email protected]723971b2014-02-12 11:08:25321 // Start/Stop loading notifications.
322 // TODO(nasko): Those are page-level methods at this time and come from
Mustaq Ahmed55944cb2018-05-25 20:44:27323 // WebViewClient. We should move them to be WebLocalFrameClient calls and put
[email protected]723971b2014-02-12 11:08:25324 // logic in the browser side to balance starts/stops.
Camille Lamyefd54b02018-10-04 16:54:14325 void DidStartLoading() override;
Blink Reformat1c4d759e2017-04-09 16:34:54326 void DidStopLoading() override;
[email protected]723971b2014-02-12 11:08:25327
Mario Sanchez Prada60a014b72020-02-20 19:08:06328 // Returns the object implementing the RenderAccessibility mojo interface and
329 // serves as a bridge between RenderFrameImpl and RenderAccessibilityImpl.
330 RenderAccessibilityManager* GetRenderAccessibilityManager() {
331 return render_accessibility_manager_.get();
Sergey Poromov79fbef222020-02-20 14:13:57332 }
Mario Sanchez Prada68d4bec2020-02-20 13:42:05333
Mario Sanchez Prada60a014b72020-02-20 19:08:06334 // Called from RenderAccessibilityManager to let the RenderFrame know when the
335 // accessibility mode has changed, so that it can notify its observers.
336 void NotifyAccessibilityModeChange(ui::AXMode new_mode);
337
Alex Moshchuk43076622017-09-08 21:20:44338 // Whether or not the frame is currently swapped into the frame tree. If
339 // this is false, this is a provisional frame which has not committed yet,
340 // and which will swap with a proxy when it commits.
341 //
342 // TODO(https://crbug.com/578349): Remove this once provisional frames are
343 // gone, and clean up code that depends on it.
344 bool in_frame_tree() { return in_frame_tree_; }
345
nick5ae4d2d2017-01-06 01:18:35346 // A RenderView opened by this RenderFrame needs to be shown.
347 void ShowCreatedWindow(bool opened_by_user_gesture,
348 RenderWidget* render_widget_to_show,
349 blink::WebNavigationPolicy policy,
350 const gfx::Rect& initial_rect);
351
lfge0c2792ec2016-05-11 18:52:08352 // Called when this frame's widget is focused.
353 void RenderWidgetSetFocus(bool enable);
354
355 // Called when the widget receives a mouse event.
356 void RenderWidgetWillHandleMouseEvent();
357
brettw4b461082016-11-19 18:55:16358#if BUILDFLAG(ENABLE_PLUGINS)
[email protected]271ff5792013-12-04 22:29:31359 // Notification that a PPAPI plugin has been created.
360 void PepperPluginCreated(RendererPpapiHost* host);
361
[email protected]7a4e2532013-12-02 21:30:02362 // Notifies that |instance| has changed the cursor.
363 // This will update the cursor appearance if it is currently over the plugin
364 // instance.
365 void PepperDidChangeCursor(PepperPluginInstanceImpl* instance,
Henrique Ferreiro86c9e8f2020-03-05 12:28:18366 const ui::Cursor& cursor);
[email protected]7a4e2532013-12-02 21:30:02367
368 // Notifies that |instance| has received a mouse event.
369 void PepperDidReceiveMouseEvent(PepperPluginInstanceImpl* instance);
370
[email protected]7a4e2532013-12-02 21:30:02371 // Informs the render view that a PPAPI plugin has changed text input status.
372 void PepperTextInputTypeChanged(PepperPluginInstanceImpl* instance);
373 void PepperCaretPositionChanged(PepperPluginInstanceImpl* instance);
374
375 // Cancels current composition.
376 void PepperCancelComposition(PepperPluginInstanceImpl* instance);
377
378 // Informs the render view that a PPAPI plugin has changed selection.
379 void PepperSelectionChanged(PepperPluginInstanceImpl* instance);
380
381 // Creates a fullscreen container for a pepper plugin instance.
382 RenderWidgetFullscreenPepper* CreatePepperFullscreenContainer(
383 PepperPluginInstanceImpl* plugin);
384
[email protected]7a4e2532013-12-02 21:30:02385 bool IsPepperAcceptingCompositionEvents() const;
386
387 // Notification that the given plugin has crashed.
388 void PluginCrashed(const base::FilePath& plugin_path,
389 base::ProcessId plugin_pid);
390
[email protected]7a4e2532013-12-02 21:30:02391 // Simulates IME events for testing purpose.
392 void SimulateImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26393 const base::string16& text,
Dave Tapuska7fa75212020-06-04 17:46:11394 const std::vector<ui::ImeTextSpan>& ime_text_spans,
[email protected]7a4e2532013-12-02 21:30:02395 int selection_start,
396 int selection_end);
Dave Tapuska7fa75212020-06-04 17:46:11397 void SimulateImeCommitText(const base::string16& text,
398 const std::vector<ui::ImeTextSpan>& ime_text_spans,
399 const gfx::Range& replacement_range);
[email protected]7a4e2532013-12-02 21:30:02400
401 // TODO(jam): remove these once the IPC handler moves from RenderView to
402 // RenderFrame.
Dave Tapuska7fa75212020-06-04 17:46:11403 void OnImeSetComposition(const base::string16& text,
404 const std::vector<ui::ImeTextSpan>& ime_text_spans,
405 int selection_start,
406 int selection_end);
aelias87b8f7c2016-09-14 03:19:29407 void OnImeCommitText(const base::string16& text,
408 const gfx::Range& replacement_range,
409 int relative_cursor_pos);
410 void OnImeFinishComposingText(bool keep_selection);
411
brettw4b461082016-11-19 18:55:16412#endif // BUILDFLAG(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:02413
thestigcb959ce2016-11-17 05:56:32414 void ScriptedPrint(bool user_initiated);
415
[email protected]227692c52013-05-31 22:43:04416 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52417 bool Send(IPC::Message* msg) override;
[email protected]227692c52013-05-31 22:43:04418
419 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52420 bool OnMessageReceived(const IPC::Message& msg) override;
rockotce2138c2016-09-16 00:09:18421 void OnAssociatedInterfaceRequest(
422 const std::string& interface_name,
423 mojo::ScopedInterfaceEndpointHandle handle) override;
[email protected]227692c52013-05-31 22:43:04424
[email protected]271ff5792013-12-04 22:29:31425 // RenderFrame implementation:
dcheng6d18e402014-10-21 12:32:52426 RenderView* GetRenderView() override;
dmazzoni8e6fe4d2016-06-27 06:35:37427 RenderAccessibility* GetRenderAccessibility() override;
Dominic Mazzoni8ea9079682019-12-26 20:08:31428 std::unique_ptr<AXTreeSnapshotter> CreateAXTreeSnapshotter() override;
dcheng6d18e402014-10-21 12:32:52429 int GetRoutingID() override;
430 blink::WebLocalFrame* GetWebFrame() override;
thestig8a8fdfd32017-05-06 18:46:54431 const WebPreferences& GetWebkitPreferences() override;
dcheng6d18e402014-10-21 12:32:52432 int ShowContextMenu(ContextMenuClient* client,
Lukasz Anforowiczc9513682020-03-11 03:13:26433 const UntrustworthyContextMenuParams& params) override;
dcheng6d18e402014-10-21 12:32:52434 void CancelContextMenu(int request_id) override;
Jan Wilken Dörrie225749c92019-10-29 01:22:07435 void ShowVirtualKeyboard() override;
tommycli59bd86c2014-12-10 02:09:38436 blink::WebPlugin* CreatePlugin(
tommycli59bd86c2014-12-10 02:09:38437 const WebPluginInfo& info,
438 const blink::WebPluginParams& params,
dchengcedca5612016-04-09 01:40:15439 std::unique_ptr<PluginInstanceThrottler> throttler) override;
dcheng6d18e402014-10-21 12:32:52440 void ExecuteJavaScript(const base::string16& javascript) override;
dglazkov2e140f52015-09-28 16:10:07441 bool IsMainFrame() override;
dcheng6d18e402014-10-21 12:32:52442 bool IsHidden() override;
Ben Goodgerd5ee3cc2017-07-24 23:11:36443 void BindLocalInterface(
444 const std::string& interface_name,
445 mojo::ScopedMessagePipeHandle interface_pipe) override;
rockot400ea35b2016-10-15 19:15:32446 service_manager::InterfaceProvider* GetRemoteInterfaces() override;
Sam McNally52e50282017-11-29 00:54:02447 blink::AssociatedInterfaceRegistry* GetAssociatedInterfaceRegistry() override;
448 blink::AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
brettw4b461082016-11-19 18:55:16449#if BUILDFLAG(ENABLE_PLUGINS)
danakj9d03ab62019-05-21 16:34:12450 void RegisterPeripheralPlugin(const url::Origin& content_origin,
451 base::OnceClosure unthrottle_callback) override;
tommycli9c7cbd92015-12-18 23:34:34452 RenderFrame::PeripheralContentStatus GetPeripheralContentStatus(
453 const url::Origin& main_frame_origin,
454 const url::Origin& content_origin,
tommycli8a1ef84d2016-08-10 23:05:08455 const gfx::Size& unobscured_size,
Lucas Furukawa Gadanid51ff5d62018-12-07 21:26:49456 RecordPeripheralDecision record_decision) override;
Yuzu Saijoa11069a2020-04-22 10:56:55457 void AllowlistContentOrigin(const url::Origin& content_origin) override;
nasko2d67b3c2017-01-04 14:48:19458 void PluginDidStartLoading() override;
459 void PluginDidStopLoading() override;
tommyclid481c482014-12-03 01:50:41460#endif
dcheng6d18e402014-10-21 12:32:52461 bool IsFTPDirectoryListing() override;
changwan44664cd2017-05-23 19:14:34462 void SetSelectedText(const base::string16& selection_text,
463 size_t offset,
464 const gfx::Range& range) override;
Abhijeet Kandalkara5928a0a2019-03-13 05:04:42465 void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
rdevlin.croninb2cec912015-06-24 20:36:01466 const std::string& message) override;
Hiroki Nakagawa41366152020-07-27 18:31:40467 blink::PreviewsState GetPreviewsState() override;
Lucas Furukawa Gadanid51ff5d62018-12-07 21:26:49468 bool IsPasting() override;
jam485372b12016-10-26 19:46:07469 bool IsBrowserSideNavigationPending() override;
Dmitry Gozmand96e493a82018-11-28 01:13:33470 void LoadHTMLString(const std::string& html,
471 const GURL& base_url,
472 const std::string& text_encoding,
473 const GURL& unreachable_url,
474 bool replace_current_item) override;
Alexander Timin310368112017-09-13 10:01:44475 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner(
476 blink::TaskType task_type) override;
Lucas Furukawa Gadanid51ff5d62018-12-07 21:26:49477 int GetEnabledBindings() override;
Dominic Mazzonic6f4bc72017-12-22 22:03:43478 void SetAccessibilityModeForTest(ui::AXMode new_mode) override;
Chong Zhangb7c8d1ce2018-03-13 19:14:11479 scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
Sergey Volk8b09c2c52018-12-12 23:20:40480 const RenderFrameMediaPlaybackOptions& GetRenderFrameMediaPlaybackOptions()
481 override;
482 void SetRenderFrameMediaPlaybackOptions(
483 const RenderFrameMediaPlaybackOptions& opts) override;
Dave Tapuskafc457ca832019-08-06 19:52:22484 void SetAllowsCrossBrowsingInstanceFrameLookup() override;
danakj3dcceba2019-10-09 22:16:23485 gfx::RectF ElementBoundsInWindow(const blink::WebElement& element) override;
486 void ConvertViewportToWindow(blink::WebRect* rect) override;
danakj90e9d342019-10-10 19:14:48487 float GetDeviceScaleFactor() override;
[email protected]271ff5792013-12-04 22:29:31488
Becca Hughes3da69b742018-04-13 19:05:06489 // blink::mojom::AutoplayConfigurationClient implementation:
490 void AddAutoplayFlags(const url::Origin& origin,
491 const int32_t flags) override;
Becca Hughes9470c452017-07-27 22:51:05492
Minggang Wangd712a912020-07-10 08:12:35493 // These are called for dedicated workers only when
494 // IsLoadMainScriptForPlzDedicatedWorkerByParamsEnabled() is true.
495 // blink::mojom::ResourceLoadInfoNotifier implementation:
496 void NotifyResourceRedirectReceived(
497 const net::RedirectInfo& redirect_info,
498 network::mojom::URLResponseHeadPtr redirect_response) override;
499 void NotifyResourceResponseReceived(
500 blink::mojom::ResourceLoadInfoPtr resource_load_info,
501 network::mojom::URLResponseHeadPtr head,
502 int32_t previews_state) override;
503 void NotifyResourceTransferSizeUpdated(int32_t request_id,
504 int32_t transfer_size_diff) override;
505 void NotifyResourceLoadCompleted(
506 blink::mojom::ResourceLoadInfoPtr resource_load_info,
507 const ::network::URLLoaderCompletionStatus& status) override;
508 void NotifyResourceLoadCanceled(int32_t request_id) override;
509 void Clone(mojo::PendingReceiver<blink::mojom::ResourceLoadInfoNotifier>
510 pending_resource_load_info_notifier) override;
511
ben76f52b242016-06-18 05:42:48512 // mojom::Frame implementation:
513 void GetInterfaceProvider(
Gyuyoung Kim6c9ce9022019-11-26 05:40:08514 mojo::PendingReceiver<service_manager::mojom::InterfaceProvider> receiver)
515 override;
Daniel Cheng118f9e282017-11-10 03:28:44516 void GetCanonicalUrlForSharing(
517 GetCanonicalUrlForSharingCallback callback) override;
John Abd-El-Malek9405d80e2018-08-08 16:50:21518 void BlockRequests() override;
519 void ResumeBlockedRequests() override;
520 void CancelBlockedRequests() override;
Scott Violet0de3837c2019-09-06 22:51:54521 void UpdateBrowserControlsState(BrowserControlsState constraints,
522 BrowserControlsState current,
523 bool animate) override;
Mario Sanchez Prada749007a2020-03-13 16:48:29524 void SnapshotAccessibilityTree(
525 uint32_t ax_mode,
526 SnapshotAccessibilityTreeCallback callback) override;
Mario Sanchez Prada13bbad52020-06-01 18:12:29527 void GetSerializedHtmlWithLocalLinks(
528 const base::flat_map<GURL, base::FilePath>& url_map,
529 const base::flat_map<base::UnguessableToken, base::FilePath>&
530 frame_token_map,
531 bool save_with_empty_url,
532 mojo::PendingRemote<mojom::FrameHTMLSerializerHandler> handler_remote)
533 override;
Dave Tapuska1dd57742019-02-07 01:07:37534
Eve Martin-Jones40f552c2018-02-14 22:47:32535#if defined(OS_ANDROID)
Luciano Pacheco8528c16f2017-12-14 07:10:56536 void ExtractSmartClipData(
537 const gfx::Rect& rect,
538 const ExtractSmartClipDataCallback callback) override;
Eve Martin-Jones40f552c2018-02-14 22:47:32539#endif
ben76f52b242016-06-18 05:42:48540
sammc7f6c6a02017-01-30 00:53:51541 // mojom::FrameBindingsControl implementation:
542 void AllowBindings(int32_t enabled_bindings_flags) override;
Nasko Oskov8a73f7d2019-09-27 22:29:32543 void EnableMojoJsBindings() override;
Miyoung Shin072d4052020-07-13 07:52:44544 void BindWebUI(mojo::PendingReceiver<mojom::WebUI> Receiver,
545 mojo::PendingRemote<mojom::WebUIHost> remote) override;
sammc7f6c6a02017-01-30 00:53:51546
Dmitry Gozman9b890002020-05-27 15:24:42547 // These mirror mojom::NavigationClient, called by NavigationClient.
Ken Rockotbe87ab322017-11-02 19:40:23548 void CommitNavigation(
Lucas Furukawa Gadania9c45682019-07-31 22:05:14549 mojom::CommonNavigationParamsPtr common_params,
550 mojom::CommitNavigationParamsPtr commit_params,
Lucas Furukawa Gadani81e294b2019-08-29 16:26:32551 network::mojom::URLResponseHeadPtr response_head,
Minggang Wang47a78222019-06-28 17:05:46552 mojo::ScopedDataPipeConsumerHandle response_body,
John Abd-El-Malekb165dc52018-01-18 17:12:18553 network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
Dominic Farolinobc280d22019-12-05 05:49:24554 std::unique_ptr<blink::PendingURLLoaderFactoryBundle>
Arthur Hemery1f46de02019-01-31 16:41:53555 subresource_loader_factories,
Hiroki Nakagawad7ed213e2020-07-21 13:19:28556 base::Optional<std::vector<blink::mojom::TransferrableURLLoaderPtr>>
John Abd-El-Malekecc6f5f2018-03-02 18:47:39557 subresource_overrides,
Hiroki Nakagawacdbc7912018-11-30 11:30:05558 blink::mojom::ControllerServiceWorkerInfoPtr
559 controller_service_worker_info,
Hiroki Nakagawa74cdcf32020-05-15 04:57:21560 blink::mojom::ServiceWorkerContainerInfoForClientPtr container_info,
Kinuko Yasuda8fb556c2019-07-16 05:47:55561 mojo::PendingRemote<network::mojom::URLLoaderFactory>
562 prefetch_loader_factory,
clamy6b92fcf2018-06-01 13:51:37563 const base::UnguessableToken& devtools_navigation_token,
Dmitry Gozman9b890002020-05-27 15:24:42564 mojom::NavigationClient::CommitNavigationCallback commit_callback);
Doug Turner84693be2017-12-19 00:18:46565 void CommitFailedNavigation(
Lucas Furukawa Gadanief8290a2019-07-29 20:27:51566 mojom::CommonNavigationParamsPtr common_params,
Lucas Furukawa Gadania9c45682019-07-31 22:05:14567 mojom::CommitNavigationParamsPtr commit_params,
Doug Turner84693be2017-12-19 00:18:46568 bool has_stale_copy_in_cache,
569 int error_code,
dalykd3131c32020-01-06 17:52:57570 net::ResolveErrorInfo resolve_error_info,
Doug Turner84693be2017-12-19 00:18:46571 const base::Optional<std::string>& error_page_content,
Dominic Farolinobc280d22019-12-05 05:49:24572 std::unique_ptr<blink::PendingURLLoaderFactoryBundle>
Arthur Hemery1f46de02019-01-31 16:41:53573 subresource_loader_factories,
Arthur Hemery161d1e62019-02-06 16:46:32574 mojom::NavigationClient::CommitFailedNavigationCallback
575 per_navigation_mojo_interface_callback);
576
Dmitry Gozman9b890002020-05-27 15:24:42577 // mojom::FrameNavigationControl implementation:
clamyaf4bf2d92018-02-06 10:54:36578 void CommitSameDocumentNavigation(
Lucas Furukawa Gadanief8290a2019-07-29 20:27:51579 mojom::CommonNavigationParamsPtr common_params,
Lucas Furukawa Gadania9c45682019-07-31 22:05:14580 mojom::CommitNavigationParamsPtr commit_params,
clamyaf4bf2d92018-02-06 10:54:36581 CommitSameDocumentNavigationCallback callback) override;
clamyb1df7b962018-02-01 17:38:17582 void HandleRendererDebugURL(const GURL& url) override;
Chong Zhang7306b0b2018-01-24 05:59:24583 void UpdateSubresourceLoaderFactories(
Dominic Farolinobc280d22019-12-05 05:49:24584 std::unique_ptr<blink::PendingURLLoaderFactoryBundle>
Arthur Hemery1f46de02019-01-31 16:41:53585 subresource_loader_factories) override;
Dmitry Gozman6adf95b2018-10-10 22:12:19586 void BindDevToolsAgent(
Julie Jeongeun Kim07887792019-08-13 11:05:48587 mojo::PendingAssociatedRemote<blink::mojom::DevToolsAgentHost> host,
Andrey Kosyakov5bb020f2020-03-19 17:28:19588 mojo::PendingAssociatedReceiver<blink::mojom::DevToolsAgent> receiver)
Julie Jeongeun Kim07887792019-08-13 11:05:48589 override;
Avi Drissman4544828f2019-03-11 20:37:32590 void JavaScriptExecuteRequest(
591 const base::string16& javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11592 bool wants_result,
Avi Drissman4544828f2019-03-11 20:37:32593 JavaScriptExecuteRequestCallback callback) override;
594 void JavaScriptExecuteRequestForTests(
595 const base::string16& javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11596 bool wants_result,
Avi Drissman4544828f2019-03-11 20:37:32597 bool has_user_gesture,
Hajime Hoshif85e7cf722019-07-19 00:54:49598 int32_t world_id,
Avi Drissman4544828f2019-03-11 20:37:32599 JavaScriptExecuteRequestForTestsCallback callback) override;
600 void JavaScriptExecuteRequestInIsolatedWorld(
601 const base::string16& javascript,
Avi Drissman8e3ebe92019-06-10 20:26:11602 bool wants_result,
Avi Drissman4544828f2019-03-11 20:37:32603 int32_t world_id,
604 JavaScriptExecuteRequestInIsolatedWorldCallback callback) override;
Dmitry Gozman9b890002020-05-27 15:24:42605 void ForwardMessageFromHost(
606 blink::TransferableMessage message,
607 const url::Origin& source_origin,
608 const base::Optional<url::Origin>& target_origin) override;
Adithya Srinivasane8bf80e2019-05-01 15:39:31609 void OnPortalActivated(
Adithya Srinivasanea4760c2020-07-30 15:44:57610 const blink::PortalToken& portal_token,
Jeremy Romand92e1372019-06-04 16:31:17611 mojo::PendingAssociatedRemote<blink::mojom::Portal> portal,
612 mojo::PendingAssociatedReceiver<blink::mojom::PortalClient> portal_client,
Adithya Srinivasane8bf80e2019-05-01 15:39:31613 blink::TransferableMessage data,
614 OnPortalActivatedCallback callback) override;
Gyuyoung Kim11aad0b62020-04-29 16:00:26615 void SwapIn() override;
Hajime Hoshi35ad74f2019-03-07 08:38:05616
Adam Parker6a19ba342018-01-08 23:40:20617 // mojom::FullscreenVideoElementHandler implementation:
618 void RequestFullscreenVideoElement() override;
619
Mark Lieu6cf3e8fa2019-03-09 02:09:01620 // mojom::MhtmlFileWriter implementation:
621 void SerializeAsMHTML(const mojom::SerializeAsMHTMLParamsPtr params,
622 SerializeAsMHTMLCallback callback) override;
623
Mustaq Ahmed55944cb2018-05-25 20:44:27624 // blink::WebLocalFrameClient implementation:
Mario Sanchez Pradadde87ee52019-05-29 07:55:01625 void BindToFrame(blink::WebNavigationControl* frame) override;
thestigf7d2fa12017-05-05 19:11:43626 blink::WebPlugin* CreatePlugin(const blink::WebPluginParams& params) override;
Blink Reformat1c4d759e2017-04-09 16:34:54627 blink::WebMediaPlayer* CreateMediaPlayer(
guidou9bfe4e2f2016-04-09 08:31:19628 const blink::WebMediaPlayerSource& source,
srirama.m26f864d02015-07-14 05:21:46629 blink::WebMediaPlayerClient* client,
Ted Meyercda47a0e2019-08-13 20:41:11630 blink::MediaInspectorContext* inspector_context,
srirama.m26f864d02015-07-14 05:21:46631 blink::WebMediaPlayerEncryptedMediaClient* encrypted_client,
guidou9c3cc3e2015-10-27 13:38:15632 blink::WebContentDecryptionModule* initial_cdm,
Erik Chen4f2f6f0d2019-08-14 23:17:23633 const blink::WebString& sink_id) override;
Hiroki Nakagawa6bcbd1902017-06-09 07:13:20634 std::unique_ptr<blink::WebContentSettingsClient>
635 CreateWorkerContentSettingsClient() override;
Abigail Klein82807c552020-04-06 19:58:07636#if !defined(OS_ANDROID)
Evan Liu47f798a2020-06-23 20:27:09637 std::unique_ptr<media::SpeechRecognitionClient> CreateSpeechRecognitionClient(
Evan Liuca885402020-06-23 22:02:13638 media::SpeechRecognitionClient::OnReadyCallback callback) override;
Abigail Klein82807c552020-04-06 19:58:07639#endif
Hiroshige Hayashizaki3be04672018-11-09 02:27:39640 scoped_refptr<blink::WebWorkerFetchContext> CreateWorkerFetchContext()
horoe6120582017-04-26 01:48:59641 override;
Hiroki Nakagawa599efcb2019-02-27 12:22:33642 scoped_refptr<blink::WebWorkerFetchContext>
643 CreateWorkerFetchContextForPlzDedicatedWorker(
644 blink::WebDedicatedWorkerHostFactoryClient* factory_client) override;
Kinuko Yasuda027bcfb2019-12-05 12:49:08645 std::unique_ptr<blink::WebPrescientNetworking> CreatePrescientNetworking()
646 override;
Blink Reformat1c4d759e2017-04-09 16:34:54647 blink::BlameContext* GetFrameBlameContext() override;
kinukoc3626582017-05-01 07:27:52648 std::unique_ptr<blink::WebServiceWorkerProvider> CreateServiceWorkerProvider()
649 override;
Sam McNally52e50282017-11-29 00:54:02650 blink::AssociatedInterfaceProvider* GetRemoteNavigationAssociatedInterfaces()
651 override;
Blink Reformat1c4d759e2017-04-09 16:34:54652 blink::WebLocalFrame* CreateChildFrame(
alexmose48b1df932015-01-16 01:34:17653 blink::WebLocalFrame* parent,
Antonio Gomes9d5c1ef2020-04-30 20:56:41654 blink::mojom::TreeScopeType scope,
dcheng860817a2015-05-22 03:16:56655 const blink::WebString& name,
Daniel Cheng999698bd2017-03-22 04:56:37656 const blink::WebString& fallback_name,
Ehsan Karamad2b53d152019-04-08 13:11:21657 const blink::FramePolicy& frame_policy,
Ehsan Karamad192a8da2018-10-21 03:48:08658 const blink::WebFrameOwnerProperties& frame_owner_properties,
Antonio Gomes58d38062020-04-30 01:50:14659 blink::mojom::FrameOwnerElementType frame_owner_element_type) override;
Adithya Srinivasanea4760c2020-07-30 15:44:57660 std::pair<blink::WebRemoteFrame*, blink::PortalToken> CreatePortal(
Daniel Cheng9a7c6c82020-04-25 04:58:17661 blink::CrossVariantMojoAssociatedReceiver<
662 blink::mojom::PortalInterfaceBase> portal_endpoint,
663 blink::CrossVariantMojoAssociatedRemote<
664 blink::mojom::PortalClientInterfaceBase> client_endpoint,
Jeremy Roman62fee222019-07-09 17:34:14665 const blink::WebElement& portal_element) override;
Lucas Furukawa Gadani56dd5452019-03-22 18:23:12666 blink::WebRemoteFrame* AdoptPortal(
Adithya Srinivasanea4760c2020-07-30 15:44:57667 const blink::PortalToken& portal_token,
Jeremy Roman62fee222019-07-09 17:34:14668 const blink::WebElement& portal_element) override;
Lukasz Anforowiczaf2f33572018-01-17 14:05:08669 blink::WebFrame* FindFrame(const blink::WebString& name) override;
Miyoung Shin00b48252020-07-27 04:03:20670 void WillDetach() override;
671 void FrameDetached() override;
Blink Reformat1c4d759e2017-04-09 16:34:54672 void DidChangeName(const blink::WebString& name) override;
Ian Clelland5cbaaf82017-11-27 22:00:03673 void DidSetFramePolicyHeaders(
arthursonzognib93a4472020-04-10 07:38:00674 network::mojom::WebSandboxFlags flags,
Charlie Huf54d5422020-01-17 16:54:53675 const blink::ParsedFeaturePolicy& fp_header,
Kent Tamura326c2db2020-07-20 06:28:05676 const blink::DocumentPolicyFeatureState& dp_header) override;
Blink Reformat1c4d759e2017-04-09 16:34:54677 void DidMatchCSS(
[email protected]180ef242013-11-07 06:50:46678 const blink::WebVector<blink::WebString>& newly_matching_selectors,
avi5c77d212015-09-25 20:08:25679 const blink::WebVector<blink::WebString>& stopped_matching_selectors)
680 override;
Blink Reformat1c4d759e2017-04-09 16:34:54681 bool ShouldReportDetailedMessageForSource(
avi5c77d212015-09-25 20:08:25682 const blink::WebString& source) override;
Blink Reformat1c4d759e2017-04-09 16:34:54683 void DidAddMessageToConsole(const blink::WebConsoleMessage& message,
avi5c77d212015-09-25 20:08:25684 const blink::WebString& source_name,
685 unsigned source_line,
686 const blink::WebString& stack_trace) override;
Dmitry Gozman7b10a532018-11-13 17:48:56687 void BeginNavigation(std::unique_ptr<blink::WebNavigationInfo> info) override;
Blink Reformat1c4d759e2017-04-09 16:34:54688 void WillSendSubmitEvent(const blink::WebFormElement& form) override;
Takeshi Yoshino41b671a2017-08-01 12:17:51689 void DidCreateDocumentLoader(
Takeshi Yoshino41b671a2017-08-01 12:17:51690 blink::WebDocumentLoader* document_loader) override;
Dmitry Gozman5e95b592020-03-04 23:01:51691 void DidCommitNavigation(const blink::WebHistoryItem& item,
692 blink::WebHistoryCommitType commit_type,
693 bool should_reset_browser_interface_broker) override;
Dmitry Gozmanf0c8e0872020-02-11 09:57:28694 void DidCreateInitialEmptyDocument() override;
Nate Chapin950d75e2020-04-20 18:11:23695 void DidCommitDocumentReplacementNavigation(
Dmitry Gozmanf0c8e0872020-02-11 09:57:28696 blink::WebDocumentLoader* document_loader) override;
sashabe40dfa1b2017-04-24 02:12:55697 void DidClearWindowObject() override;
Daniel Cheng7df23c22017-08-03 18:43:58698 void DidCreateDocumentElement() override;
699 void RunScriptsAtDocumentElementAvailable() override;
Julie Jeongeun Kimec6178a2020-02-19 03:28:33700 void DidReceiveTitle(const blink::WebString& title) override;
sashab3730c8a2017-05-03 01:28:54701 void DidFinishDocumentLoad() override;
Blink Reformat1c4d759e2017-04-09 16:34:54702 void RunScriptsAtDocumentReady(bool document_is_empty) override;
sashabe68662222017-04-11 03:28:55703 void RunScriptsAtDocumentIdle() override;
Blink Reformat1c4d759e2017-04-09 16:34:54704 void DidHandleOnloadEvents() override;
sashab0bdd956a2017-04-18 09:27:06705 void DidFinishLoad() override;
Eugene But0579ec82018-05-22 17:18:17706 void DidFinishSameDocumentNavigation(const blink::WebHistoryItem& item,
707 blink::WebHistoryCommitType commit_type,
708 bool content_initiated) override;
Blink Reformat1c4d759e2017-04-09 16:34:54709 void DidUpdateCurrentHistoryItem() override;
Dmitry Gozmanf12caab2018-02-07 03:45:58710 base::UnguessableToken GetDevToolsFrameToken() override;
Blink Reformat1c4d759e2017-04-09 16:34:54711 void AbortClientNavigation() override;
712 void DidChangeSelection(bool is_empty_selection) override;
Gyuyoung Kim49f314f22020-07-04 04:00:28713 void ShowContextMenu(
714 const blink::WebContextMenuData& data,
715 const base::Optional<gfx::Point>& host_context_menu_location) override;
Lucas Furukawa Gadanie5d27a362018-02-13 14:26:02716 void FrameRectsChanged(const blink::WebRect& frame_rect) override;
Miyoung Shinbcd1400702020-03-13 00:35:18717 void FocusedElementChanged(const blink::WebElement& element) override;
Justin Miron95fddee2020-07-10 16:46:37718 void OnMainFrameIntersectionChanged(
Justin Mironc3452f92020-01-24 14:31:09719 const blink::WebRect& intersect_rect) override;
sashabdde63c12017-04-20 08:11:29720 void WillSendRequest(blink::WebURLRequest& request) override;
Blink Reformat1c4d759e2017-04-09 16:34:54721 void DidLoadResourceFromMemoryCache(
[email protected]180ef242013-11-07 06:50:46722 const blink::WebURLRequest& request,
avi5c77d212015-09-25 20:08:25723 const blink::WebURLResponse& response) override;
Blink Reformat1c4d759e2017-04-09 16:34:54724 void DidChangePerformanceTiming() override;
Hongbo Song104cef12020-03-26 21:57:07725 void DidObserveInputDelay(base::TimeDelta input_delay) override;
Eric Robinsonfb3cb752019-03-04 13:55:50726 void DidChangeCpuTiming(base::TimeDelta time) override;
Sergio Villar Senin0c142fa2019-10-16 08:18:59727 void DidObserveLoadingBehavior(blink::LoadingBehaviorFlag behavior) override;
Luna Lu7b133f72017-07-27 16:16:47728 void DidObserveNewFeatureUsage(blink::mojom::WebFeature feature) override;
Majid Valipourb9ee0972019-08-22 15:16:23729 void DidObserveNewCssPropertyUsage(blink::mojom::CSSSampleId css_property,
Luna Lu29d922d2018-03-27 18:06:51730 bool is_animated) override;
Steve Kobes7e75d522019-07-11 12:18:42731 void DidObserveLayoutShift(double score, bool after_input_or_scroll) override;
Kent Tamuraabc1e56a2020-05-07 02:03:58732 void DidObserveLayoutNg(uint32_t all_block_count,
733 uint32_t ng_block_count,
734 uint32_t all_call_count,
735 uint32_t ng_call_count) override;
Ryan Sturm4f61ea492019-04-03 23:44:27736 void DidObserveLazyLoadBehavior(
737 blink::WebLocalFrameClient::LazyLoadBehavior lazy_load_behavior) override;
Luna Lua03887f2017-11-20 21:30:47738 bool ShouldTrackUseCounter(const blink::WebURL& url) override;
sashab7dbeb112017-05-02 23:13:22739 void DidCreateScriptContext(v8::Local<v8::Context> context,
avi5c77d212015-09-25 20:08:25740 int world_id) override;
sashab9e289b32017-04-26 07:07:10741 void WillReleaseScriptContext(v8::Local<v8::Context> context,
avi5c77d212015-09-25 20:08:25742 int world_id) override;
sashabef13f14a2017-04-26 03:57:26743 void DidChangeScrollOffset() override;
Antonio Gomes32f24faf2019-08-18 16:41:36744 blink::WebMediaStreamDeviceObserver* MediaStreamDeviceObserver() override;
Blink Reformat1c4d759e2017-04-09 16:34:54745 blink::WebEncryptedMediaClient* EncryptedMediaClient() override;
746 blink::WebString UserAgentOverride() override;
Maks Orlovich73f374d2020-04-02 12:46:13747 base::Optional<blink::UserAgentMetadata> UserAgentMetadataOverride() override;
Blink Reformat1c4d759e2017-04-09 16:34:54748 blink::WebString DoNotTrackValue() override;
Guido Urdaneta3a7cd9e62020-07-21 08:31:28749 blink::mojom::RendererAudioInputStreamFactory* GetAudioInputStreamFactory();
meacerba52f56202017-04-22 00:08:08750 bool AllowContentInitiatedDataUrlNavigations(
751 const blink::WebURL& url) override;
Nektarios Paisios56ee9982020-04-22 07:53:06752 void PostAccessibilityEvent(const ui::AXEvent& event) override;
Dominic Mazzonibb512782018-09-13 16:16:06753 void MarkWebAXObjectDirty(const blink::WebAXObject& obj,
754 bool subtree) override;
Blink Reformat1c4d759e2017-04-09 16:34:54755 void CheckIfAudioSinkExistsAndIsAuthorized(
guidou3906a722015-11-12 22:14:42756 const blink::WebString& sink_id,
Antonio Gomese7813f32019-04-02 06:11:03757 blink::WebSetSinkIdCompleteCallback callback) override;
Kinuko Yasuda017b79e62017-10-24 17:46:10758 std::unique_ptr<blink::WebURLLoaderFactory> CreateURLLoaderFactory() override;
Mario Sanchez Prada70fb3b32020-04-30 20:27:39759 void OnStopLoading() override;
lukasza060c739be2017-06-13 23:09:27760 void DraggableRegionsChanged() override;
Olga Sharonovae03b90692019-09-05 09:06:58761 blink::BrowserInterfaceBrokerProxy* GetBrowserInterfaceBroker() override;
Xida Chena6f72d22020-06-02 18:36:44762 void SubmitThroughputData(ukm::SourceId source_id,
763 int aggregated_percent,
764 int impl_percent,
765 base::Optional<int> main_percent) override;
Dave Tapuska23748d42020-06-26 16:01:20766 // Dispatches the current state of selection on the webpage to the browser if
767 // it has changed.
768 // TODO(varunjain): delete this method once we figure out how to keep
769 // selection handles in sync with the webpage.
770 void SyncSelectionIfRequired() override;
771 void ScrollFocusedEditableElementIntoRect(const gfx::Rect& rect) override;
772 void ResetHasScrolledFocusedEditableIntoView() override;
[email protected]85d85fd2013-06-19 00:57:41773
Adam Parker6a19ba342018-01-08 23:40:20774 // Binds to the fullscreen service in the browser.
775 void BindFullscreen(
Mario Sanchez Pradab3b852f2019-10-04 17:53:24776 mojo::PendingAssociatedReceiver<mojom::FullscreenVideoElementHandler>
777 receiver);
Adam Parker6a19ba342018-01-08 23:40:20778
Mark Lieu6cf3e8fa2019-03-09 02:09:01779 // Binds to the MHTML file generation service in the browser.
Mario Sanchez Pradab3b852f2019-10-04 17:53:24780 void BindMhtmlFileWriter(
781 mojo::PendingAssociatedReceiver<mojom::MhtmlFileWriter> receiver);
Mark Lieu6cf3e8fa2019-03-09 02:09:01782
Becca Hughes3da69b742018-04-13 19:05:06783 // Binds to the autoplay configuration service in the browser.
784 void BindAutoplayConfiguration(
Mario Sanchez Pradab3b852f2019-10-04 17:53:24785 mojo::PendingAssociatedReceiver<blink::mojom::AutoplayConfigurationClient>
786 receiver);
Becca Hughes9470c452017-07-27 22:51:05787
ben76f52b242016-06-18 05:42:48788 // Binds to the FrameHost in the browser.
Ken Rockot13051c932019-11-14 20:11:51789 void BindFrame(mojo::PendingReceiver<mojom::Frame> receiver);
csharrison95f01e922017-04-24 18:52:35790
Balazs Engedya40712f2017-09-15 15:01:11791 // Virtual so that a TestRenderFrame can mock out the interface.
792 virtual mojom::FrameHost* GetFrameHost();
rockotf8fdd9b2015-12-16 22:22:35793
sammc7f6c6a02017-01-30 00:53:51794 void BindFrameBindingsControl(
Henrique Ferreiro3a9751c2019-09-30 13:54:07795 mojo::PendingAssociatedReceiver<mojom::FrameBindingsControl> receiver);
Ken Rockot48785452017-10-25 19:33:14796 void BindFrameNavigationControl(
Shimi Zhangbb738072019-07-09 18:54:40797 mojo::PendingAssociatedReceiver<mojom::FrameNavigationControl> receiver);
Arthur Hemeryd3011f62018-05-30 10:38:44798 // Only used when PerNavigationMojoInterface is enabled.
Julie Jeongeun Kimed2e5ba72019-09-12 10:14:17799 void BindNavigationClient(
800 mojo::PendingAssociatedReceiver<mojom::NavigationClient> receiver);
sammc7f6c6a02017-01-30 00:53:51801
xhwang5206d4e62016-02-05 02:09:55802 media::MediaPermission* GetMediaPermission();
guoweisf4282b02015-09-24 23:05:22803
danakjcf409aa2019-09-20 15:22:30804 // Proxies the call to set the prefer compositing flag over to the
danakjd4533c72020-03-11 13:07:10805 // RenderViewImpl. Meant to be called by the |render_widget_| in order to get
806 // access to the RenderViewImpl.
danakjcf409aa2019-09-20 15:22:30807 void SetPreferCompositingToLCDTextEnabledOnRenderView(bool prefer);
808 // Proxies the call to set the device scale factor over to the RenderViewImpl.
danakjd4533c72020-03-11 13:07:10809 // Meant to be called by the |render_widget_| in order to get access to the
810 // RenderViewImpl.
danakjcf409aa2019-09-20 15:22:30811 void SetDeviceScaleFactorOnRenderView(bool use_zoom_for_dsf,
812 float device_scale_factor);
danakjd4533c72020-03-11 13:07:10813 // Proxies the call to set the visible viewport size over to the
814 // RenderViewImpl. Meant to be called by the |render_widget_| in order to get
815 // access to the RenderViewImpl.
816 void SetVisibleViewportSizeForChildLocalRootOnRenderView(
817 const gfx::Size& visible_viewport_size);
danakjcf409aa2019-09-20 15:22:30818
creis69b184a472015-11-26 05:29:51819 // Sends the current frame's navigation state to the browser.
820 void SendUpdateState();
821
sammce2f99982016-03-14 22:38:12822 // Creates a MojoBindingsController if Mojo bindings have been enabled for
823 // this frame. For WebUI, this allows the page to communicate with the browser
824 // process; for layout tests, this allows the test to mock out services at
825 // the Mojo IPC layer.
826 void MaybeEnableMojoBindings();
Kent Tamura647f1a502018-08-01 10:24:08827
Dmitry Gozman3682f762019-09-16 23:19:59828 void NotifyObserversOfFailedProvisionalLoad();
Lucas Garrona15d3fc2017-11-02 02:48:18829
lfge0c2792ec2016-05-11 18:52:08830 // Plugin-related functions --------------------------------------------------
831
brettw4b461082016-11-19 18:55:16832#if BUILDFLAG(ENABLE_PLUGINS)
lfge0c2792ec2016-05-11 18:52:08833 PepperPluginInstanceImpl* focused_pepper_plugin() {
834 return focused_pepper_plugin_;
835 }
836 PepperPluginInstanceImpl* pepper_last_mouse_event_target() {
837 return pepper_last_mouse_event_target_;
838 }
839 void set_pepper_last_mouse_event_target(PepperPluginInstanceImpl* plugin) {
840 pepper_last_mouse_event_target_ = plugin;
841 }
842
843 // Indicates that the given instance has been created.
844 void PepperInstanceCreated(PepperPluginInstanceImpl* instance);
845
846 // Indicates that the given instance is being destroyed. This is called from
847 // the destructor, so it's important that the instance is not dereferenced
848 // from this call.
849 void PepperInstanceDeleted(PepperPluginInstanceImpl* instance);
850
851 // Notification that the given plugin is focused or unfocused.
852 void PepperFocusChanged(PepperPluginInstanceImpl* instance, bool focused);
zqzhangc885f6b2016-06-23 19:44:46853
854 void PepperStartsPlayback(PepperPluginInstanceImpl* instance);
855 void PepperStopsPlayback(PepperPluginInstanceImpl* instance);
856 void OnSetPepperVolume(int32_t pp_instance, double volume);
lfge0c2792ec2016-05-11 18:52:08857#endif // ENABLE_PLUGINS
858
Leon Hanc819dc62019-01-28 04:30:19859 const blink::mojom::RendererPreferences& GetRendererPreferences() const;
chcunningham86f025e32017-05-30 20:43:23860
Arthur Hemeryd3011f62018-05-30 10:38:44861 // Called when an ongoing renderer-initiated navigation was dropped by the
862 // browser.
863 void OnDroppedNavigation();
864
Lukasz Anforowiczd334bba2020-02-10 23:32:55865 void DidStartResponse(const GURL& response_url,
rajendrant811e3572018-11-05 23:18:55866 int request_id,
Lucas Furukawa Gadania6917ab2019-10-01 17:37:31867 network::mojom::URLResponseHeadPtr response_head,
Kinuko Yasuda433f710a2020-02-14 02:11:58868 network::mojom::RequestDestination request_destination,
Hiroki Nakagawa41366152020-07-27 18:31:40869 blink::PreviewsState previews_state);
rajendrant2e83a102018-06-19 05:58:02870 void DidCompleteResponse(int request_id,
871 const network::URLLoaderCompletionStatus& status);
872 void DidCancelResponse(int request_id);
873 void DidReceiveTransferSizeUpdate(int request_id, int received_data_length);
874
Julie Jeongeun Kimf43639292020-05-05 05:33:01875 bool GetCaretBoundsFromFocusedPlugin(gfx::Rect& rect) override;
876
Vladimir Levinb41bfe42019-07-16 21:13:44877 // Used in tests to install a fake WebURLLoaderFactory via
878 // RenderViewTest::CreateFakeWebURLLoaderFactory().
879 void SetWebURLLoaderFactoryOverrideForTest(
Vladimir Levincfca8522019-07-30 19:01:21880 std::unique_ptr<blink::WebURLLoaderFactoryForTest> factory);
Vladimir Levinb41bfe42019-07-16 21:13:44881
[email protected]2f61bdd2013-07-02 18:38:47882 protected:
Balazs Engedyba034e72017-10-27 22:26:28883 explicit RenderFrameImpl(CreateParams params);
[email protected]2f61bdd2013-07-02 18:38:47884
danakjc9acb1132019-03-28 19:10:05885 bool IsLocalRoot() const;
886 const RenderFrameImpl* GetLocalRoot() const;
887
danakj654897c2020-05-29 22:36:17888 // Gets the unique_name() of the frame being replaced by this frame, when
889 // it is a provisional frame. Invalid to call on frames that are already
890 // attached to the frame tree.
Anders Hartvoll Ruud4bb45c62020-07-10 17:10:55891 std::string GetPreviousFrameUniqueName();
danakj654897c2020-05-29 22:36:17892
[email protected]227692c52013-05-31 22:43:04893 private:
kenrbf98a4d22015-04-01 21:59:35894 friend class RenderFrameImplTest;
[email protected]2e2d9632013-12-03 00:55:26895 friend class RenderFrameObserver;
clamy98a9dee02015-06-24 16:09:10896 friend class TestRenderFrame;
Kinuko Yasudaf6e87a42018-12-21 08:15:27897
dmazzoni8e6fe4d2016-06-27 06:35:37898 FRIEND_TEST_ALL_PREFIXES(RenderAccessibilityImplTest,
[email protected]66bbadaf2014-03-28 16:25:54899 AccessibilityMessagesQueueWhileSwappedOut);
Ken Buchananc398e282017-11-29 19:28:57900 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, LocalChildFrameWasShown);
scottmg276753cf2016-10-27 18:25:22901 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest, ZoomLimit);
liberatoa8da3b52017-05-02 20:23:51902 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
903 TestOverlayRoutingTokenSendsLater);
904 FRIEND_TEST_ALL_PREFIXES(RenderFrameImplTest,
905 TestOverlayRoutingTokenSendsNow);
[email protected]2e2d9632013-12-03 00:55:26906
twellington376424ad2015-05-04 18:57:25907 // A wrapper class used as the callback for JavaScript executed
908 // in an isolated world.
909 class JavaScriptIsolatedWorldRequest
910 : public blink::WebScriptExecutionCallback {
911 public:
912 JavaScriptIsolatedWorldRequest(
Avi Drissman4544828f2019-03-11 20:37:32913 base::WeakPtr<RenderFrameImpl> render_frame_impl,
Avi Drissman8e3ebe92019-06-10 20:26:11914 bool wants_result,
Avi Drissman4544828f2019-03-11 20:37:32915 JavaScriptExecuteRequestInIsolatedWorldCallback callback);
Blink Reformat1c4d759e2017-04-09 16:34:54916 void Completed(
twellington376424ad2015-05-04 18:57:25917 const blink::WebVector<v8::Local<v8::Value>>& result) override;
918
919 private:
avi5c77d212015-09-25 20:08:25920 ~JavaScriptIsolatedWorldRequest() override;
twellington376424ad2015-05-04 18:57:25921
twellington376424ad2015-05-04 18:57:25922 base::WeakPtr<RenderFrameImpl> render_frame_impl_;
Avi Drissman8e3ebe92019-06-10 20:26:11923 bool wants_result_;
Avi Drissman4544828f2019-03-11 20:37:32924 JavaScriptExecuteRequestInIsolatedWorldCallback callback_;
twellington376424ad2015-05-04 18:57:25925
926 DISALLOW_COPY_AND_ASSIGN(JavaScriptIsolatedWorldRequest);
927 };
928
Daniel Cheng46894b72017-07-19 13:01:25929 // Similar to base::AutoReset, but skips restoration of the original value if
930 // |this| is already destroyed.
931 template <typename T>
932 class AutoResetMember {
933 public:
934 AutoResetMember(RenderFrameImpl* frame,
935 T RenderFrameImpl::*member,
936 T new_value)
937 : weak_frame_(frame->weak_factory_.GetWeakPtr()),
938 scoped_variable_(&(frame->*member)),
939 original_value_(*scoped_variable_) {
940 *scoped_variable_ = new_value;
941 }
942
943 ~AutoResetMember() {
944 if (weak_frame_)
945 *scoped_variable_ = original_value_;
946 }
947
948 private:
949 base::WeakPtr<RenderFrameImpl> weak_frame_;
950 T* scoped_variable_;
951 T original_value_;
952 };
953
Kinuko Yasuda017b79e62017-10-24 17:46:10954 class FrameURLLoaderFactory;
955
dchengc5ef1a52015-08-26 20:58:30956 // Creates a new RenderFrame. |render_view| is the RenderView object that this
Oksana Zhuravlova8b88e572019-01-07 21:54:00957 // frame belongs to, |interface_provider| is the RenderFrameHost's
958 // InterfaceProvider through which services are exposed to the RenderFrame,
Oksana Zhuravlova977b4b72019-11-07 19:21:55959 // and |browser_interface_broker| is the RenderFrameHost's
960 // BrowserInterfaceBroker through which services are exposed to the
Oksana Zhuravlova8b88e572019-01-07 21:54:00961 // RenderFrame.
Pavel Feldman25234722017-10-11 02:49:06962 static RenderFrameImpl* Create(
963 RenderViewImpl* render_view,
964 int32_t routing_id,
Gyuyoung Kim6c9ce9022019-11-26 05:40:08965 mojo::PendingRemote<service_manager::mojom::InterfaceProvider>
966 interface_provider,
Oksana Zhuravlovafee097c2019-07-26 17:01:30967 mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker>
968 browser_interface_broker,
Pavel Feldman25234722017-10-11 02:49:06969 const base::UnguessableToken& devtools_frame_token);
dchengc5ef1a52015-08-26 20:58:30970
[email protected]2e2d9632013-12-03 00:55:26971 // Functions to add and remove observers for this object.
972 void AddObserver(RenderFrameObserver* observer);
973 void RemoveObserver(RenderFrameObserver* observer);
[email protected]1c2052f2013-08-28 08:24:34974
alexmosf65a795a2017-01-12 22:04:00975 // Swaps the current frame into the frame tree, replacing the
Gyuyoung Kim11aad0b62020-04-29 16:00:26976 // RenderFrameProxy it is associated with. Return value indicates whether
977 // the swap operation succeeded. This should only be used for provisional
978 // frames associated with a proxy, while the proxy is still in the frame tree.
979 // If the associated proxy has been detached before this is called, this
980 // returns false and aborts the swap.
981 bool SwapInInternal();
alexmosf65a795a2017-01-12 22:04:00982
Albert J. Wong7bbf22d2018-12-20 00:27:27983 // Returns the RenderWidget associated with the main frame.
984 // TODO(ajwong): This method should go away when cross-frame property setting
985 // events moves into RenderWidget.
986 RenderWidget* GetMainFrameRenderWidget();
987
Mario Sanchez Prada60a014b72020-02-20 19:08:06988 // Checks whether accessibility support for this frame is currently enabled.
989 bool IsAccessibilityEnabled() const;
990
[email protected]b70da4c2014-01-06 19:57:09991 // IPC message handlers ------------------------------------------------------
992 //
993 // The documentation for these functions should be in
994 // content/common/*_messages.h for the message that the function is handling.
Nasko Oskov0f3cbb12020-01-07 17:52:14995 void OnUnload(int proxy_routing_id,
996 bool is_loading,
Dave Tapuska84449382020-05-01 00:39:04997 const FrameReplicationState& replicated_frame_state,
998 const base::UnguessableToken& frame_token);
danakjf2342432019-05-15 21:46:09999 void OnDeleteFrame(FrameDeleteIntention intent);
[email protected]a09d53ce2014-01-31 00:46:421000 void OnShowContextMenu(const gfx::Point& location);
1001 void OnContextMenuClosed(const CustomContextMenuContext& custom_context);
1002 void OnCustomContextMenuAction(const CustomContextMenuContext& custom_context,
1003 unsigned action);
Dave Tapuskab336b922017-07-06 19:24:051004 void OnMoveCaret(const gfx::Point& point);
1005 void OnScrollFocusedEditableNodeIntoRect(const gfx::Rect& rect);
christiankaeed9862014-11-05 10:49:141006 void OnSelectRange(const gfx::Point& base, const gfx::Point& extent);
Haiyang Pan980fb0f2020-07-20 18:26:461007 void OnVisualStateRequest(uint64_t key);
avi6b8dbb32016-04-08 18:59:351008 void OnSuppressFurtherDialogs();
dimich6bca00ee2017-03-21 04:54:311009 void OnMixedContentFound(const FrameMsg_MixedContentFound_Params& params);
haibinluc643d33c2016-06-03 02:22:341010
Mark Lieu6cf3e8fa2019-03-09 02:09:011011 // Callback scheduled from SerializeAsMHTML for when writing serialized
Mark Lieuc625be62019-04-04 22:42:491012 // MHTML to the handle has been completed in the file thread.
1013 void OnWriteMHTMLComplete(
Mark Lieu6cf3e8fa2019-03-09 02:09:011014 SerializeAsMHTMLCallback callback,
1015 std::unordered_set<std::string> serialized_resources_uri_digests,
carlosk27fa0652016-10-05 23:10:361016 base::TimeDelta main_thread_use_time,
Mark Lieuc48b6cc2019-03-13 22:55:571017 mojom::MhtmlSaveStatus save_status);
carlosk27fa0652016-10-05 23:10:361018
Arthur Hemerybee4a752019-05-29 10:50:551019 // Requests that the browser process navigates to |url|.
1020 void OpenURL(std::unique_ptr<blink::WebNavigationInfo> info);
[email protected]a09d53ce2014-01-31 00:46:421021
Yuzhu Shen0c1715f2018-01-27 03:48:501022 // Returns a ChildURLLoaderFactoryBundle which can be used to request
1023 // subresources for this frame.
1024 // For frames with committed navigations, this bundle is created with the
1025 // factories provided by the browser at navigation time. For any other frames
1026 // (i.e. frames on the initial about:blank Document), the bundle returned here
1027 // is lazily cloned from the parent or opener's own bundle.
1028 ChildURLLoaderFactoryBundle* GetLoaderFactoryBundle();
1029
Lukasz Anforowiczcf7f598e2019-08-08 19:05:451030 // Clones and returns the creator's (parent's or opener's)
1031 // ChildURLLoaderFactoryBundle.
1032 scoped_refptr<ChildURLLoaderFactoryBundle>
1033 GetLoaderFactoryBundleFromCreator();
1034
1035 scoped_refptr<ChildURLLoaderFactoryBundle> CreateLoaderFactoryBundle(
Dominic Farolinobc280d22019-12-05 05:49:241036 std::unique_ptr<blink::PendingURLLoaderFactoryBundle> info,
Hiroki Nakagawad7ed213e2020-07-21 13:19:281037 base::Optional<std::vector<blink::mojom::TransferrableURLLoaderPtr>>
Tsuyoshi Horo2cf21db2018-10-04 08:01:111038 subresource_overrides,
Kinuko Yasuda8fb556c2019-07-16 05:47:551039 mojo::PendingRemote<network::mojom::URLLoaderFactory>
1040 prefetch_loader_factory);
clamyd6983032015-04-29 14:48:121041
[email protected]ef3adfc2014-05-11 00:04:541042 // Update current main frame's encoding and send it to browser window.
1043 // Since we want to let users see the right encoding info from menu
1044 // before finishing loading, we call the UpdateEncoding in
1045 // a) function:DidCommitLoadForFrame. When this function is called,
1046 // that means we have got first data. In here we try to get encoding
1047 // of page if it has been specified in http header.
1048 // b) function:DidReceiveTitle. When this function is called,
1049 // that means we have got specified title. Because in most of webpages,
1050 // title tags will follow meta tags. In here we try to get encoding of
1051 // page if it has been specified in meta tag.
1052 // c) function:DidFinishDocumentLoadForFrame. When this function is
1053 // called, that means we have got whole html page. In here we should
1054 // finally get right encoding of page.
Adithya Srinivasan57f44d0d2019-03-22 15:36:021055 void UpdateEncoding(blink::WebFrame* frame, const std::string& encoding_name);
[email protected]ef3adfc2014-05-11 00:04:541056
Avi Drissman4544828f2019-03-11 20:37:321057 base::Value GetJavaScriptExecutionResult(v8::Local<v8::Value> result);
zeeshanq3454e9c2014-09-04 21:30:281058
Antonio Gomes32f24faf2019-08-18 16:41:361059 void InitializeMediaStreamDeviceObserver();
[email protected]96307312014-05-04 01:00:191060
avi5cad4912015-06-19 05:25:441061 // Does preparation for the navigation to |url|.
1062 void PrepareRenderViewForNavigation(
clamyda97e8322014-10-07 21:57:251063 const GURL& url,
Lucas Furukawa Gadania9c45682019-07-31 22:05:141064 const mojom::CommitNavigationParams& commit_params);
clamyda97e8322014-10-07 21:57:251065
arthursonzogni69824eb2016-07-13 16:22:031066 // Sends a FrameHostMsg_BeginNavigation to the browser
Arthur Hemerybee4a752019-05-29 10:50:551067 void BeginNavigationInternal(std::unique_ptr<blink::WebNavigationInfo> info,
Katie Dilloneb6c69812020-07-10 23:29:201068 bool is_history_navigation_in_new_child_frame,
1069 base::TimeTicks renderer_before_unload_start,
1070 base::TimeTicks renderer_before_unload_end);
clamyece38882014-11-19 15:00:201071
arthursonzognibe9935c2019-07-10 16:28:531072 // Used to load the initial empty document. This one is special, since it
1073 // isn't the result of a navigation.
Rakina Zata Amni15de0d32020-01-28 11:38:401074 // TODO(rakina): Rename the method now that this is only used for the
1075 // special case of committing the initial empty document.
Nate Chapina10f3d552018-12-17 20:05:261076 void CommitSyncNavigation(std::unique_ptr<blink::WebNavigationInfo> info);
1077
Dmitry Gozmanf5b5c5c2019-02-07 00:32:321078 // Commit navigation with |navigation_params| prepared.
1079 void CommitNavigationWithParams(
Lucas Furukawa Gadanief8290a2019-07-29 20:27:511080 mojom::CommonNavigationParamsPtr common_params,
Lucas Furukawa Gadania9c45682019-07-31 22:05:141081 mojom::CommitNavigationParamsPtr commit_params,
Dominic Farolinobc280d22019-12-05 05:49:241082 std::unique_ptr<blink::PendingURLLoaderFactoryBundle>
Dmitry Gozmanf5b5c5c2019-02-07 00:32:321083 subresource_loader_factories,
Hiroki Nakagawad7ed213e2020-07-21 13:19:281084 base::Optional<std::vector<blink::mojom::TransferrableURLLoaderPtr>>
Dmitry Gozmanf5b5c5c2019-02-07 00:32:321085 subresource_overrides,
1086 blink::mojom::ControllerServiceWorkerInfoPtr
1087 controller_service_worker_info,
Hiroki Nakagawa74cdcf32020-05-15 04:57:211088 blink::mojom::ServiceWorkerContainerInfoForClientPtr container_info,
Kinuko Yasuda8fb556c2019-07-16 05:47:551089 mojo::PendingRemote<network::mojom::URLLoaderFactory>
1090 prefetch_loader_factory,
Dmitry Gozmanf5b5c5c2019-02-07 00:32:321091 std::unique_ptr<DocumentState> document_state,
1092 std::unique_ptr<blink::WebNavigationParams> navigation_params);
1093
1094 // We can ignore renderer-initiated navigations which have been canceled
1095 // in the renderer, but browser was not aware yet at the moment of issuing
1096 // a CommitNavigation call.
1097 bool ShouldIgnoreCommitNavigation(
Lucas Furukawa Gadania9c45682019-07-31 22:05:141098 const mojom::CommitNavigationParams& commit_params);
Dmitry Gozmanf5b5c5c2019-02-07 00:32:321099
Dmitry Gozman7038dae2018-12-05 23:23:331100 // Decodes a data url for navigation commit.
Lucas Furukawa Gadanief8290a2019-07-29 20:27:511101 void DecodeDataURL(const mojom::CommonNavigationParams& common_params,
Lucas Furukawa Gadania9c45682019-07-31 22:05:141102 const mojom::CommitNavigationParams& commit_params,
Dmitry Gozman7038dae2018-12-05 23:23:331103 std::string* mime_type,
1104 std::string* charset,
1105 std::string* data,
1106 GURL* base_url);
clamy4cc9b8202015-03-02 13:51:361107
clamy62b271d2015-04-16 11:54:571108 bool ShouldDisplayErrorPageForFailedLoad(int error_code,
1109 const GURL& unreachable_url);
1110
Dmitry Gozman710d69b2019-10-10 23:18:221111 // |transition_type| corresponds to the document which triggered this request.
Dmitry Gozman7335cab2019-03-20 03:31:401112 void WillSendRequestInternal(blink::WebURLRequest& request,
Kinuko Yasuda881484e72020-02-08 00:37:051113 bool for_main_frame,
Dmitry Gozmanfdbe5042019-04-17 18:26:051114 ui::PageTransition transition_type);
Dmitry Gozman4604d6e52019-03-14 03:00:461115
[email protected]f3a95312014-06-12 16:46:581116 // Returns the URL being loaded by the |frame_|'s request.
1117 GURL GetLoadingUrl() const;
1118
brettw4b461082016-11-19 18:55:161119#if BUILDFLAG(ENABLE_PLUGINS)
dominicknf7d1f952016-11-19 01:52:091120 void HandlePepperImeCommit(const base::string16& text);
1121#endif // ENABLE_PLUGINS
1122
ben155ecf82016-06-21 22:43:261123 void RegisterMojoInterfaces();
halton.huoca2eabd2015-07-06 08:17:401124
skyostilb4cce1b2016-03-31 17:56:341125 void InitializeBlameContext(RenderFrameImpl* parent_frame);
1126
benb932d5a2017-04-26 19:40:131127 // service_manager::mojom::InterfaceProvider:
1128 void GetInterface(const std::string& interface_name,
1129 mojo::ScopedMessagePipeHandle interface_pipe) override;
1130
Gyuyoung Kim88708332020-07-01 03:21:021131 // Send |callback| our AndroidOverlay routing token.
liberato2ff93ad2017-05-17 07:28:241132 void RequestOverlayRoutingToken(media::RoutingTokenCallback callback);
liberatoa8da3b52017-05-02 20:23:511133
Miyoung Shin072d4052020-07-13 07:52:441134 void BindWebUIReceiver(mojo::PendingReceiver<mojom::WebUI> receiver);
1135
Lukasz Anforowiczc9513682020-03-11 03:13:261136 void ShowDeferredContextMenu(const UntrustworthyContextMenuParams& params);
Pedro Amaral741b117e02017-08-29 01:21:361137
Arthur Hemery268be322018-01-08 17:25:291138 // Build DidCommitProvisionalLoad_Params based on the frame internal state.
1139 std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params>
ckitagawac2e43402020-01-17 00:09:251140 MakeDidCommitProvisionalLoadParams(
1141 blink::WebHistoryCommitType commit_type,
1142 ui::PageTransition transition,
1143 const base::Optional<base::UnguessableToken>& embedding_token);
Arthur Hemery268be322018-01-08 17:25:291144
Arthur Hemery2c613fa42018-01-08 09:36:321145 // Updates the navigation history depending on the passed parameters.
1146 // This could result either in the creation of a new entry or a modification
1147 // of the current entry or nothing. If a new entry was created,
1148 // returns true, false otherwise.
Darin Fisher2d2b194f2019-11-14 22:45:481149 void UpdateNavigationHistory(const blink::WebHistoryItem& item,
Arthur Hemery2c613fa42018-01-08 09:36:321150 blink::WebHistoryCommitType commit_type);
1151
Arthur Hemeryb94d3db2018-01-08 12:42:421152 // Notify render_view_ observers that a commit happened.
Dmitry Gozman02dd8272020-06-09 20:01:231153 void NotifyObserversOfNavigationCommit(ui::PageTransition transition);
Arthur Hemeryb94d3db2018-01-08 12:42:421154
Arthur Hemeryc23999c2018-01-11 19:29:101155 // Updates the internal state following a navigation commit. This should be
1156 // called before notifying the FrameHost of the commit.
1157 void UpdateStateForCommit(const blink::WebHistoryItem& item,
Dmitry Gozman730b21c2018-09-19 19:44:251158 blink::WebHistoryCommitType commit_type,
1159 ui::PageTransition transition);
Arthur Hemeryc23999c2018-01-11 19:29:101160
Arthur Hemery7b0ae492018-02-05 16:04:451161 // Internal function used by same document navigation as well as cross
1162 // document navigation that updates the state of the RenderFrameImpl and sends
1163 // a commit message to the browser process.
1164 void DidCommitNavigationInternal(
1165 const blink::WebHistoryItem& item,
1166 blink::WebHistoryCommitType commit_type,
1167 bool was_within_same_document,
Dmitry Gozman730b21c2018-09-19 19:44:251168 ui::PageTransition transition,
ckitagawac2e43402020-01-17 00:09:251169 mojom::DidCommitProvisionalLoadInterfaceParamsPtr interface_params,
1170 const base::Optional<base::UnguessableToken>& embedding_token);
Arthur Hemery7b0ae492018-02-05 16:04:451171
Meredith Lane4947b2d72018-01-24 20:54:281172 blink::WebComputedAXTree* GetOrCreateWebComputedAXTree() override;
1173
Hiroki Nakagawaea68b642018-04-13 06:24:421174 std::unique_ptr<blink::WebSocketHandshakeThrottle>
1175 CreateWebSocketHandshakeThrottle() override;
Ehsan Karamad466529d2019-05-24 03:24:431176 bool IsPluginHandledExternally(
Ehsan Karamaded879582018-08-08 02:02:291177 const blink::WebElement& plugin_element,
1178 const blink::WebURL& url,
1179 const blink::WebString& suggested_mime_type) override;
Ehsan Karamade70a0352019-02-26 15:39:421180 v8::Local<v8::Object> GetScriptableObject(
1181 const blink::WebElement& plugin_element,
1182 v8::Isolate* isolate) override;
Hiroki Nakagawaea68b642018-04-13 06:24:421183
Julie Jeongeun Kimf445fc22019-05-29 12:46:021184 void UpdateSubresourceFactory(
Dominic Farolinobc280d22019-12-05 05:49:241185 std::unique_ptr<blink::PendingURLLoaderFactoryBundle> info) override;
Julie Jeongeun Kimf445fc22019-05-29 12:46:021186
clamyaf4bf2d92018-02-06 10:54:361187 // Updates the state of this frame when asked to commit a navigation.
Lucas Furukawa Gadania9c45682019-07-31 22:05:141188 void PrepareFrameForCommit(
1189 const GURL& url,
1190 const mojom::CommitNavigationParams& commit_params);
clamyaf4bf2d92018-02-06 10:54:361191
Maks Orlovich73f374d2020-04-02 12:46:131192 // Returns true if UA (and UA client hints) overrides in renderer preferences
1193 // should be used.
1194 bool ShouldUseUserAgentOverride() const;
1195
clamyaf4bf2d92018-02-06 10:54:361196 // Updates the state when asked to commit a history navigation. Sets
1197 // |item_for_history_navigation| and |load_type| to the appropriate values for
1198 // commit.
1199 //
1200 // The function will also return whether to proceed with the commit of a
1201 // history navigation or not. This can return false when the state of the
1202 // history in the browser process goes out of sync with the renderer process.
1203 // This can happen in the following scenario:
1204 // * this RenderFrame has a document with URL foo, which does a push state
1205 // to foo#bar.
1206 // * the user starts a navigation to foo/bar.
1207 // * the browser process asks this renderer process to commit the navigation
1208 // to foo/bar.
1209 // * the browser process starts a navigation back to foo, which it
1210 // considers same-document since the navigation to foo/bar hasn't
1211 // committed yet. It asks the RenderFrame to commit the same-document
1212 // navigation to foo#bar.
1213 // * by the time the RenderFrame receives the call to commit the
1214 // same-document back navigation, the navigation to foo/bar has committed.
1215 // A back navigation to foo is no longer same-document with the current
1216 // document of the RenderFrame (foo/bar). Therefore, the navigation cannot
1217 // be committed as a same-document navigation.
1218 // When this happens, the navigation will be sent back to the browser process
1219 // so that it can be performed in cross-document fashion.
1220 blink::mojom::CommitResult PrepareForHistoryNavigationCommit(
Lucas Furukawa Gadanief8290a2019-07-29 20:27:511221 const mojom::CommonNavigationParams& common_params,
Lucas Furukawa Gadania9c45682019-07-31 22:05:141222 const mojom::CommitNavigationParams& commit_params,
clamyaf4bf2d92018-02-06 10:54:361223 blink::WebHistoryItem* item_for_history_navigation,
1224 blink::WebFrameLoadType* load_type);
1225
Arthur Hemeryb8ead262019-03-18 12:13:461226 // Ignores the navigation commit and stop its processing in the RenderFrame.
1227 // This will drop the NavigationRequest in the RenderFrameHost.
1228 // Note: This is only meant to be used before building the DocumentState.
1229 // Commit abort and navigation end is handled by it afterwards.
Dmitry Gozman9b890002020-05-27 15:24:421230 void AbortCommitNavigation();
Arthur Hemeryb8ead262019-03-18 12:13:461231
Lily Chenee280942019-06-14 22:31:111232 // Implements AddMessageToConsole().
1233 void AddMessageToConsoleImpl(blink::mojom::ConsoleMessageLevel level,
1234 const std::string& message,
1235 bool discard_duplicates);
1236
creiscfaa4462015-03-16 19:27:181237 // Stores the WebLocalFrame we are associated with. This is null from the
Daniel Chengbd3794202017-06-21 09:30:101238 // constructor until BindToFrame() is called, and it is null after
1239 // FrameDetached() is called until destruction (which is asynchronous in the
creiscfaa4462015-03-16 19:27:181240 // case of the main frame, but not subframes).
Dmitry Gozmand96e493a82018-11-28 01:13:331241 blink::WebNavigationControl* frame_ = nullptr;
[email protected]b70da4c2014-01-06 19:57:091242
dglazkov2e140f52015-09-28 16:10:071243 // Boolean value indicating whether this RenderFrameImpl object is for the
1244 // main frame or not. It remains accurate during destruction, even when
1245 // |frame_| has been invalidated.
1246 bool is_main_frame_;
nasko8b9d9bd2015-05-06 19:23:191247
dcheng61b2c9222017-05-25 23:10:111248 class UniqueNameFrameAdapter : public UniqueNameHelper::FrameAdapter {
1249 public:
1250 explicit UniqueNameFrameAdapter(RenderFrameImpl* render_frame);
1251 ~UniqueNameFrameAdapter() override;
1252
1253 // FrameAdapter overrides:
1254 bool IsMainFrame() const override;
Daniel Cheng6ca7f1c92017-08-09 21:45:411255 bool IsCandidateUnique(base::StringPiece name) const override;
dcheng61b2c9222017-05-25 23:10:111256 int GetSiblingCount() const override;
1257 int GetChildCount() const override;
Anders Hartvoll Ruud4bb45c62020-07-10 17:10:551258 std::vector<std::string> CollectAncestorNames(
dcheng61b2c9222017-05-25 23:10:111259 BeginPoint begin_point,
1260 bool (*should_stop)(base::StringPiece)) const override;
1261 std::vector<int> GetFramePosition(BeginPoint begin_point) const override;
1262
1263 private:
1264 blink::WebLocalFrame* GetWebFrame() const;
1265
1266 RenderFrameImpl* render_frame_;
1267 };
1268 UniqueNameFrameAdapter unique_name_frame_adapter_;
Daniel Cheng999698bd2017-03-22 04:56:371269 UniqueNameHelper unique_name_helper_;
1270
naskoeab5c5582015-12-15 05:20:001271 // Indicates whether the frame has been inserted into the frame tree yet or
1272 // not.
1273 //
1274 // When a frame is created by the browser process, it is for a pending
1275 // navigation. In this case, it is not immediately attached to the frame tree
1276 // if there is a RenderFrameProxy for the same frame. It is inserted into the
1277 // frame tree at the time the pending navigation commits.
1278 // Frames added by the parent document are created from the renderer process
1279 // and are immediately inserted in the frame tree.
1280 // TODO(dcheng): Remove this once we have FrameTreeHandle and can use the
1281 // Blink Web* layer to check for provisional frames.
1282 bool in_frame_tree_;
1283
wjmaclean2a6cab72016-11-03 18:36:401284 RenderViewImpl* render_view_;
Fergal Dalyc93b7352020-04-07 19:47:431285 const int routing_id_;
nasko8b9d9bd2015-05-06 19:23:191286
arthursonzogni1efc7b962019-03-14 09:36:331287 // If this RenderFrame was created to replace a previous object, this will
1288 // store its routing id. The previous object can be:
1289 // - A RenderFrame. This requires RenderDocument to be enabled.
1290 // - A RenderFrameProxy.
1291 // At commit time, the two objects will be swapped and the old one cleared.
1292 int previous_routing_id_;
japhete6adf142014-10-31 00:01:491293
dcheng3d886b732015-11-05 19:16:011294 // Non-null when the RenderFrame is a local root for compositing, input,
1295 // layout, etc. A local frame is also a local root iff it does not have a
1296 // parent that is a local frame.
Erik Chen3433ee02019-08-05 20:14:261297 RenderWidget* render_widget_ = nullptr;
1298
1299 // If this is a main frame, the RenderView owns the RenderWidget and this
1300 // member is null. If this is a child frame, then this object owns the
1301 // RenderWidget and this member is not null.
1302 std::unique_ptr<RenderWidget> owned_render_widget_;
kenrba7199832015-01-22 23:44:591303
creisc8ca51e2016-09-29 23:10:281304 // Keeps track of which future subframes the browser process has history items
Charles Reis37c95492016-10-21 20:38:581305 // for during a history navigation, as well as whether those items are for
1306 // about:blank. The renderer process should ask the browser for history items
1307 // when subframes with these names are created (as long as they are not
1308 // staying at about:blank), and directly load the initial URLs for any other
1309 // subframes.
1310 //
1311 // This state is incrementally cleared as it is used and then reset in
1312 // didStopLoading, since it is not needed after the first load completes and
1313 // is never used after the initial navigation.
creisc8ca51e2016-09-29 23:10:281314 // TODO(creis): Expand this to include any corresponding same-process
1315 // PageStates for the whole subtree in https://crbug.com/639842.
Lucas Furukawa Gadania9c45682019-07-31 22:05:141316 base::flat_map<std::string, bool> history_subframe_unique_names_;
creis45b3bba2016-09-22 22:47:131317
creis8eb8ef22015-11-04 22:51:381318 // Stores the current history item for this frame, so that updates to it can
1319 // be reported to the browser process via SendUpdateState.
1320 blink::WebHistoryItem current_history_item_;
1321
brettw4b461082016-11-19 18:55:161322#if BUILDFLAG(ENABLE_PLUGINS)
[email protected]7a4e2532013-12-02 21:30:021323 // Current text input composition text. Empty if no composition is in
1324 // progress.
[email protected]fcf75d42013-12-03 20:11:261325 base::string16 pepper_composition_text_;
tommyclieb25b2a2014-11-03 19:45:091326
tommycli59bd86c2014-12-10 02:09:381327 PluginPowerSaverHelper* plugin_power_saver_helper_;
[email protected]7a4e2532013-12-02 21:30:021328#endif
1329
[email protected]2e2d9632013-12-03 00:55:261330 // All the registered observers.
Trent Apteda250ec3ab2018-08-19 08:52:191331 base::ObserverList<RenderFrameObserver>::Unchecked observers_;
[email protected]2e2d9632013-12-03 00:55:261332
[email protected]a09d53ce2014-01-31 00:46:421333 // External context menu requests we're waiting for. "Internal"
1334 // (WebKit-originated) context menu events will have an ID of 0 and will not
1335 // be in this map.
1336 //
1337 // We don't want to add internal ones since some of the "special" page
1338 // handlers in the browser process just ignore the context menu requests so
1339 // avoid showing context menus, and so this will cause right clicks to leak
1340 // entries in this map. Most users of the custom context menu (e.g. Pepper
1341 // plugins) are normally only on "regular" pages and the regular pages will
1342 // always respond properly to the request, so we don't have to worry so
1343 // much about leaks.
Brett Wilsonf976d3f2017-08-18 17:23:391344 base::IDMap<ContextMenuClient*> pending_context_menus_;
[email protected]a09d53ce2014-01-31 00:46:421345
[email protected]4ee64622014-03-21 22:34:151346 // The text selection the last time DidChangeSelection got called. May contain
1347 // additional characters before and after the selected text, for IMEs. The
1348 // portion of this string that is the actual selected text starts at index
1349 // |selection_range_.GetMin() - selection_text_offset_| and has length
1350 // |selection_range_.length()|.
1351 base::string16 selection_text_;
1352 // The offset corresponding to the start of |selection_text_| in the document.
1353 size_t selection_text_offset_;
1354 // Range over the document corresponding to the actual selected text (which
1355 // could correspond to a substring of |selection_text_|; see above).
1356 gfx::Range selection_range_;
[email protected]4ee64622014-03-21 22:34:151357
Guido Urdanetad8c24a5212019-08-03 08:35:461358 // Implements getUserMedia() and related functionality.
Antonio Gomes32f24faf2019-08-18 16:41:361359 std::unique_ptr<blink::WebMediaStreamDeviceObserver>
1360 web_media_stream_device_observer_;
[email protected]96307312014-05-04 01:00:191361
Guido Urdaneta3a7cd9e62020-07-21 08:31:281362 mojo::Remote<blink::mojom::RendererAudioInputStreamFactory>
Mario Sanchez Prada22694e5a2019-09-13 07:16:571363 audio_input_stream_factory_;
Max Morin3d464a42018-01-15 11:17:001364
xhwang6bca21e2016-02-06 00:21:451365 // The media permission dispatcher attached to this frame.
dchengcedca5612016-04-09 01:40:151366 std::unique_ptr<MediaPermissionDispatcher> media_permission_dispatcher_;
xhwang36b1f3b2015-01-27 17:54:011367
Ben Goodgerd5ee3cc2017-07-24 23:11:361368 service_manager::BinderRegistry registry_;
Balazs Engedyba034e72017-10-27 22:26:281369 service_manager::InterfaceProvider remote_interfaces_;
sammc7f964632016-10-14 04:16:211370 std::unique_ptr<BlinkInterfaceRegistryImpl> blink_interface_registry_;
[email protected]c52a1412014-06-25 06:09:251371
Oksana Zhuravlovafee097c2019-07-26 17:01:301372 blink::BrowserInterfaceBrokerProxy browser_interface_broker_proxy_;
Oksana Zhuravlova8b88e572019-01-07 21:54:001373
Mario Sanchez Prada60a014b72020-02-20 19:08:061374 // Valid during the entire life time of the RenderFrame.
1375 std::unique_ptr<RenderAccessibilityManager> render_accessibility_manager_;
[email protected]95640212014-07-26 18:14:301376
xiaochengh01c3b102016-06-13 23:56:081377 std::unique_ptr<FrameBlameContext> blame_context_;
skyostilb4cce1b2016-03-31 17:56:341378
lfge0c2792ec2016-05-11 18:52:081379 // Plugins -------------------------------------------------------------------
brettw4b461082016-11-19 18:55:161380#if BUILDFLAG(ENABLE_PLUGINS)
lfge0c2792ec2016-05-11 18:52:081381 typedef std::set<PepperPluginInstanceImpl*> PepperPluginSet;
1382 PepperPluginSet active_pepper_instances_;
1383
1384 // Whether or not the focus is on a PPAPI plugin
1385 PepperPluginInstanceImpl* focused_pepper_plugin_;
1386
1387 // The plugin instance that received the last mouse event. It is set to NULL
1388 // if the last mouse event went to elements other than Pepper plugins.
1389 // |pepper_last_mouse_event_target_| is not owned by this class. We depend on
1390 // the RenderFrameImpl to NULL it out when it destructs.
1391 PepperPluginInstanceImpl* pepper_last_mouse_event_target_;
1392#endif
1393
Becca Hughes3da69b742018-04-13 19:05:061394 using AutoplayOriginAndFlags = std::pair<url::Origin, int32_t>;
1395 AutoplayOriginAndFlags autoplay_flags_;
scottmg276753cf2016-10-27 18:25:221396
Mario Sanchez Pradab3b852f2019-10-04 17:53:241397 mojo::AssociatedReceiver<blink::mojom::AutoplayConfigurationClient>
1398 autoplay_configuration_receiver_{this};
Henrique Ferreiro3a9751c2019-09-30 13:54:071399 mojo::Receiver<mojom::Frame> frame_receiver_{this};
1400 mojo::AssociatedReceiver<mojom::FrameBindingsControl>
1401 frame_bindings_control_receiver_{this};
Shimi Zhangbb738072019-07-09 18:54:401402 mojo::AssociatedReceiver<mojom::FrameNavigationControl>
Mario Sanchez Pradab3b852f2019-10-04 17:53:241403 frame_navigation_control_receiver_{this};
1404 mojo::AssociatedReceiver<mojom::FullscreenVideoElementHandler>
1405 fullscreen_receiver_{this};
1406 mojo::AssociatedReceiver<mojom::MhtmlFileWriter> mhtml_file_writer_receiver_{
1407 this};
ben76f52b242016-06-18 05:42:481408
Arthur Hemeryd3011f62018-05-30 10:38:441409 // Only used when PerNavigationMojoInterface is enabled.
1410 std::unique_ptr<NavigationClient> navigation_client_impl_;
1411
chcunningham86f025e32017-05-30 20:43:231412 // Creates various media clients.
1413 MediaFactory media_factory_;
1414
Ken Rockot26e4e802018-07-31 15:03:331415 blink::AssociatedInterfaceRegistry associated_interfaces_;
1416 std::unique_ptr<blink::AssociatedInterfaceProvider>
rockotf62002a2016-09-15 00:08:591417 remote_associated_interfaces_;
1418
Dmitry Gozman6b7727d2019-05-06 18:30:241419 // This flag is true while browser process is processing a pending navigation,
1420 // as a result of mojom::FrameHost::BeginNavigation call. It is reset when the
1421 // navigation is either committed or cancelled.
jam485372b12016-10-26 19:46:071422 bool browser_side_navigation_pending_ = false;
John Abd-El-Malek69b2a2402017-09-11 19:27:521423 GURL browser_side_navigation_pending_url_;
jam485372b12016-10-26 19:46:071424
sammc7f6c6a02017-01-30 00:53:511425 // A bitwise OR of bindings types that have been enabled for this RenderFrame.
1426 // See BindingsPolicy for details.
1427 int enabled_bindings_ = 0;
1428
Nasko Oskov8a73f7d2019-09-27 22:29:321429 // This boolean indicates whether JS bindings for Mojo should be enabled at
1430 // the time the next script context is created.
1431 bool enable_mojo_js_bindings_ = false;
1432
Mario Sanchez Pradab3b852f2019-10-04 17:53:241433 mojo::AssociatedRemote<mojom::FrameHost> frame_host_remote_;
Gyuyoung Kim6c9ce9022019-11-26 05:40:081434 mojo::ReceiverSet<service_manager::mojom::InterfaceProvider>
1435 interface_provider_receivers_;
benb932d5a2017-04-26 19:40:131436
Minggang Wangd712a912020-07-10 08:12:351437 mojo::ReceiverSet<blink::mojom::ResourceLoadInfoNotifier>
1438 resource_load_info_notifier_receivers_;
1439
Yuzhu Shen0c1715f2018-01-27 03:48:501440 // URLLoaderFactory instances used for subresource loading.
Chong Zhang4513fab2018-02-28 18:50:181441 // Depending on how the frame was created, |loader_factories_| could be:
1442 // * |HostChildURLLoaderFactoryBundle| for standalone frames, or
1443 // * |TrackedChildURLLoaderFactoryBundle| for frames opened by other frames.
Lukasz Anforowiczcf7f598e2019-08-08 19:05:451444 //
1445 // This must be updated only via SetLoaderFactoryBundle, which is called at a
1446 // certain timing - right before the new document is committed during
1447 // FrameLoader::CommitNavigation.
Yuzhu Shen0c1715f2018-01-27 03:48:501448 scoped_refptr<ChildURLLoaderFactoryBundle> loader_factories_;
Ken Rockotbe87ab322017-11-02 19:40:231449
Dmitry Gozman5e95b592020-03-04 23:01:511450 // Loader factory bundle is stored here temporary between CommitNavigation
1451 // and DidCommitNavigation calls. These happen synchronously one after
1452 // another.
1453 scoped_refptr<ChildURLLoaderFactoryBundle> pending_loader_factories_;
1454
Hiroki Nakagawa8600c372020-07-23 01:53:261455 scoped_refptr<blink::WebFrameRequestBlocker> frame_request_blocker_;
John Abd-El-Malek9405d80e2018-08-08 16:50:211456
liberatoa8da3b52017-05-02 20:23:511457 // AndroidOverlay routing token from the browser, if we have one yet.
1458 base::Optional<base::UnguessableToken> overlay_routing_token_;
1459
Navid Zolghadre71b8ec82017-12-16 07:03:361460 InputTargetClientImpl input_target_client_impl_;
1461
Pavel Feldman25234722017-10-11 02:49:061462 // Used for devtools instrumentation and trace-ability. This token is
1463 // used to tag calls and requests in order to attribute them to the context
1464 // frame.
1465 // |devtools_frame_token_| is only defined by the browser and is never
1466 // sent back from the renderer in the control calls.
Dmitry Gozmanf12caab2018-02-07 03:45:581467 base::UnguessableToken devtools_frame_token_;
Pavel Feldman25234722017-10-11 02:49:061468
EhsanKbd2cea992017-11-23 18:49:081469 // Bookkeeping to suppress redundant scroll and focus requests for an already
1470 // scrolled and focused editable node.
1471 bool has_scrolled_focused_editable_node_into_rect_ = false;
1472 gfx::Rect rect_for_scrolled_focused_editable_node_;
1473
Meredith Lane4947b2d72018-01-24 20:54:281474 // Contains a representation of the accessibility tree stored in content for
1475 // use inside of Blink.
1476 std::unique_ptr<blink::WebComputedAXTree> computed_ax_tree_;
1477
Lucas Gadani471160f92018-03-01 03:13:211478 // Used for tracking the frame's size and replicating it to the browser
1479 // process when it changes.
1480 base::Optional<gfx::Size> frame_size_;
1481
Justin Mironc3452f92020-01-24 14:31:091482 // Used for tracking a frame's main frame document intersection and
1483 // and replicating it to the browser when it changes.
Justin Miron95fddee2020-07-10 16:46:371484 base::Optional<blink::WebRect> mainframe_intersection_rect_;
Justin Mironc3452f92020-01-24 14:31:091485
Hiroki Nakagawaea68b642018-04-13 06:24:421486 std::unique_ptr<WebSocketHandshakeThrottleProvider>
1487 websocket_handshake_throttle_provider_;
1488
Sergey Volk8b09c2c52018-12-12 23:20:401489 RenderFrameMediaPlaybackOptions renderer_media_playback_options_;
1490
Dmitry Gozmanf5b5c5c2019-02-07 00:32:321491 class MHTMLBodyLoaderClient;
1492 std::unique_ptr<MHTMLBodyLoaderClient> mhtml_body_loader_client_;
1493
Vladimir Levincfca8522019-07-30 19:01:211494 std::unique_ptr<blink::WebURLLoaderFactoryForTest>
Vladimir Levinb41bfe42019-07-16 21:13:441495 web_url_loader_factory_override_for_test_;
1496
Jeremy Roman3bca4bf2019-07-11 03:41:251497 base::WeakPtrFactory<RenderFrameImpl> weak_factory_{this};
[email protected]96307312014-05-04 01:00:191498
[email protected]227692c52013-05-31 22:43:041499 DISALLOW_COPY_AND_ASSIGN(RenderFrameImpl);
1500};
1501
1502} // namespace content
1503
[email protected]85d85fd2013-06-19 00:57:411504#endif // CONTENT_RENDERER_RENDER_FRAME_IMPL_H_