/
render_frame_host_impl.h
4963 lines (4282 loc) · 234 KB
/
render_frame_host_impl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_FRAME_HOST_IMPL_H_
#define CONTENT_BROWSER_RENDERER_HOST_RENDER_FRAME_HOST_IMPL_H_
#include <stddef.h>
#include <stdint.h>
#include <cstdint>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/containers/unique_ptr_adapters.h"
#include "base/files/file_path.h"
#include "base/functional/callback.h"
#include "base/functional/function_ref.h"
#include "base/gtest_prod_util.h"
#include "base/i18n/rtl.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/process/kill.h"
#include "base/strings/string_piece.h"
#include "base/supports_user_data.h"
#include "base/task/sequenced_task_runner.h"
#include "base/threading/sequence_bound.h"
#include "base/time/time.h"
#include "base/timer/timer.h"
#include "base/tracing/protos/chrome_track_event.pbzero.h"
#include "base/types/pass_key.h"
#include "base/unguessable_token.h"
#include "build/build_config.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
#include "content/browser/accessibility/web_ax_platform_tree_manager_delegate.h"
#include "content/browser/bad_message.h"
#include "content/browser/browser_interface_broker_impl.h"
#include "content/browser/buckets/bucket_context.h"
#include "content/browser/can_commit_status.h"
#include "content/browser/network/cross_origin_opener_policy_reporter.h"
#include "content/browser/renderer_host/agent_scheduling_group_host.h"
#include "content/browser/renderer_host/back_forward_cache_impl.h"
#include "content/browser/renderer_host/back_forward_cache_metrics.h"
#include "content/browser/renderer_host/browsing_context_state.h"
#include "content/browser/renderer_host/code_cache_host_impl.h"
#include "content/browser/renderer_host/cross_origin_opener_policy_access_report_manager.h"
#include "content/browser/renderer_host/frame_navigation_entry.h"
#include "content/browser/renderer_host/keep_alive_handle_factory.h"
#include "content/browser/renderer_host/media/render_frame_audio_input_stream_factory.h"
#include "content/browser/renderer_host/media/render_frame_audio_output_stream_factory.h"
#include "content/browser/renderer_host/navigation_discard_reason.h"
#include "content/browser/renderer_host/page_impl.h"
#include "content/browser/renderer_host/pending_beacon_host.h"
#include "content/browser/renderer_host/policy_container_host.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/runtime_feature_state_controller_impl.h"
#include "content/browser/renderer_host/transient_allow_popup.h"
#include "content/browser/site_instance_group.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/storage_partition_impl.h"
#include "content/common/buildflags.h"
#include "content/common/content_export.h"
#include "content/common/dom_automation_controller.mojom.h"
#include "content/common/frame.mojom.h"
#include "content/common/input/input_injector.mojom-forward.h"
#include "content/common/navigation_client.mojom-forward.h"
#include "content/common/navigation_client.mojom.h"
#include "content/public/browser/back_forward_cache.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/global_request_id.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/javascript_dialog_manager.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_ui.h"
#include "content/public/common/content_client.h"
#include "content/public/common/extra_mojo_js_features.mojom-forward.h"
#include "content/public/common/javascript_dialog_type.h"
#include "media/mojo/mojom/interface_factory.mojom-forward.h"
#include "media/mojo/mojom/media_metrics_provider.mojom-forward.h"
#include "media/mojo/mojom/media_player.mojom-forward.h"
#include "media/mojo/services/media_metrics_provider.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe.h"
#include "net/base/isolation_info.h"
#include "net/base/network_isolation_key.h"
#include "net/cookies/cookie_setting_override.h"
#include "net/net_buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/device/public/mojom/sensor_provider.mojom-forward.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/cpp/cross_origin_embedder_policy.h"
#include "services/network/public/cpp/cross_origin_opener_policy.h"
#include "services/network/public/mojom/cookie_access_observer.mojom.h"
#include "services/network/public/mojom/fetch_api.mojom-forward.h"
#include "services/network/public/mojom/mdns_responder.mojom.h"
#include "services/network/public/mojom/url_loader_network_service_observer.mojom-forward.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/frame/delegated_capability_request_token.h"
#include "third_party/blink/public/common/frame/frame_owner_element_type.h"
#include "third_party/blink/public/common/frame/history_user_activation_state.h"
#include "third_party/blink/public/common/frame/user_activation_state.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy.h"
#include "third_party/blink/public/common/permissions_policy/permissions_policy_declaration.h"
#include "third_party/blink/public/common/scheduler/web_scheduler_tracked_feature.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/common/tokens/tokens.h"
#include "third_party/blink/public/mojom/back_forward_cache_not_restored_reasons.mojom.h"
#include "third_party/blink/public/mojom/blob/blob_url_store.mojom-forward.h"
#include "third_party/blink/public/mojom/bluetooth/web_bluetooth.mojom-forward.h"
#include "third_party/blink/public/mojom/broadcastchannel/broadcast_channel.mojom.h"
#include "third_party/blink/public/mojom/feature_observer/feature_observer.mojom-forward.h"
#include "third_party/blink/public/mojom/file_system_access/file_system_access_manager.mojom-forward.h"
#include "third_party/blink/public/mojom/filesystem/file_system.mojom-forward.h"
#include "third_party/blink/public/mojom/font_access/font_access.mojom-forward.h"
#include "third_party/blink/public/mojom/frame/back_forward_cache_controller.mojom.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
#include "third_party/blink/public/mojom/frame/frame.mojom-forward.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
#include "third_party/blink/public/mojom/frame/frame_owner_properties.mojom-forward.h"
#include "third_party/blink/public/mojom/frame/reporting_observer.mojom-forward.h"
#include "third_party/blink/public/mojom/idle/idle_manager.mojom-forward.h"
#include "third_party/blink/public/mojom/image_downloader/image_downloader.mojom.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom-forward.h"
#include "third_party/blink/public/mojom/installedapp/installed_app_provider.mojom-forward.h"
#include "third_party/blink/public/mojom/loader/resource_load_info.mojom-forward.h"
#include "third_party/blink/public/mojom/navigation/navigation_params.mojom-forward.h"
#include "third_party/blink/public/mojom/navigation/navigation_params.mojom.h"
#include "third_party/blink/public/mojom/navigation/renderer_eviction_reason.mojom.h"
#include "third_party/blink/public/mojom/notifications/notification_service.mojom-forward.h"
#include "third_party/blink/public/mojom/peerconnection/peer_connection_tracker.mojom-forward.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-forward.h"
#include "third_party/blink/public/mojom/portal/portal.mojom-forward.h"
#include "third_party/blink/public/mojom/presentation/presentation.mojom-forward.h"
#include "third_party/blink/public/mojom/render_accessibility.mojom.h"
#include "third_party/blink/public/mojom/runtime_feature_state/runtime_feature_state_controller.mojom.h"
#include "third_party/blink/public/mojom/security_context/insecure_request_policy.mojom-forward.h"
#include "third_party/blink/public/mojom/sms/webotp_service.mojom-forward.h"
#include "third_party/blink/public/mojom/speech/speech_synthesis.mojom-forward.h"
#include "third_party/blink/public/mojom/webaudio/audio_context_manager.mojom-forward.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom-forward.h"
#include "third_party/blink/public/mojom/webauthn/virtual_authenticator.mojom-forward.h"
#include "third_party/blink/public/mojom/webid/federated_auth_request.mojom-forward.h"
#include "third_party/blink/public/mojom/websockets/websocket_connector.mojom-forward.h"
#include "third_party/blink/public/mojom/webtransport/web_transport_connector.mojom-forward.h"
#include "third_party/blink/public/mojom/worker/dedicated_worker_host_factory.mojom-forward.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/accessibility/ax_action_handler_base.h"
#include "ui/accessibility/ax_node_id_forward.h"
#include "ui/accessibility/platform/ax_platform_tree_manager.h"
#include "ui/base/page_transition_types.h"
#include "ui/gfx/geometry/rect.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_ANDROID)
#include "base/containers/id_map.h"
#include "services/device/public/mojom/nfc.mojom.h"
#else
#include "third_party/blink/public/mojom/hid/hid.mojom-forward.h"
#include "third_party/blink/public/mojom/serial/serial.mojom-forward.h"
#endif
#if BUILDFLAG(IS_CHROMEOS)
#include "third_party/blink/public/mojom/smart_card/smart_card.mojom-forward.h"
#endif
#if BUILDFLAG(ENABLE_MEDIA_REMOTING)
#include "media/mojo/mojom/remoting.mojom-forward.h"
#endif
namespace blink {
class AssociatedInterfaceRegistry;
class DocumentPolicy;
struct FramePolicy;
struct TransferableMessage;
struct UntrustworthyContextMenuParams;
namespace mojom {
class CacheStorage;
class DeviceAPIService;
class GeolocationService;
class ManagedConfigurationService;
class WebUsbService;
} // namespace mojom
} // namespace blink
namespace gfx {
class Range;
}
namespace mojo {
class MessageFilter;
}
namespace network {
class ResourceRequestBody;
} // namespace network
namespace ui {
class ClipboardFormatType;
}
namespace ukm {
class UkmRecorder;
}
namespace features {
// Feature to prevent name updates to RenderFrameHost (and by extension its
// relevant BrowsingContextState) when it is not current (i.e. is in the
// BackForwardCache or is pending delete). This primarily will affect the
// non-legacy implementation of BrowsingContextState.
CONTENT_EXPORT BASE_DECLARE_FEATURE(
kDisableFrameNameUpdateOnNonCurrentRenderFrameHost);
// Feature to evict when accessibility events occur while in back/forward cache.
CONTENT_EXPORT BASE_DECLARE_FEATURE(kEvictOnAXEvents);
// Feature to make SpeechSynthesis no longer block back/forward cache.
CONTENT_EXPORT BASE_DECLARE_FEATURE(kUnblockSpeechSynthesisForBFCache);
} // namespace features
namespace content {
namespace internal {
class DocumentServiceBase;
} // namespace internal
class BrowsingContextState;
class CodeCacheHostImpl;
class CrossOriginEmbedderPolicyReporter;
class CrossOriginOpenerPolicyAccessReportManager;
class FeatureObserver;
class FencedFrame;
class FileSystemManagerImpl;
class FrameTree;
class FrameTreeNode;
class GeolocationServiceImpl;
class PrerenderCancellationReason;
class IdleManagerImpl;
class NavigationEarlyHintsManager;
class NavigationRequest;
class PeakGpuMemoryTracker;
class PeerConnectionTrackerHost;
class Portal;
class PrefetchedSignedExchangeCache;
class PresentationServiceImpl;
class PushMessagingManager;
class RenderAccessibilityHost;
class RenderFrameHostDelegate;
class RenderFrameHostImpl;
class RenderFrameHostImplPpapiSupport;
class RenderFrameHostManager;
class RenderFrameHostOrProxy;
class RenderFrameHostOwner;
class RenderFrameProxyHost;
class RenderProcessHost;
class RenderViewHostImpl;
class RenderWidgetHostView;
class ServiceWorkerContainerHost;
class SiteInfo;
class SpeechSynthesisImpl;
class SubresourceWebBundleNavigationInfo;
class TimeoutMonitor;
class WebAuthRequestSecurityChecker;
class WebBluetoothServiceImpl;
class WebUIImpl;
struct PendingNavigation;
struct ResourceTimingInfo;
struct SubresourceLoaderParams;
// To be called when a RenderFrameHostImpl receives an event.
// Provides the host, the event fired, and which node id the event was for.
typedef base::RepeatingCallback<
void(RenderFrameHostImpl*, ax::mojom::Event, int)>
AccessibilityCallbackForTesting;
class CONTENT_EXPORT RenderFrameHostImpl
: public RenderFrameHost,
public base::SupportsUserData,
public mojom::FrameHost,
public mojom::DomAutomationControllerHost,
public WebAXPlatformTreeManagerDelegate,
public SiteInstanceGroup::Observer,
public blink::mojom::AssociatedInterfaceProvider,
public blink::mojom::BackForwardCacheControllerHost,
public blink::mojom::LocalFrameHost,
public blink::mojom::NonAssociatedLocalFrameHost,
public blink::mojom::LocalMainFrameHost,
public ui::AXActionHandlerBase,
public network::mojom::CookieAccessObserver,
public BucketContext {
public:
using JavaScriptDialogCallback =
content::JavaScriptDialogManager::DialogClosedCallback;
// Callback used with IsClipboardPasteContentAllowed() method.
using IsClipboardPasteContentAllowedCallback =
ContentBrowserClient::IsClipboardPasteContentAllowedCallback;
// An accessibility reset is only allowed to prevent very rare corner cases
// or race conditions where the browser and renderer get out of sync. If
// this happens more than this many times, kill the renderer.
// Can be set to 0 to fail immediately during tests.
static int max_accessibility_resets_;
static RenderFrameHostImpl* FromID(GlobalRenderFrameHostId id);
static RenderFrameHostImpl* FromID(int process_id, int routing_id);
// Returns the `RenderFrameHostImpl` with the given `blink::LocalFrameToken`,
// or `nullptr` if no such `RenderFrameHostImpl` exists.
//
// Note that though local frame tokens are globally unique, the process ID is
// required as a second factor to reduce the risk of inadvertent info leaks
// leading to security failures. If there is a `RenderFrameHostImpl` with a
// matching local frame token but not a matching process ID, invokes
// `process_mismatch_callback` (if non-null) and returns `nullptr`.
static RenderFrameHostImpl* FromFrameToken(
int process_id,
const blink::LocalFrameToken& frame_token,
mojo::ReportBadMessageCallback* process_mismatch_callback = nullptr);
// Returns the `RenderFrameHostImpl` with the given `blink::DocumentToken`, or
// `nullptr` if no such `RenderFrameHostImpl` exists.
//
// Note that though document tokens are globally unique, the process ID is
// required as a second factor to reduce the risk of inadvertent info leaks
// leading to security failures. If there is a `RenderFrameHostImpl` with a
// matching document token but not a matching process ID, invokes
// `process_mismatch_callback` (if non-null) and returns `nullptr`.
static RenderFrameHostImpl* FromDocumentToken(
int process_id,
const blink::DocumentToken& document_token,
mojo::ReportBadMessageCallback* process_mismatch_callback = nullptr);
static RenderFrameHostImpl* FromAXTreeID(ui::AXTreeID ax_tree_id);
static RenderFrameHostImpl* FromOverlayRoutingToken(
const base::UnguessableToken& token);
// Clears the all prefetched cached signed exchanges.
static void ClearAllPrefetchedSignedExchangeCache();
// TODO(crbug.com/1213818): Get/SetCodeCacheHostReceiverHandler are used only
// for a test in content/browser/service_worker/service_worker_browsertest
// that tests a bad message is returned on an incorrect origin. Try to find a
// way to test this without adding these additional methods.
// Allows external code to supply a callback that is invoked immediately
// after the CodeCacheHostImpl is created and bound. Used for swapping
// the binding for a test version of the service.
using CodeCacheHostReceiverHandler = base::RepeatingCallback<void(
CodeCacheHostImpl*,
mojo::ReceiverId,
mojo::UniqueReceiverSet<blink::mojom::CodeCacheHost>&)>;
static void SetCodeCacheHostReceiverHandlerForTesting(
CodeCacheHostReceiverHandler handler);
RenderFrameHostImpl(const RenderFrameHostImpl&) = delete;
RenderFrameHostImpl& operator=(const RenderFrameHostImpl&) = delete;
~RenderFrameHostImpl() override;
// RenderFrameHost
int GetRoutingID() const final;
const blink::LocalFrameToken& GetFrameToken() const override;
const base::UnguessableToken& GetReportingSource() override;
ui::AXTreeID GetAXTreeID() override;
void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback,
const ui::AXMode& ax_mode,
bool exclude_offscreen,
size_t max_nodes,
const base::TimeDelta& timeout) override;
SiteInstanceImpl* GetSiteInstance() const override;
RenderProcessHost* GetProcess() const override;
GlobalRenderFrameHostId GetGlobalId() const override;
RenderWidgetHostImpl* GetRenderWidgetHost() override;
RenderWidgetHostView* GetView() override;
RenderFrameHostImpl* GetParent() const override;
RenderFrameHostImpl* GetParentOrOuterDocument() const override;
RenderFrameHostImpl* GetParentOrOuterDocumentOrEmbedder() const override;
RenderFrameHostImpl* GetMainFrame() override;
PageImpl& GetPage() override;
bool IsInPrimaryMainFrame() override;
RenderFrameHostImpl* GetOutermostMainFrame() override;
RenderFrameHostImpl* GetOutermostMainFrameOrEmbedder() override;
bool IsFencedFrameRoot() const override;
bool IsNestedWithinFencedFrame() const override;
void ForEachRenderFrameHostWithAction(
base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame)
override;
void ForEachRenderFrameHost(
base::FunctionRef<void(RenderFrameHost*)> on_frame) override;
// TODO (crbug.com/1251545) : Frame tree node id should only be known for
// subframes. As such, update this method.
int GetFrameTreeNodeId() const override;
const base::UnguessableToken& GetDevToolsFrameToken() override;
absl::optional<base::UnguessableToken> GetEmbeddingToken() override;
const std::string& GetFrameName() override;
bool IsFrameDisplayNone() override;
const absl::optional<gfx::Size>& GetFrameSize() override;
size_t GetFrameDepth() override;
bool IsCrossProcessSubframe() override;
WebExposedIsolationLevel GetWebExposedIsolationLevel() override;
const GURL& GetLastCommittedURL() const override;
const url::Origin& GetLastCommittedOrigin() const override;
const net::NetworkIsolationKey& GetNetworkIsolationKey() override;
const net::IsolationInfo& GetIsolationInfoForSubresources() override;
net::IsolationInfo GetPendingIsolationInfoForSubresources() override;
gfx::NativeView GetNativeView() override;
void AddMessageToConsole(blink::mojom::ConsoleMessageLevel level,
const std::string& message) override;
void ExecuteJavaScriptMethod(const std::u16string& object_name,
const std::u16string& method_name,
base::Value::List arguments,
JavaScriptResultCallback callback) override;
void ExecuteJavaScript(const std::u16string& javascript,
JavaScriptResultCallback callback) override;
void ExecuteJavaScriptInIsolatedWorld(const std::u16string& javascript,
JavaScriptResultCallback callback,
int32_t world_id) override;
void ExecuteJavaScriptForTests(
const std::u16string& javascript,
JavaScriptResultCallback callback,
int32_t world_id = ISOLATED_WORLD_ID_GLOBAL) override;
void ExecuteJavaScriptWithUserGestureForTests(
const std::u16string& javascript,
JavaScriptResultCallback callback,
int32_t world_id = ISOLATED_WORLD_ID_GLOBAL) override;
void ExecutePluginActionAtLocalLocation(
const gfx::Point& local_location,
blink::mojom::PluginActionType plugin_action) override;
void ActivateFindInPageResultForAccessibility(int request_id) override;
void InsertVisualStateCallback(VisualStateCallback callback) override;
void CopyImageAt(int x, int y) override;
void SaveImageAt(int x, int y) override;
RenderViewHost* GetRenderViewHost() const override;
service_manager::InterfaceProvider* GetRemoteInterfaces() override;
blink::AssociatedInterfaceProvider* GetRemoteAssociatedInterfaces() override;
content::PageVisibilityState GetVisibilityState() override;
bool IsLastCommitIPAddressPubliclyRoutable() const override;
bool IsRenderFrameLive() override;
LifecycleState GetLifecycleState() override;
bool IsInLifecycleState(LifecycleState lifecycle_state) override;
bool IsActive() override;
bool IsInactiveAndDisallowActivation(uint64_t reason) override;
size_t GetProxyCount() override;
bool HasSelection() override;
const net::HttpResponseHeaders* GetLastResponseHeaders() override;
void RequestTextSurroundingSelection(
blink::mojom::LocalFrame::GetTextSurroundingSelectionCallback callback,
int max_length) override;
void SendInterventionReport(const std::string& id,
const std::string& message) override;
WebUI* GetWebUI() override;
void AllowBindings(int binding_flags) override;
int GetEnabledBindings() override;
void SetWebUIProperty(const std::string& name,
const std::string& value) override;
void DisableBeforeUnloadHangMonitorForTesting() override;
bool IsBeforeUnloadHangMonitorDisabledForTesting() override;
bool GetSuddenTerminationDisablerState(
blink::mojom::SuddenTerminationDisablerType disabler_type) override;
bool IsFeatureEnabled(
blink::mojom::PermissionsPolicyFeature feature) override;
const blink::PermissionsPolicy* GetPermissionsPolicy() override;
const blink::ParsedPermissionsPolicy& GetPermissionsPolicyHeader() override;
void ViewSource() override;
void ExecuteMediaPlayerActionAtLocation(
const gfx::Point&,
const blink::mojom::MediaPlayerAction& action) override;
bool CreateNetworkServiceDefaultFactory(
mojo::PendingReceiver<network::mojom::URLLoaderFactory>
default_factory_receiver) override;
void MarkIsolatedWorldsAsRequiringSeparateURLLoaderFactory(
const base::flat_set<url::Origin>& isolated_world_origins,
bool push_to_renderer_now) override;
bool IsSandboxed(network::mojom::WebSandboxFlags flags) override;
void FlushNetworkAndNavigationInterfacesForTesting(
bool do_nothing_if_no_network_service_connection = false) override;
void PrepareForInnerWebContentsAttach(
PrepareForInnerWebContentsAttachCallback callback) override;
blink::FrameOwnerElementType GetFrameOwnerElementType() override;
bool HasTransientUserActivation() override;
void NotifyUserActivation(
blink::mojom::UserActivationNotificationType notification_type) override;
bool Reload() override;
bool IsDOMContentLoaded() override;
void UpdateIsAdFrame(bool is_ad_frame) override;
void SetIsXrOverlaySetup() override;
ukm::SourceId GetPageUkmSourceId() override;
StoragePartitionImpl* GetStoragePartition() override;
BrowserContext* GetBrowserContext() override;
void ReportInspectorIssue(blink::mojom::InspectorIssueInfoPtr info) override;
void WriteIntoTrace(perfetto::TracedProto<TraceProto> context) const override;
void GetCanonicalUrl(
base::OnceCallback<void(const absl::optional<GURL>&)> callback) override;
void GetOpenGraphMetadata(
base::OnceCallback<void(blink::mojom::OpenGraphMetadataPtr)> callback)
override;
bool IsErrorDocument() override;
DocumentRef GetDocumentRef() override;
WeakDocumentPtr GetWeakDocumentPtr() override;
void EnableMojoJsBindings(
content::mojom::ExtraMojoJsFeaturesPtr features) override;
// Additional non-override const version of GetMainFrame.
const RenderFrameHostImpl* GetMainFrame() const;
// Additional non-override const version of GetPage.
const PageImpl& GetPage() const;
// Returns the token for the document currently associated with this frame.
// This can change over time if a `RenderFrameHost` is reused when navigating
// to a new document.
//
// Retrieving the document token is disallowed if:
// - the RenderFrameHost is pending commit, e.g. waiting for the renderer to
// acknowledge the commit, since the DocumentToken will change as soon as
// the navigation actually commits.
// - the RenderFrameHost is speculative
const blink::DocumentToken& GetDocumentToken() const;
// Retrieving the document token is disallowed during times when the result
// might be misleading / confusing (kPendingCommit or kSpeculative).
// Internally, the content implementation may still need to retrieve the
// document token at those times, so provide an escape hatch.
const blink::DocumentToken& GetDocumentTokenIgnoringSafetyRestrictions()
const {
return document_associated_data_->token();
}
// Returns a non-null DocumentToken pointer if a cross-document navigation
// should reuse the DocumentToken. This is only ever the case for the first
// cross-document commit in a speculative RenderFrameHost. Otherwise, returns
// nullptr.
const blink::DocumentToken* GetDocumentTokenForCrossDocumentNavigationReuse(
base::PassKey<NavigationRequest>);
// A RenderFrame was previously created but no longer exists, e.g. the
// renderer process is gone due to a crash.
bool is_render_frame_deleted() const {
return render_frame_state_ == RenderFrameState::kDeleted;
}
// Immediately reinitializes DocumentUserData when the RenderFrameHost needs
// to be immediately reused after a crash. Only usable for a main frame where
// `is_render_frame_deleted()` is true.
void ReinitializeDocumentAssociatedDataForReuseAfterCrash(
base::PassKey<RenderFrameHostManager>);
// Immediately reinitializes DocumentUserData for testing a corner case crash
// scenario. See usage in
// ManifestBrowserTest.GetManifestInterruptedByDestruction.
void ReinitializeDocumentAssociatedDataForTesting();
// Determines if a clipboard paste using |data| of type |data_type| is allowed
// in this renderer frame. The implementation delegates to
// RenderFrameHostDelegate::IsClipboardPasteContentAllowed(). See the
// description of the latter method for complete details.
void IsClipboardPasteContentAllowed(
const ui::ClipboardFormatType& data_type,
const std::string& data,
IsClipboardPasteContentAllowedCallback callback);
// This is called when accessibility events arrive from renderer to browser.
// This could cause eviction if the page is in back/forward cache. Returns
// true if the eviction happens, and otherwise calls
// |RenderFrameHost::IsInactiveAndDisallowActivation()| and returns the value
// from there. This is only called when the flag to evict on accessibility
// events is on. When the flag is off, we do not evict the entry and keep
// processing the events, thus do not call this function.
bool IsInactiveAndDisallowActivationForAXEvents(
const std::vector<ui::AXEvent>& events);
void SendAccessibilityEventsToManager(
const AXEventNotificationDetails& details);
// Evict the RenderFrameHostImpl with |reason| that causes the eviction. This
// constructs a flattened list of NotRestoredReasons and calls
// |EvictFromBackForwardCacheWithFlattenedReasons|.
void EvictFromBackForwardCacheWithReason(
BackForwardCacheMetrics::NotRestoredReason reason);
// Evict the RenderFrameHostImpl with |can_store_flat| as the eviction reason.
// This constructs a tree of NotRestoredReasons based on |can_store_flat| and
// calls |EvictFromBackForwardCacheWithFlattenedAndTreeReasons|.
void EvictFromBackForwardCacheWithFlattenedReasons(
BackForwardCacheCanStoreDocumentResult can_store_flat);
// Evict the RenderFrameHostImpl with |can_store| that causes the eviction.
// This reports the flattened list and the tree of NotRestoredReasons to
// metrics, and posts a task to evict the frame.
void EvictFromBackForwardCacheWithFlattenedAndTreeReasons(
BackForwardCacheCanStoreDocumentResultWithTree& can_store);
// Only for testing sticky WebBackForwardCacheDisablingFeature.
// This is implemented solely in the browser and should only be used when
// stickiness is required, otherwise
// BackForwardCacheBrowserTest::AddBlocklistedFeature should be used.
void UseDummyStickyBackForwardCacheDisablingFeatureForTesting();
const blink::mojom::BackForwardCacheNotRestoredReasonsPtr&
NotRestoredReasonsForTesting() {
return not_restored_reasons_for_testing_;
}
// Returns the current WebPreferences for the WebContents associated with this
// RenderFrameHost. Will create one if it does not exist (and update all the
// renderers with the newly computed value).
blink::web_pref::WebPreferences GetOrCreateWebPreferences();
// IPC::Sender
bool Send(IPC::Message* msg) override;
// IPC::Listener
bool OnMessageReceived(const IPC::Message& msg) override;
void OnAssociatedInterfaceRequest(
const std::string& interface_name,
mojo::ScopedInterfaceEndpointHandle handle) override;
std::string ToDebugString() override;
// WebAXPlatformTreeManagerDelegate
void AccessibilityPerformAction(const ui::AXActionData& data) override;
bool AccessibilityViewHasFocus() override;
void AccessibilityViewSetFocus() override;
gfx::Rect AccessibilityGetViewBounds() override;
float AccessibilityGetDeviceScaleFactor() override;
void AccessibilityFatalError() override;
gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget() override;
gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible() override;
gfx::NativeViewAccessible AccessibilityGetNativeViewAccessibleForWindow()
override;
void AccessibilityHitTest(
const gfx::Point& point_in_frame_pixels,
const ax::mojom::Event& opt_event_to_fire,
int opt_request_id,
base::OnceCallback<void(ui::AXPlatformTreeManager* hit_manager,
ui::AXNodeID hit_node_id)> opt_callback) override;
bool AccessibilityIsRootFrame() const override;
RenderFrameHostImpl* AccessibilityRenderFrameHost() override;
WebContentsAccessibility* AccessibilityGetWebContentsAccessibility() override;
// SiteInstanceGroup::Observer
void RenderProcessGone(SiteInstanceGroup* site_instance_group,
const ChildProcessTerminationInfo& info) override;
// ui::AXActionHandlerBase:
void PerformAction(const ui::AXActionData& data) override;
bool RequiresPerformActionPointInPixels() const override;
// Creates a RenderFrame in the renderer process.
bool CreateRenderFrame(
const absl::optional<blink::FrameToken>& previous_frame_token,
const absl::optional<blink::FrameToken>& opener_frame_token,
const absl::optional<blink::FrameToken>& parent_frame_token,
const absl::optional<blink::FrameToken>& previous_sibling_frame_token);
// Deletes the RenderFrame in the renderer process.
// Postcondition: |IsPendingDeletion()| is true.
void DeleteRenderFrame(mojom::FrameDeleteIntention intent);
// Track whether the RenderFrame for this RenderFrameHost has been created in
// or destroyed in the renderer process.
void RenderFrameCreated();
void RenderFrameDeleted();
// Signals that the renderer has requested for this main-frame's window to be
// shown, at which point we can service navigation requests.
void Init();
// This needs to be called to make sure that the parent-child relationship
// between frames is properly established both for cross-process iframes as
// well as for inner web contents (i.e. right after having attached it to the
// outer web contents), so that navigating the whole tree is possible.
//
// It's safe to call this method multiple times, or even before the embedding
// token has been set for this frame, to account for the realistic possibility
// that inner web contents can became attached to the outer one both before
// and after the embedding token has been set.
void PropagateEmbeddingTokenToParentFrame();
// Returns true if the frame recently plays an audio.
bool is_audible() const { return is_audible_; }
// Toggles the audible state of this render frame. This should only be called
// from AudioStreamMonitor, and should not be invoked with the same value
// successively.
void OnAudibleStateChanged(bool is_audible);
// Called when this frame has added a child. This is a continuation of an IPC
// that was partially handled on the IO thread (to allocate |new_routing_id|,
// |frame_token|, |devtools_frame_token|, |document_token|), and is forwarded
// here. The renderer has already been told to create a RenderFrame with the
// specified ID values. |browser_interface_broker_receiver| is the receiver
// end of the BrowserInterfaceBroker interface in the child frame.
// RenderFrameHost should bind this receiver to expose services to the
// renderer process. The caller takes care of sending down the client end of
// the pipe to the child RenderFrame to use.
void OnCreateChildFrame(
int new_routing_id,
mojo::PendingAssociatedRemote<mojom::Frame> frame_remote,
mojo::PendingReceiver<blink::mojom::BrowserInterfaceBroker>
browser_interface_broker_receiver,
blink::mojom::PolicyContainerBindParamsPtr policy_container_bind_params,
mojo::PendingAssociatedReceiver<blink::mojom::AssociatedInterfaceProvider>
associated_interface_provider_receiver,
blink::mojom::TreeScopeType scope,
const std::string& frame_name,
const std::string& frame_unique_name,
bool is_created_by_script,
const blink::LocalFrameToken& frame_token,
const base::UnguessableToken& devtools_frame_token,
const blink::DocumentToken& document_token,
const blink::FramePolicy& frame_policy,
const blink::mojom::FrameOwnerProperties& frame_owner_properties,
blink::FrameOwnerElementType owner_type,
ukm::SourceId document_ukm_source_id);
// Update this frame's state at the appropriate time when a navigation
// commits. This is called by Navigator::DidNavigate as a helper, in the
// midst of a DidCommitProvisionalLoad call. If |was_within_same_document| is
// true the navigation was same-document.
void DidNavigate(const mojom::DidCommitProvisionalLoadParams& params,
NavigationRequest* navigation_request,
bool was_within_same_document);
RenderViewHostImpl* render_view_host() { return render_view_host_.get(); }
RenderFrameHostDelegate* delegate() { return delegate_; }
// FrameTree references are being removed from RenderFrameHostImpl as a part
// of MPArch. Please avoid using these APIs. See crbug.com/1179502 for
// details.
FrameTree* frame_tree() const { return frame_tree_; }
FrameTreeNode* frame_tree_node() const { return frame_tree_node_; }
// Methods to add/remove/reset/query child FrameTreeNodes of this frame.
// See class-level comment for FrameTreeNode for how the frame tree is
// represented.
size_t child_count() { return children_.size(); }
FrameTreeNode* child_at(size_t index) const { return children_[index].get(); }
FrameTreeNode* AddChild(
std::unique_ptr<FrameTreeNode> child,
int frame_routing_id,
mojo::PendingAssociatedRemote<mojom::Frame> frame_remote,
const blink::LocalFrameToken& frame_token,
const blink::DocumentToken& document_token,
base::UnguessableToken devtools_frame_token,
const blink::FramePolicy& frame_policy,
std::string frame_name,
std::string frame_unique_name);
void RemoveChild(FrameTreeNode* child);
void ResetChildren();
// Set the URL of the document represented by this RenderFrameHost. Called
// when the navigation commits. See also `GetLastCommittedURL`.
void SetLastCommittedUrl(const GURL& url);
// The most recent non-net-error URL to commit in this frame. In almost all
// cases, use GetLastCommittedURL instead.
const GURL& last_successful_url() const { return last_successful_url_; }
// For about:blank and about:srcdoc documents, this tracks the inherited base
// URL, snapshotted from the initiator's FrameLoadRequest. This is an empty
// URL for all other cases. This is currently only set if
// IsNewBaseUrlInheritanceBehaviorEnabled() returns true. See
// https://crbug.com/1356658.
const GURL& GetInheritedBaseUrl() const;
// The current URL of the document in the renderer process. Note that this
// includes URL updates due to document.open() (where it will be updated to
// the document-open-initiator URL) and special cases like error pages
// (where kUnreachableWebDataURL is used) and loadDataWithBaseURL() (where the
// base URL is used), so it might be different than the "last committed
// URL" provided by GetLastCommittedURL().
// In almost all cases, use GetLastCommittedURL() instead, as this should only
// be used when the caller wants to know the current state of the URL in the
// renderer (e.g. when predicting whether a navigation will do a replacement
// or not).
const GURL& last_document_url_in_renderer() const {
return renderer_url_info_.last_document_url;
}
// Whether the last committed document was loaded from loadDataWithBaseURL or
// not.
bool was_loaded_from_load_data_with_base_url() const {
return renderer_url_info_.was_loaded_from_load_data_with_base_url;
}
const base::UnguessableToken& credentialless_iframes_nonce() const {
DCHECK(is_main_frame() || IsFencedFrameRoot());
return credentialless_iframes_nonce_;
}
// Saves the URLs and other URL-related information used in the renderer.
// These values can be used to know the current state of URLs in the renderer.
// Currently these values are used to simulate calculations in the renderer
// or to preserve behavior of calculations that used to live in the renderer
// but was moved to the browser. For most use cases, prefer to use
// `last_committed_url_` instead.
struct RendererURLInfo {
// Tracks this frame's last "document URL", which might be different from:
// - `last_committed_url_` if the frame did document.open() or sets a
// different document URL than the committed URL (e.g. loadDataWithBaseURL
// and error page commits).
// - The history URL in the renderer (not tracked in the browser) which
// might be different for error pages, where the document URL will be
// kUnreachableWebDataURL.
// Note 1: `last_document_url` might be updated outside of navigation due
// to document.open(), unlike `last_committed_url_` which can only be
// updated as a result of navigation. All three URLs are also updated/set to
// empty when the renderer process crashes.
// Note 2: This might not have the accurate value of the document URL in the
// renderer after same-document navigations on error pages or documents
// loaded through loadDataWithBaseURL(). See comment in GetLastDocumentURL()
// in render_frame_host_impl.cc for more details.
GURL last_document_url;
// Whether the currently committed document is a result of webview's
// loadDataWithBaseURL API or not.
bool was_loaded_from_load_data_with_base_url = false;
};
// Returns the storage key for the last committed document in this
// RenderFrameHostImpl. It is used for partitioning storage by the various
// storage APIs.
const blink::StorageKey& storage_key() const { return storage_key_; }
// Returns the http method of the last committed navigation.
const std::string& last_http_method() { return last_http_method_; }
// Returns the http status code of the last committed navigation.
int last_http_status_code() { return last_http_status_code_; }
// Returns the POST ID of the last committed navigation.
int64_t last_post_id() { return last_post_id_; }
// Returns true if last committed navigation's CommonNavigationParam's
// `has_user_gesture` is true. Should only be used to get the state of the
// last navigation, and not the current state of user activation of this
// RenderFrameHost. See comment on the variable declaration for more details.
bool last_committed_common_params_has_user_gesture() const {
return last_committed_common_params_has_user_gesture_;
}
// Returns true if `dest_url_info` should be considered the same site as the
// current contents of this frame. This is the primary entry point for
// determining if a navigation to `dest_url_info` should stay in this
// RenderFrameHost's SiteInstance.
bool IsNavigationSameSite(const UrlInfo& dest_url_info) const;
// Returns |frame_origin| if this frame is the top (i.e. root) frame in the
// frame tree. Otherwise, it returns the top frame's origin.
const url::Origin& ComputeTopFrameOrigin(
const url::Origin& frame_origin) const;
// Computes the IsolationInfo for this frame to `destination`. Set
// `is_credentialless` to true if the navigation will be loaded as a
// credentialless document (note that the navigation might be committing a
// credentialless document even if the document currently loaded in this RFH
// is not credentialless, and vice versa). Populate
// `fenced_frame_nonce_for_navigation` with
// `NavigationRequest::ComputeFencedFrameNonce()`.
net::IsolationInfo ComputeIsolationInfoForNavigation(
const GURL& destination,
bool is_credentialless,
absl::optional<base::UnguessableToken> fenced_frame_nonce_for_navigation);
// Computes the IsolationInfo for this frame to |destination|.
net::IsolationInfo ComputeIsolationInfoForNavigation(const GURL& destination);
// Computes the IsolationInfo that should be used for subresources, if
// |main_world_origin_for_url_loader_factory| is committed to this frame. The
// boolean `is_credentialless` specifies whether this frame will commit an
// credentialless document.
// Populate `fenced_frame_nonce_for_navigation` with
// `NavigationRequest::ComputeFencedFrameNonce()`.
net::IsolationInfo ComputeIsolationInfoForSubresourcesForPendingCommit(
const url::Origin& main_world_origin_for_url_loader_factory,
bool is_credentialless,
absl::optional<base::UnguessableToken> fenced_frame_nonce_for_navigation);
// Computes site_for_cookies for this frame. A non-empty result denotes which
// domains are considered first-party to the top-level site when resources are
// loaded inside this frame. An empty result means that nothing will be
// first-party, as the frame hierarchy makes this context third-party already.
//
// The result can be used to check if cookies (including storage APIs and
// shared/service workers) are accessible.
net::SiteForCookies ComputeSiteForCookies();
// Allows overriding the last committed origin in tests.
void SetLastCommittedOriginForTesting(const url::Origin& origin);
// Get HTML data for this RenderFrame by serializing contents on the renderer
// side and replacing all links to both same-site and cross-site resources
// with paths to local copies as specified by |url_map| and |frame_token_map|.
void GetSerializedHtmlWithLocalLinks(
const base::flat_map<GURL, base::FilePath>& url_map,
const base::flat_map<blink::FrameToken, base::FilePath>& frame_token_map,
bool save_with_empty_url,
mojo::PendingRemote<mojom::FrameHTMLSerializerHandler>
serializer_handler);
// Returns the associated WebUI or null if none applies.
WebUIImpl* web_ui() const { return web_ui_.get(); }
WebUI::TypeID web_ui_type() const { return web_ui_type_; }
// Enable Mojo JavaScript bindings in the renderer process, and use the
// provided BrowserInterfaceBroker to handle JavaScript calls to
// Mojo.bindInterface. This method should be called in
// ReadyToCommitNavigation.
void EnableMojoJsBindingsWithBroker(
mojo::PendingRemote<blink::mojom::BrowserInterfaceBroker> broker);
// Frame trees may be nested so it can be the case that is_main_frame() is
// true, but is not the outermost RenderFrameHost (it only checks for nullity
// of |parent_|. In particular, !is_main_frame() cannot be used to check if
// this RenderFrameHost is embedded -- use !IsOutermostMainFrame() instead.
// NB: this does not escape guest views; IsOutermostMainFrame() will be true
// for the outermost main frame in an inner guest view.
bool is_main_frame() const { return !parent_; }
bool IsOutermostMainFrame() const;
// Returns this RenderFrameHost's loading state. This method is only used by
// FrameTreeNode. The proper way to check whether a frame is loading is to
// call FrameTreeNode::IsLoading.
bool is_loading() const { return is_loading_; }
// Sets `is_loading_` to true to handle renderer debug URLs. This is needed
// to generate DidStopLoading events for these URLs.
void SetIsLoadingForRendererDebugURL() { is_loading_ = true; }
// Returns true if this is a top-level frame, or if this frame
// uses a proxy to communicate with its parent frame. Local roots are
// distinguished by owning a RenderWidgetHost, which manages input events
// and painting for this frame and its contiguous local subtree in the
// renderer process.
bool is_local_root() const { return !!GetLocalRenderWidgetHost(); }
// Returns true if this is not a top-level frame but is still a local root.
bool is_local_root_subframe() const {
return !is_main_frame() && is_local_root();
}
media::MediaMetricsProvider::RecordAggregateWatchTimeCallback
GetRecordAggregateWatchTimeCallback();
// The unique ID of the latest NavigationEntry that this RenderFrameHost is
// showing. This may change even when this frame hasn't committed a page,
// such as for a new subframe navigation in a different frame.
int nav_entry_id() const { return nav_entry_id_; }
void set_nav_entry_id(int nav_entry_id) { nav_entry_id_ = nav_entry_id; }
// The FrameNavigationEntry for the current document in this RenderFrameHost.
// See last_committed_frame_entry_ declaration for more details.
FrameNavigationEntry* last_committed_frame_entry() {
return last_committed_frame_entry_.get();
}
void set_last_committed_frame_entry(
scoped_refptr<FrameNavigationEntry> frame_entry) {
last_committed_frame_entry_ = frame_entry;
}
// Return true if this contains at least one NavigationRequest waiting to
// commit in this RenderFrameHost. This includes both same-document and
// cross-document NavigationRequests.
bool HasPendingCommitNavigation() const;
// Return true if this contains at least one NavigationRequest waiting to
// commit in this RenderFrameHost, excluding same-document navigations.
// NOTE: RenderFrameHostManager surfaces a similar method that will check
// all the RenderFrameHosts for that FrameTreeNode.
bool HasPendingCommitForCrossDocumentNavigation() const;
// Return true if Unload() was called on the frame or one of its ancestors.
// If true, this corresponds either to unload handlers running for this
// RenderFrameHost (LifecycleStateImpl::kRunningUnloadHandlers) or when this
// RenderFrameHost is ready to be deleted
// (LifecycleStateImpl::kReadyToBeDeleted).
bool IsPendingDeletion() const;
// Returns true if this RenderFrameHost is currently stored in the
// back-forward cache i.e., when lifecycle_state() is kInBackForwardCache.
bool IsInBackForwardCache() const;
// Returns a pending same-document navigation request in this frame that has
// the navigation_token |token|, if any.