Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2012 The Chromium Authors |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 5 | #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
| 6 | #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 7 | |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 8 | #include <stdint.h> |
| 9 | |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 10 | #include <functional> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 11 | #include <map> |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 12 | #include <memory> |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 13 | #include <optional> |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 14 | #include <set> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 15 | #include <string> |
Lukasz Anforowicz | e9ae372 | 2017-09-29 17:37:38 | [diff] [blame] | 16 | #include <utility> |
| 17 | #include <vector> |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 18 | |
David Sanders | 6f0eeb0 | 2025-01-30 06:48:50 | [diff] [blame] | 19 | #include "base/auto_reset.h" |
Elly Fong-Jones | 564de626 | 2022-07-28 21:11:16 | [diff] [blame] | 20 | #include "base/callback_list.h" |
Lei Zhang | 6410ec1a | 2019-01-31 21:38:58 | [diff] [blame] | 21 | #include "base/containers/flat_map.h" |
Avi Drissman | adac2199 | 2023-01-11 23:46:39 | [diff] [blame] | 22 | #include "base/functional/callback_helpers.h" |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 23 | #include "base/functional/function_ref.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 24 | #include "base/gtest_prod_util.h" |
Keishi Hattori | 0e45c02 | 2021-11-27 09:25:52 | [diff] [blame] | 25 | #include "base/memory/raw_ptr.h" |
Dave Tapuska | d8b0530f | 2021-10-19 15:12:31 | [diff] [blame] | 26 | #include "base/memory/safe_ref.h" |
[email protected] | 6eac57a | 2011-07-12 21:15:09 | [diff] [blame] | 27 | #include "base/observer_list.h" |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 28 | #include "base/process/kill.h" |
Sigurdur Asgeirsson | 103e2fb | 2020-11-10 00:50:16 | [diff] [blame] | 29 | #include "base/scoped_observation.h" |
Daniel Cheng | 90196c8 | 2018-04-25 21:49:14 | [diff] [blame] | 30 | #include "base/time/time.h" |
Ari Chivukula | 2d8d5e0 | 2024-11-04 20:09:57 | [diff] [blame] | 31 | #include "base/types/pass_key.h" |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 32 | #include "build/build_config.h" |
Min Qin | a904f330 | 2018-02-13 23:33:34 | [diff] [blame] | 33 | #include "components/download/public/common/download_url_parameters.h" |
Kartar Singh | b1bfa1a | 2024-06-24 13:14:57 | [diff] [blame] | 34 | #include "components/input/render_widget_host_input_event_router.h" |
Andrew Verge | 146fe63 | 2025-07-08 14:12:11 | [diff] [blame] | 35 | #include "content/browser/fenced_frame/fenced_frame_viewport_observer.h" |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 36 | #include "content/browser/media/audio_stream_monitor.h" |
Max Morin | 5bc74f5 | 2018-05-09 07:00:21 | [diff] [blame] | 37 | #include "content/browser/media/forwarding_audio_stream_factory.h" |
Taiyo Mizuhashi | 15ba3bc | 2025-01-28 04:20:31 | [diff] [blame] | 38 | #include "content/browser/preloading/prefetch/prefetch_handle_impl.h" |
Yoshiki Tanioka | 49b4cfb | 2022-10-20 09:25:31 | [diff] [blame] | 39 | #include "content/browser/preloading/prerender/prerender_final_status.h" |
Sreeja Kamishetty | c227f7a | 2022-07-08 22:33:15 | [diff] [blame] | 40 | #include "content/browser/preloading/prerender/prerender_handle_impl.h" |
danakj | 2adf832 | 2020-09-15 22:06:49 | [diff] [blame] | 41 | #include "content/browser/renderer_host/frame_tree.h" |
| 42 | #include "content/browser/renderer_host/frame_tree_node.h" |
| 43 | #include "content/browser/renderer_host/navigation_controller_delegate.h" |
| 44 | #include "content/browser/renderer_host/navigation_controller_impl.h" |
| 45 | #include "content/browser/renderer_host/navigator_delegate.h" |
Jeremy Roman | 2d8dfe13 | 2021-07-06 20:51:26 | [diff] [blame] | 46 | #include "content/browser/renderer_host/page_delegate.h" |
Sreeja Kamishetty | 3dde631 | 2021-06-22 14:05:29 | [diff] [blame] | 47 | #include "content/browser/renderer_host/page_impl.h" |
danakj | 2adf832 | 2020-09-15 22:06:49 | [diff] [blame] | 48 | #include "content/browser/renderer_host/render_frame_host_delegate.h" |
| 49 | #include "content/browser/renderer_host/render_frame_host_manager.h" |
[email protected] | 2e3bf99 | 2012-05-24 17:36:24 | [diff] [blame] | 50 | #include "content/browser/renderer_host/render_view_host_delegate.h" |
creis | c014b40 | 2015-04-23 16:41:45 | [diff] [blame] | 51 | #include "content/browser/renderer_host/render_view_host_impl.h" |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 52 | #include "content/browser/renderer_host/render_widget_host_delegate.h" |
Joe Mason | 1fc3e2e | 2021-11-02 05:25:07 | [diff] [blame] | 53 | #include "content/browser/renderer_host/visible_time_request_trigger.h" |
Avi Drissman | bd3e98644 | 2020-05-20 21:09:20 | [diff] [blame] | 54 | #include "content/browser/web_contents/file_chooser_impl.h" |
Shintaro Kawamura | 1042d57 | 2024-09-30 13:52:22 | [diff] [blame] | 55 | #include "content/browser/web_contents/slow_web_preference_cache.h" |
[email protected] | 8d128d6 | 2011-09-13 22:11:57 | [diff] [blame] | 56 | #include "content/common/content_export.h" |
Mike Wasserman | d3609c1f | 2023-02-28 20:03:13 | [diff] [blame] | 57 | #include "content/public/browser/fullscreen_types.h" |
Lukasz Anforowicz | 09060bdf7 | 2018-08-23 15:53:17 | [diff] [blame] | 58 | #include "content/public/browser/global_routing_id.h" |
Guido Urdaneta | 73fa663 | 2019-01-14 18:46:26 | [diff] [blame] | 59 | #include "content/public/browser/media_stream_request.h" |
Liviu Tinta | cf066d5 | 2024-07-24 16:00:55 | [diff] [blame] | 60 | #include "content/public/browser/preloading.h" |
[email protected] | 58f5d56 | 2011-12-20 17:13:03 | [diff] [blame] | 61 | #include "content/public/browser/web_contents.h" |
Patrick Monette | 15442a1 | 2025-01-22 20:09:31 | [diff] [blame] | 62 | #include "content/public/browser/web_contents_capability_type.h" |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 63 | #include "content/public/browser/web_contents_observer.h" |
Benjamin Keen | 919ed0f | 2025-02-25 15:47:20 | [diff] [blame] | 64 | #include "media/base/picture_in_picture_events_info.h" |
Miyoung Shin | 040d834 | 2021-02-23 15:12:31 | [diff] [blame] | 65 | #include "mojo/public/cpp/bindings/pending_associated_receiver.h" |
Miyoung Shin | 59f39ff | 2019-09-17 07:23:20 | [diff] [blame] | 66 | #include "mojo/public/cpp/bindings/pending_receiver.h" |
Julie Jeongeun Kim | caacf910 | 2019-09-12 02:13:05 | [diff] [blame] | 67 | #include "mojo/public/cpp/bindings/pending_remote.h" |
Miyoung Shin | 298d5ad | 2019-09-05 01:52:37 | [diff] [blame] | 68 | #include "mojo/public/cpp/bindings/remote.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 69 | #include "net/base/load_states.h" |
Xiao Ma | 29b2d1e6 | 2024-06-13 06:17:09 | [diff] [blame] | 70 | #include "net/base/network_handle.h" |
mikt | dc1d5a6 | 2024-07-29 20:43:02 | [diff] [blame] | 71 | #include "partition_alloc/buildflags.h" |
Ke He | 31d0bb0 | 2018-02-24 07:16:24 | [diff] [blame] | 72 | #include "services/device/public/mojom/geolocation_context.mojom.h" |
Sandor Major | 878f835 | 2025-02-18 20:16:02 | [diff] [blame] | 73 | #include "services/network/public/cpp/permissions_policy/permissions_policy_declaration.h" |
Kinuko Yasuda | 433f710a | 2020-02-14 02:11:58 | [diff] [blame] | 74 | #include "services/network/public/mojom/fetch_api.mojom-forward.h" |
Mario Sanchez Prada | 0bd8b8c | 2020-10-21 17:49:23 | [diff] [blame] | 75 | #include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h" |
Gyuyoung Kim | 1ac4ca78 | 2020-09-11 03:32:51 | [diff] [blame] | 76 | #include "third_party/blink/public/common/web_preferences/web_preferences.h" |
Abhijeet Kandalkar | 849ceff | 2019-02-28 17:37:29 | [diff] [blame] | 77 | #include "third_party/blink/public/mojom/choosers/color_chooser.mojom.h" |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 78 | #include "third_party/blink/public/mojom/choosers/popup_menu.mojom-forward.h" |
| 79 | #include "third_party/blink/public/mojom/frame/blocked_navigation_types.mojom-shared.h" |
Henrique Ferreiro | ba53547 | 2020-04-21 11:38:36 | [diff] [blame] | 80 | #include "third_party/blink/public/mojom/frame/frame.mojom-forward.h" |
Hans Wennborg | 78b5218 | 2021-06-15 13:42:15 | [diff] [blame] | 81 | #include "third_party/blink/public/mojom/frame/text_autosizer_page_info.mojom.h" |
Michelle | bb18e2d | 2023-02-22 04:52:22 | [diff] [blame] | 82 | #include "third_party/blink/public/mojom/input/input_handler.mojom-shared.h" |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 83 | #include "third_party/blink/public/mojom/loader/resource_load_info.mojom-forward.h" |
Lei Zhang | 3ee2b78a | 2021-05-18 20:58:44 | [diff] [blame] | 84 | #include "third_party/blink/public/mojom/media/capture_handle_config.mojom.h" |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 85 | #include "third_party/blink/public/mojom/page/display_cutout.mojom-shared.h" |
Amanda Baker | f48f04b | 2024-03-26 18:12:33 | [diff] [blame] | 86 | #include "third_party/blink/public/mojom/page/draggable_region.mojom-forward.h" |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 87 | #include "third_party/blink/public/mojom/page/page_visibility_state.mojom-shared.h" |
Ahmed Elwasefi | 79a665e | 2024-10-01 18:24:47 | [diff] [blame] | 88 | #include "ui/accessibility/ax_location_and_scroll_updates.h" |
Dominic Mazzoni | 9050148 | 2018-09-05 22:43:31 | [diff] [blame] | 89 | #include "ui/accessibility/ax_mode.h" |
Nektarios Paisios | 8e9da98 | 2024-02-20 23:14:22 | [diff] [blame] | 90 | #include "ui/accessibility/ax_node.h" |
Alexander Surkov | 862feee | 2021-01-29 21:27:48 | [diff] [blame] | 91 | #include "ui/accessibility/platform/inspect/ax_event_recorder.h" |
Xu Li | 383fced | 2025-08-12 16:14:01 | [diff] [blame] | 92 | #include "ui/base/clipboard/clipboard_metadata.h" |
Henrique Ferreiro | 299008ec | 2020-12-29 14:36:28 | [diff] [blame] | 93 | #include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h" |
David Bokan | d6e44055b | 2022-09-21 03:58:08 | [diff] [blame] | 94 | #include "ui/base/ime/mojom/virtual_keyboard_types.mojom.h" |
Md Hasibul Hasan | 2fe709feb | 2024-09-12 15:39:56 | [diff] [blame] | 95 | #include "ui/base/mojom/window_show_state.mojom-forward.h" |
Sonja | 7b2b776 | 2023-09-06 08:33:08 | [diff] [blame] | 96 | #include "ui/base/ui_base_types.h" |
Fabio Muratori | 8ff2689 | 2025-05-06 19:07:21 | [diff] [blame] | 97 | #include "ui/base/window_open_disposition.h" |
Sean Kau | d730f5b | 2023-06-22 16:21:33 | [diff] [blame] | 98 | #include "ui/color/color_provider_key.h" |
tom | 855c4bf3 | 2021-09-30 00:27:26 | [diff] [blame] | 99 | #include "ui/color/color_provider_source_observer.h" |
tfarina | ebe974f0 | 2015-01-03 04:25:32 | [diff] [blame] | 100 | #include "ui/gfx/geometry/size.h" |
Rune Lillesveen | 5d8c4998 | 2019-04-24 19:07:30 | [diff] [blame] | 101 | #include "ui/native_theme/native_theme.h" |
Alison Maher | 7f366dc6 | 2020-03-03 19:46:00 | [diff] [blame] | 102 | #include "ui/native_theme/native_theme_observer.h" |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 103 | |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 104 | #if BUILDFLAG(IS_ANDROID) |
Bo Liu | 168c864 | 2017-08-28 18:26:02 | [diff] [blame] | 105 | #include "content/public/browser/android/child_process_importance.h" |
blundell | f5316fc | 2017-05-15 11:49:03 | [diff] [blame] | 106 | #endif |
| 107 | |
Marijn Kruisselbrink | 46fa4bd | 2019-07-11 18:15:47 | [diff] [blame] | 108 | namespace base { |
| 109 | class FilePath; |
evliu | 7f736f0 | 2019-11-07 17:43:50 | [diff] [blame] | 110 | } // namespace base |
Marijn Kruisselbrink | 46fa4bd | 2019-07-11 18:15:47 | [diff] [blame] | 111 | |
Dale Curtis | c496a776 | 2021-02-24 01:15:44 | [diff] [blame] | 112 | namespace device { |
| 113 | namespace mojom { |
| 114 | class WakeLock; |
| 115 | } |
| 116 | } // namespace device |
| 117 | |
Kartar Singh | b1bfa1a | 2024-06-24 13:14:57 | [diff] [blame] | 118 | namespace input { |
| 119 | class RenderWidgetHostInputEventRouter; |
| 120 | } // namespace input |
| 121 | |
Ming-Ying Chung | 16d0447 | 2025-04-17 22:14:39 | [diff] [blame] | 122 | namespace network { |
| 123 | struct ResourceRequest; |
| 124 | } // namespace network |
| 125 | |
Tsuyoshi Horo | bcd0b9f6 | 2023-06-28 11:35:32 | [diff] [blame] | 126 | namespace network::mojom { |
| 127 | class SharedDictionaryAccessDetails; |
| 128 | } // namespace network::mojom |
| 129 | |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 130 | namespace service_manager { |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 131 | class InterfaceProvider; |
evliu | 7f736f0 | 2019-11-07 17:43:50 | [diff] [blame] | 132 | } // namespace service_manager |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 133 | |
Jacques Newman | 517ba184 | 2024-04-16 00:51:07 | [diff] [blame] | 134 | namespace ui { |
Jacques Newman | edb3006 | 2024-04-16 22:37:02 | [diff] [blame] | 135 | struct AXUpdatesAndEvents; |
Jacques Newman | 517ba184 | 2024-04-16 00:51:07 | [diff] [blame] | 136 | } |
| 137 | |
[email protected] | e582fdd | 2011-12-20 16:48:17 | [diff] [blame] | 138 | namespace content { |
David Bokan | 1bdb3701f | 2021-04-30 22:02:35 | [diff] [blame] | 139 | class JavaScriptDialogDismissNotifier; |
Becca Hughes | 112832e | 2019-06-11 17:19:02 | [diff] [blame] | 140 | enum class PictureInPictureResult; |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 141 | class BeforeUnloadBlockingDelegate; // content_browser_test_utils_internal.h |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 142 | class BrowserPluginEmbedder; |
| 143 | class BrowserPluginGuest; |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 144 | class FindRequestManager; |
Tommy Steimel | e95348e | 2024-01-09 21:15:33 | [diff] [blame] | 145 | class MediaSession; |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 146 | class MediaWebContentsObserver; |
Reilly Grant | afbe224 | 2020-02-20 21:14:55 | [diff] [blame] | 147 | class NFCHost; |
Ari Chivukula | 2d8d5e0 | 2024-11-04 20:09:57 | [diff] [blame] | 148 | class PartitionedPopinsController; |
Jinsuk Kim | 895b2c5 | 2018-07-03 06:49:16 | [diff] [blame] | 149 | class RenderFrameHost; |
Ian Barkley-Yeung | bda77fb | 2020-12-08 04:26:46 | [diff] [blame] | 150 | class RenderFrameHostImpl; |
[email protected] | eaabba2 | 2012-03-07 15:02:11 | [diff] [blame] | 151 | class RenderViewHost; |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 152 | class RenderViewHostDelegateView; |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 153 | class RenderWidgetHostImpl; |
Donn Denman | a6d9183 | 2023-11-28 21:25:46 | [diff] [blame] | 154 | class SafeAreaInsetsHost; |
[email protected] | 3586962 | 2012-10-26 23:23:55 | [diff] [blame] | 155 | class SavePackage; |
Greg Thompson | f855bf88 | 2024-01-30 10:39:45 | [diff] [blame] | 156 | class ScopedAccessibilityMode; |
Mike Wasserman | b213b935 | 2020-04-16 00:32:34 | [diff] [blame] | 157 | class ScreenChangeMonitor; |
lunalu | d4a2cc8 | 2016-11-22 00:27:23 | [diff] [blame] | 158 | class ScreenOrientationProvider; |
Sharon Yang | efe5263 | 2022-03-08 23:06:06 | [diff] [blame] | 159 | class SiteInstanceGroup; |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 160 | // For web_contents_impl_browsertest.cc |
| 161 | class TestWCDelegateForDialogsAndFullscreen; |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 162 | class TestWebContents; |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 163 | class TextInputManager; |
Aman Verma | 3047aa41 | 2024-05-28 09:09:24 | [diff] [blame] | 164 | class TouchEmulatorImpl; |
Lei Zhang | 2764bca | 2021-07-15 02:00:07 | [diff] [blame] | 165 | class WakeLockContextHost; |
[email protected] | 674bc59 | 2011-12-20 23:00:42 | [diff] [blame] | 166 | class WebContentsDelegate; |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 167 | class WebContentsImpl; |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 168 | class WebContentsView; |
dewittj | 6dc5747a | 2016-05-17 01:48:47 | [diff] [blame] | 169 | struct MHTMLGenerationParams; |
Sreeja Kamishetty | ac12140e | 2022-07-14 22:16:51 | [diff] [blame] | 170 | class PreloadingAttempt; |
[email protected] | f66df82 | 2012-05-18 16:52:17 | [diff] [blame] | 171 | |
rockot | 5c478a7 | 2016-09-28 23:14:18 | [diff] [blame] | 172 | namespace mojom { |
| 173 | class CreateNewWindowParams; |
evliu | 7f736f0 | 2019-11-07 17:43:50 | [diff] [blame] | 174 | } // namespace mojom |
rockot | 5c478a7 | 2016-09-28 23:14:18 | [diff] [blame] | 175 | |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 176 | #if BUILDFLAG(IS_ANDROID) |
[email protected] | 0e813a5 | 2014-08-13 10:34:56 | [diff] [blame] | 177 | class WebContentsAndroid; |
danakj | 30f73313 | 2019-09-20 16:14:14 | [diff] [blame] | 178 | #endif |
[email protected] | 0e813a5 | 2014-08-13 10:34:56 | [diff] [blame] | 179 | |
Joel Hockey | 8c2011b2 | 2020-04-30 05:07:19 | [diff] [blame] | 180 | // CreatedWindow holds the WebContentsImpl and target url between IPC calls to |
| 181 | // CreateNewWindow and ShowCreatedWindow. |
| 182 | struct CONTENT_EXPORT CreatedWindow { |
| 183 | CreatedWindow(); |
| 184 | CreatedWindow(std::unique_ptr<WebContentsImpl> contents, GURL target_url); |
| 185 | CreatedWindow(CreatedWindow&&); |
| 186 | CreatedWindow(const CreatedWindow&) = delete; |
| 187 | CreatedWindow& operator=(CreatedWindow&&); |
| 188 | CreatedWindow& operator=(const CreatedWindow&) = delete; |
| 189 | ~CreatedWindow(); |
| 190 | |
| 191 | std::unique_ptr<WebContentsImpl> contents; |
| 192 | GURL target_url; |
| 193 | }; |
| 194 | |
Yuzu Saijo | be024af0 | 2020-05-11 07:35:56 | [diff] [blame] | 195 | using PageVisibilityState = blink::mojom::PageVisibilityState; |
| 196 | |
Nancy Xiao | 4f3eae5d6 | 2023-04-25 19:38:59 | [diff] [blame] | 197 | using ClipboardPasteData = content::ClipboardPasteData; |
| 198 | |
Aman Verma | 3047aa41 | 2024-05-28 09:09:24 | [diff] [blame] | 199 | class CONTENT_EXPORT WebContentsImpl |
| 200 | : public WebContents, |
| 201 | public FrameTree::Delegate, |
| 202 | public RenderFrameHostDelegate, |
| 203 | public RenderViewHostDelegate, |
| 204 | public RenderWidgetHostDelegate, |
| 205 | public RenderFrameHostManager::Delegate, |
| 206 | public PageDelegate, |
| 207 | public blink::mojom::ColorChooserFactory, |
| 208 | public NavigationControllerDelegate, |
| 209 | public NavigatorDelegate, |
| 210 | public ui::NativeThemeObserver, |
| 211 | public ui::ColorProviderSourceObserver, |
Shintaro Kawamura | 1042d57 | 2024-09-30 13:52:22 | [diff] [blame] | 212 | public SlowWebPreferenceCacheObserver, |
Aman Verma | 37a5859 | 2025-05-27 22:18:12 | [diff] [blame] | 213 | public input::RenderWidgetHostInputEventRouter::Delegate { |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 214 | public: |
benwells | 5e7260d | 2017-03-20 23:36:33 | [diff] [blame] | 215 | class FriendWrapper; |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 216 | |
Peter Boström | 828b902 | 2021-09-21 02:28:43 | [diff] [blame] | 217 | WebContentsImpl(const WebContentsImpl&) = delete; |
| 218 | WebContentsImpl& operator=(const WebContentsImpl&) = delete; |
| 219 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 220 | ~WebContentsImpl() override; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 221 | |
erikchen | 50735fd | 2018-05-05 15:08:33 | [diff] [blame] | 222 | static std::unique_ptr<WebContentsImpl> CreateWithOpener( |
[email protected] | 54944cde | 2012-12-09 09:24:59 | [diff] [blame] | 223 | const WebContents::CreateParams& params, |
Ian Clelland | 5cbaaf8 | 2017-11-27 22:00:03 | [diff] [blame] | 224 | RenderFrameHostImpl* opener_rfh); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 225 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 226 | static std::vector<WebContentsImpl*> GetAllWebContents(); |
| 227 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 228 | static WebContentsImpl* FromFrameTreeNode( |
| 229 | const FrameTreeNode* frame_tree_node); |
Patrick Monette | 275a6f92b | 2020-01-09 21:05:04 | [diff] [blame] | 230 | static WebContents* FromRenderFrameHostID( |
Alexander Timin | 8690530c | 2021-06-19 00:34:32 | [diff] [blame] | 231 | GlobalRenderFrameHostId render_frame_host_id); |
clamy | 0d32d6d | 2015-11-24 11:16:26 | [diff] [blame] | 232 | static WebContents* FromRenderFrameHostID(int render_process_host_id, |
| 233 | int render_frame_host_id); |
Avi Drissman | e4de125 | 2024-09-05 00:15:45 | [diff] [blame] | 234 | static WebContents* FromFrameTreeNodeId(FrameTreeNodeId frame_tree_node_id); |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 235 | static WebContentsImpl* FromOuterFrameTreeNode( |
| 236 | const FrameTreeNode* frame_tree_node); |
Matt Falkenhagen | 888db59 | 2021-09-07 20:20:25 | [diff] [blame] | 237 | static WebContentsImpl* FromRenderWidgetHostImpl(RenderWidgetHostImpl* rwh); |
Fergal Daly | 5b64d47 | 2021-10-14 04:31:29 | [diff] [blame] | 238 | static WebContentsImpl* FromRenderFrameHostImpl(RenderFrameHostImpl* rfh); |
clamy | a16aa817 | 2015-05-26 13:07:25 | [diff] [blame] | 239 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 240 | // Complex initialization here. Specifically needed to avoid having |
| 241 | // members call back into our virtual functions in the constructor. |
Harkiran Bolaria | 5ce2763 | 2022-01-20 15:05:05 | [diff] [blame] | 242 | // The primary main frame policy might be passed down as it is inherited from |
| 243 | // the opener when WebContents is created with an opener. |
| 244 | virtual void Init(const WebContents::CreateParams& params, |
| 245 | blink::FramePolicy primary_main_frame_policy); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 246 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 247 | // Returns the SavePackage which manages the page saving job. May be NULL. |
| 248 | SavePackage* save_package() const { return save_package_.get(); } |
| 249 | |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 250 | // Sets a BrowserPluginGuest object for this WebContents. If this WebContents |
| 251 | // has a BrowserPluginGuest then that implies that it is being hosted by |
| 252 | // a BrowserPlugin object in an embedder renderer process. |
Albert J. Wong | c55cc64d | 2018-10-12 02:50:04 | [diff] [blame] | 253 | void SetBrowserPluginGuest(std::unique_ptr<BrowserPluginGuest> guest); |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 254 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 255 | // Returns embedder browser plugin object, or NULL if this WebContents is not |
| 256 | // an embedder. |
[email protected] | f849734 | 2013-02-05 22:15:02 | [diff] [blame] | 257 | BrowserPluginEmbedder* GetBrowserPluginEmbedder() const; |
[email protected] | 738f57a | 2013-06-29 21:06:54 | [diff] [blame] | 258 | |
Ehsan Karamad | fa983e8 | 2018-11-13 01:26:42 | [diff] [blame] | 259 | // Returns guest browser plugin object, or nullptr if this WebContents is not |
| 260 | // for guest. |
| 261 | BrowserPluginGuest* GetBrowserPluginGuest() const; |
| 262 | |
fsamuel | 60b4228 | 2015-03-10 03:29:14 | [diff] [blame] | 263 | // Creates a BrowserPluginEmbedder object for this WebContents if one doesn't |
| 264 | // already exist. |
| 265 | void CreateBrowserPluginEmbedderIfNecessary(); |
| 266 | |
creis | 89a0f78 | 2015-05-27 16:13:17 | [diff] [blame] | 267 | // Cancels modal dialogs in this WebContents, as well as in any browser |
| 268 | // plugins it is hosting. |
| 269 | void CancelActiveAndPendingDialogs(); |
| 270 | |
[email protected] | cf200a56 | 2013-05-03 16:24:29 | [diff] [blame] | 271 | // Informs the render view host and the BrowserPluginEmbedder, if present, of |
| 272 | // a Drag Source End. |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 273 | void DragSourceEndedAt(float client_x, |
| 274 | float client_y, |
| 275 | float screen_x, |
| 276 | float screen_y, |
Henrique Ferreiro | 299008ec | 2020-12-29 14:36:28 | [diff] [blame] | 277 | ui::mojom::DragOperation operation, |
Paul Meyer | 0c58c371 | 2016-11-17 22:59:51 | [diff] [blame] | 278 | RenderWidgetHost* source_rwh); |
[email protected] | cf200a56 | 2013-05-03 16:24:29 | [diff] [blame] | 279 | |
jam | 73f89264 | 2016-09-11 06:04:06 | [diff] [blame] | 280 | // Notification that the RenderViewHost's load state changed. |
Dave Tapuska | e1a08aaf | 2021-03-05 18:31:59 | [diff] [blame] | 281 | void LoadStateChanged(network::mojom::LoadInfoPtr load_info); |
jam | 73f89264 | 2016-09-11 06:04:06 | [diff] [blame] | 282 | |
Collin Baker | 989e088 | 2019-11-01 01:27:17 | [diff] [blame] | 283 | // Updates the visibility and notifies observers. Note that this is |
| 284 | // distinct from UpdateWebContentsVisibility which may also update the |
| 285 | // visibility of renderer-side objects. |
| 286 | void SetVisibilityAndNotifyObservers(Visibility visibility); |
Francois Doray | fe4a177 | 2018-02-17 04:17:09 | [diff] [blame] | 287 | |
calamity | 7fe55ce | 2015-04-10 03:59:37 | [diff] [blame] | 288 | // Notify observers that the web contents has been focused. |
Michael Thiessen | 896405db | 2017-07-20 17:52:32 | [diff] [blame] | 289 | void NotifyWebContentsFocused(RenderWidgetHost* render_widget_host); |
calamity | 7fe55ce | 2015-04-10 03:59:37 | [diff] [blame] | 290 | |
zijiehe | 3bee08e2 | 2017-05-17 04:14:46 | [diff] [blame] | 291 | // Notify observers that the web contents has lost focus. |
Michael Thiessen | 896405db | 2017-07-20 17:52:32 | [diff] [blame] | 292 | void NotifyWebContentsLostFocus(RenderWidgetHost* render_widget_host); |
zijiehe | 3bee08e2 | 2017-05-17 04:14:46 | [diff] [blame] | 293 | |
[email protected] | fc2b46b | 2014-05-03 16:33:45 | [diff] [blame] | 294 | WebContentsView* GetView() const; |
| 295 | |
Mike Wasserman | 5a3cc61d | 2020-08-27 21:12:03 | [diff] [blame] | 296 | // Called on screen information changes; |is_multi_screen_changed| is true iff |
| 297 | // the plurality of connected screens changed (e.g. 1 screen <-> 2 screens). |
| 298 | void OnScreensChange(bool is_multi_screen_changed); |
| 299 | |
leon.han | 552e9de | 2017-02-09 14:37:30 | [diff] [blame] | 300 | void OnScreenOrientationChange(); |
| 301 | |
| 302 | ScreenOrientationProvider* GetScreenOrientationProviderForTesting() const { |
| 303 | return screen_orientation_provider_.get(); |
| 304 | } |
leon.han | e4db177a | 2017-02-07 14:19:16 | [diff] [blame] | 305 | |
Aman Verma | b3ed74e | 2024-04-29 13:58:13 | [diff] [blame] | 306 | // Return RenderWidgetHostView from RWHIER. |
| 307 | std::vector<RenderWidgetHostView*> GetRenderWidgetHostViewsForTests(); |
| 308 | |
Aman Verma | bb589a3 | 2024-05-07 16:38:17 | [diff] [blame] | 309 | bool IsDelegatedInkRendererBoundForTest() { |
| 310 | return delegated_ink_point_renderer_.is_bound(); |
| 311 | } |
| 312 | |
wjmaclean | 6495190 | 2016-04-29 20:59:12 | [diff] [blame] | 313 | // Sets the zoom level for frames associated with this WebContents. |
akaba | c6bd121 | 2018-06-25 20:10:48 | [diff] [blame] | 314 | void UpdateZoom(); |
wjmaclean | 6495190 | 2016-04-29 20:59:12 | [diff] [blame] | 315 | |
W. James MacLean | 37af605e | 2025-01-20 16:59:38 | [diff] [blame] | 316 | // Sets the zoom level for frames associated with the subtree for which |
| 317 | // `rfh_id` is a local root. Used by guest views and oopif-pdfs. |
| 318 | void UpdateZoom(const GlobalRenderFrameHostId& rfh_id); |
| 319 | |
wjmaclean | 6495190 | 2016-04-29 20:59:12 | [diff] [blame] | 320 | // Sets the zoom level for frames associated with this WebContents if it |
| 321 | // matches |host| and (if non-empty) |scheme|. Matching is done on the |
W. James MacLean | 37af605e | 2025-01-20 16:59:38 | [diff] [blame] | 322 | // last committed entry of the main frame. |
wjmaclean | 6495190 | 2016-04-29 20:59:12 | [diff] [blame] | 323 | void UpdateZoomIfNecessary(const std::string& scheme, |
akaba | c6bd121 | 2018-06-25 20:10:48 | [diff] [blame] | 324 | const std::string& host); |
W. James MacLean | 37af605e | 2025-01-20 16:59:38 | [diff] [blame] | 325 | // Same as above, except uses the last committed entry on `rfh`. |
| 326 | void UpdateZoomIfNecessary(const std::string& scheme, |
| 327 | const std::string& host, |
| 328 | RenderFrameHostImpl* rfh); |
akaba | c6bd121 | 2018-06-25 20:10:48 | [diff] [blame] | 329 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 330 | // Returns the focused WebContents. |
| 331 | // If there are multiple inner/outer WebContents (when embedding <webview>, |
| 332 | // <guestview>, ...) returns the single one containing the currently focused |
| 333 | // frame. Otherwise, returns this WebContents. |
| 334 | WebContentsImpl* GetFocusedWebContents(); |
| 335 | |
Dave Tapuska | d8b0530f | 2021-10-19 15:12:31 | [diff] [blame] | 336 | // Returns the focused FrameTree. For MPArch we may return a different |
| 337 | // focused frame tree even though the focused WebContents is the same. |
| 338 | FrameTree* GetFocusedFrameTree(); |
| 339 | |
Lukasz Anforowicz | 2cd231bf | 2020-10-02 19:13:20 | [diff] [blame] | 340 | // TODO(lukasza): Maybe this method can be removed altogether (so that the |
| 341 | // focus of the location bar is only set in the //chrome layer). |
| 342 | void SetFocusToLocationBar(); |
| 343 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 344 | // Returns a vector containing this WebContents and all inner WebContents |
| 345 | // within it (recursively). |
| 346 | std::vector<WebContentsImpl*> GetWebContentsAndAllInner(); |
| 347 | |
Carlos Caballero | 40b0efd | 2021-01-26 11:55:00 | [diff] [blame] | 348 | // Returns the primary FrameTree for this WebContents (as opposed to the |
Carlos Caballero | b65b6e3a | 2021-11-15 10:09:00 | [diff] [blame] | 349 | // ones held by MPArch features like Prerender or Fenced Frame). |
Kevin McNee | 88bf224 | 2022-11-23 00:27:34 | [diff] [blame] | 350 | // See docs/frame_trees.md for more details. |
Carlos Caballero | b65b6e3a | 2021-11-15 10:09:00 | [diff] [blame] | 351 | FrameTree& GetPrimaryFrameTree() { return primary_frame_tree_; } |
Carlos Caballero | 40b0efd | 2021-01-26 11:55:00 | [diff] [blame] | 352 | |
Carlos Caballero | ede6f8c | 2021-01-28 11:01:50 | [diff] [blame] | 353 | // Whether the initial empty page of this view has been accessed by another |
| 354 | // page, making it unsafe to show the pending URL. Always false after the |
| 355 | // first commit. |
Alison Gale | 770f3fc | 2024-04-27 00:39:58 | [diff] [blame] | 356 | // TODO(crbug.com/40165695): Rename to HasAccessedInitialMainDocument |
Carlos Caballero | ede6f8c | 2021-01-28 11:01:50 | [diff] [blame] | 357 | bool HasAccessedInitialDocument(); |
| 358 | |
Kuznetsov Alexey | 1a516bd | 2021-08-04 23:49:05 | [diff] [blame] | 359 | // Returns the human-readable name for title in Media Controls. |
| 360 | // If the returned value is an empty string, it means that there is no |
| 361 | // human-readable name. |
| 362 | std::string GetTitleForMediaControls(); |
| 363 | |
Greg Thompson | f855bf88 | 2024-01-30 10:39:45 | [diff] [blame] | 364 | // Sets the accessibility mode if this WebContents will potentially be |
| 365 | // user-visible, and broadcasts it to all of its frames if it differs from the |
Greg Thompson | 023f89b1 | 2025-05-13 16:46:03 | [diff] [blame] | 366 | // previous mode. |
Greg Thompson | f855bf88 | 2024-01-30 10:39:45 | [diff] [blame] | 367 | void SetAccessibilityMode(ui::AXMode mode); |
| 368 | |
Elad Alon | b0a3fc8 | 2024-04-03 18:22:34 | [diff] [blame] | 369 | // Inform the WebContentsImpl object that a write-access Captured Surface |
| 370 | // Control API was invoked (sendWheel, setZoomLevel) for this object. |
| 371 | // A notification is then propagated to observers. |
| 372 | void DidCapturedSurfaceControl(); |
| 373 | |
Joel Hockey | cbdcbecd | 2025-08-08 20:06:38 | [diff] [blame] | 374 | #if BUILDFLAG(IS_ANDROID) |
Jinsuk Kim | c8eac44 | 2024-07-19 18:33:52 | [diff] [blame] | 375 | // Let long press on links select the link text instead of triggering |
| 376 | // the context menu. |
Jinsuk Kim | c8eac44 | 2024-07-19 18:33:52 | [diff] [blame] | 377 | void SetLongPressLinkSelectText(bool enabled); |
Joel Hockey | cbdcbecd | 2025-08-08 20:06:38 | [diff] [blame] | 378 | |
| 379 | // Allow drag-drop of files such as an image to load and replace contents. |
| 380 | void SetCanAcceptLoadDrops(bool enabled); |
| 381 | bool GetCanAcceptLoadDropsForTesting(); |
Jinsuk Kim | c8eac44 | 2024-07-19 18:33:52 | [diff] [blame] | 382 | #endif |
| 383 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 384 | // WebContents ------------------------------------------------------ |
Jeremy Roman | a0b70c3 | 2023-11-09 22:22:53 | [diff] [blame] | 385 | WebContentsDelegate* GetDelegate() final; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 386 | void SetDelegate(WebContentsDelegate* delegate) override; |
| 387 | NavigationControllerImpl& GetController() override; |
Elad Alon | 32044f53 | 2025-03-04 22:16:03 | [diff] [blame] | 388 | const NavigationControllerImpl& GetController() const override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 389 | BrowserContext* GetBrowserContext() override; |
Claudio DeSouza | 2be02d4 | 2021-08-12 23:23:40 | [diff] [blame] | 390 | base::WeakPtr<WebContents> GetWeakPtr() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 391 | const GURL& GetURL() override; |
| 392 | const GURL& GetVisibleURL() override; |
Elad Alon | 32044f53 | 2025-03-04 22:16:03 | [diff] [blame] | 393 | const GURL& GetLastCommittedURL() const override; |
Peter Kasting | 2caacff6 | 2023-05-24 16:06:53 | [diff] [blame] | 394 | const RenderFrameHostImpl* GetPrimaryMainFrame() const override; |
Dave Tapuska | 1d5e577 | 2022-06-02 17:26:01 | [diff] [blame] | 395 | RenderFrameHostImpl* GetPrimaryMainFrame() override; |
Sreeja Kamishetty | 3dde631 | 2021-06-22 14:05:29 | [diff] [blame] | 396 | PageImpl& GetPrimaryPage() override; |
nick | 53d5cbf | 2015-04-23 22:50:14 | [diff] [blame] | 397 | RenderFrameHostImpl* GetFocusedFrame() override; |
Avi Drissman | e4de125 | 2024-09-05 00:15:45 | [diff] [blame] | 398 | bool IsPrerenderedFrame(FrameTreeNodeId frame_tree_node_id) override; |
creis | f71a263 | 2017-05-04 19:03:50 | [diff] [blame] | 399 | RenderFrameHostImpl* UnsafeFindFrameByFrameTreeNodeId( |
Avi Drissman | e4de125 | 2024-09-05 00:15:45 | [diff] [blame] | 400 | FrameTreeNodeId frame_tree_node_id) override; |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 401 | void ForEachRenderFrameHostWithAction( |
| 402 | base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) |
| 403 | override; |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 404 | void ForEachRenderFrameHost( |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 405 | base::FunctionRef<void(RenderFrameHost*)> on_frame) override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 406 | RenderViewHostImpl* GetRenderViewHost() override; |
| 407 | RenderWidgetHostView* GetRenderWidgetHostView() override; |
lfg | 265a267 | 2016-04-23 03:11:02 | [diff] [blame] | 408 | RenderWidgetHostView* GetTopLevelRenderWidgetHostView() override; |
Rodney Ding | 353fe93 | 2025-06-19 18:51:08 | [diff] [blame] | 409 | RenderWidgetHost* FindWidgetAtPoint(const gfx::PointF& point) override; |
nasko | c0fceff | 2015-04-30 15:53:52 | [diff] [blame] | 410 | void ClosePage() override; |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 411 | std::optional<SkColor> GetThemeColor() override; |
| 412 | std::optional<SkColor> GetBackgroundColor() override; |
| 413 | void SetPageBaseBackgroundColor(std::optional<SkColor> color) override; |
tom | 855c4bf3 | 2021-09-30 00:27:26 | [diff] [blame] | 414 | void SetColorProviderSource(ui::ColorProviderSource* source) override; |
Sean Kau | d730f5b | 2023-06-22 16:21:33 | [diff] [blame] | 415 | ui::ColorProviderKey::ColorMode GetColorMode() const override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 416 | WebUI* GetWebUI() override; |
Maks Orlovich | 73f374d | 2020-04-02 12:46:13 | [diff] [blame] | 417 | void SetUserAgentOverride(const blink::UserAgentOverride& ua_override, |
Changwan Ryu | c1134a8 | 2018-03-07 02:10:14 | [diff] [blame] | 418 | bool override_in_new_tabs) override; |
Maks Orlovich | 73f374d | 2020-04-02 12:46:13 | [diff] [blame] | 419 | const blink::UserAgentOverride& GetUserAgentOverride() override; |
Scott Violet | 2a6c5bff | 2020-04-29 23:59:06 | [diff] [blame] | 420 | bool ShouldOverrideUserAgentForRendererInitiatedNavigation() override; |
Aman Verma | a4b33cf | 2023-06-13 19:32:33 | [diff] [blame] | 421 | void SetAlwaysSendSubresourceNotifications() override; |
| 422 | bool GetSendSubresourceNotification() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 423 | bool IsWebContentsOnlyAccessibilityModeForTesting() override; |
| 424 | bool IsFullAccessibilityModeForTesting() override; |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 425 | const std::u16string& GetTitle() override; |
Stanley Hon | f83c4b8b | 2025-01-08 00:52:30 | [diff] [blame] | 426 | const std::optional<std::u16string>& GetApplicationTitle() override; |
afakhry | 6f0c1ec2 | 2016-07-14 13:55:13 | [diff] [blame] | 427 | void UpdateTitleForEntry(NavigationEntry* entry, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 428 | const std::u16string& title) override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 429 | SiteInstanceImpl* GetSiteInstance() override; |
| 430 | bool IsLoading() override; |
| 431 | double GetLoadProgress() override; |
Nate Chapin | 9aabf5f | 2021-11-12 00:31:19 | [diff] [blame] | 432 | bool ShouldShowLoadingUI() override; |
Sreeja Kamishetty | 8134758 | 2022-01-06 12:46:33 | [diff] [blame] | 433 | bool IsDocumentOnLoadCompletedInPrimaryMainFrame() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 434 | bool IsWaitingForResponse() override; |
Lijin Shen | 8c0f436 | 2024-03-25 20:05:09 | [diff] [blame] | 435 | bool HasUncommittedNavigationInPrimaryMainFrame() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 436 | const net::LoadStateWithParam& GetLoadState() override; |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 437 | const std::u16string& GetLoadStateHost() override; |
Avi Drissman | 1e620f3 | 2018-03-16 13:57:29 | [diff] [blame] | 438 | void RequestAXTreeSnapshot(AXTreeSnapshotCallback callback, |
Dominic Mazzoni | 77d0aba | 2021-01-14 09:42:16 | [diff] [blame] | 439 | ui::AXMode ax_mode, |
Dominic Mazzoni | 77d0aba | 2021-01-14 09:42:16 | [diff] [blame] | 440 | size_t max_nodes, |
Vladimir Levin | f01905d | 2024-07-23 13:35:21 | [diff] [blame] | 441 | base::TimeDelta timeout, |
| 442 | AXTreeSnapshotPolicy policy) override; |
Mark Schillaci | c1e067e8 | 2025-04-02 17:36:11 | [diff] [blame] | 443 | ui::AXTreeUpdate RequestAXTreeSnapshotWithinBrowserProcess() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 444 | uint64_t GetUploadSize() override; |
| 445 | uint64_t GetUploadPosition() override; |
| 446 | const std::string& GetEncoding() override; |
Thomas Lukaszewicz | e4cdf6e | 2025-07-31 23:32:27 | [diff] [blame] | 447 | void Discard(base::OnceClosure on_discarded_cb) override; |
Charles Zhao | d72f99d | 2018-09-17 14:18:27 | [diff] [blame] | 448 | bool WasDiscarded() override; |
Thomas Lukaszewicz | 034b34f | 2024-08-29 22:44:32 | [diff] [blame] | 449 | void SetWasDiscarded(bool was_discarded) override; |
Daniel Cheng | 9c9fa1a | 2022-01-14 03:42:11 | [diff] [blame] | 450 | [[nodiscard]] base::ScopedClosureRunner IncrementCapturerCount( |
Dale Curtis | 7030f25 | 2021-04-07 14:05:31 | [diff] [blame] | 451 | const gfx::Size& capture_size, |
| 452 | bool stay_hidden, |
Elad Alon | 0feb660 | 2021-10-14 09:26:36 | [diff] [blame] | 453 | bool stay_awake, |
Avi Drissman | 5710b06 | 2024-07-02 21:23:29 | [diff] [blame] | 454 | bool is_activity) override; |
Elad Alon | f156eb6 | 2021-05-17 22:02:37 | [diff] [blame] | 455 | const blink::mojom::CaptureHandleConfig& GetCaptureHandleConfig() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 456 | bool IsBeingCaptured() override; |
Xianzhu Wang | c61434c | 2020-08-21 19:17:30 | [diff] [blame] | 457 | bool IsBeingVisiblyCaptured() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 458 | bool IsAudioMuted() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 459 | void SetAudioMuted(bool mute) override; |
Jan Rucka | 442c83f | 2017-08-08 13:27:54 | [diff] [blame] | 460 | bool IsCurrentlyAudible() override; |
Patrick Monette | 15442a1 | 2025-01-22 20:09:31 | [diff] [blame] | 461 | bool IsCapabilityActive(WebContentsCapabilityType capability_type) override; |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 462 | bool HasFileSystemAccessHandles() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 463 | bool HasPictureInPictureVideo() override; |
Klaus Weidner | d821943 | 2022-02-08 21:50:59 | [diff] [blame] | 464 | bool HasPictureInPictureDocument() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 465 | bool IsCrashed() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 466 | base::TerminationStatus GetCrashedStatus() override; |
| 467 | int GetCrashedErrorCode() override; |
| 468 | bool IsBeingDestroyed() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 469 | void NotifyNavigationStateChanged(InvalidateTypes changed_flags) override; |
Chris Hamilton | df0d72cd | 2018-05-29 16:23:53 | [diff] [blame] | 470 | void OnAudioStateChanged() override; |
Olivier ROBIN | 4b58dd93 | 2024-08-06 13:30:32 | [diff] [blame] | 471 | base::TimeTicks GetLastActiveTimeTicks() override; |
Olivier ROBIN | da292fb | 2024-08-07 14:32:29 | [diff] [blame] | 472 | base::Time GetLastActiveTime() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 473 | void WasShown() override; |
| 474 | void WasHidden() override; |
Francois Doray | 1880097 | 2017-08-25 22:38:58 | [diff] [blame] | 475 | void WasOccluded() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 476 | Visibility GetVisibility() override; |
Rakina Zata Amni | 26e8d8a | 2020-08-05 06:06:06 | [diff] [blame] | 477 | bool NeedToFireBeforeUnloadOrUnloadEvents() override; |
Chris Hamilton | 3b3e315d | 2018-09-19 13:16:21 | [diff] [blame] | 478 | void DispatchBeforeUnload(bool auto_cancel) override; |
Dave Tapuska | 82b5401 | 2022-07-15 23:26:10 | [diff] [blame] | 479 | void AttachInnerWebContents( |
| 480 | std::unique_ptr<WebContents> inner_web_contents, |
| 481 | RenderFrameHost* render_frame_host, |
Dave Tapuska | 82b5401 | 2022-07-15 23:26:10 | [diff] [blame] | 482 | bool is_full_page) override; |
Keren Zhu | 9e37803 | 2025-05-26 19:20:39 | [diff] [blame] | 483 | void AttachUnownedInnerWebContents( |
| 484 | base::PassKey<UnownedInnerWebContentsClient>, |
| 485 | WebContents* inner_web_contents, |
| 486 | RenderFrameHost* render_frame_host) override; |
| 487 | void DetachUnownedInnerWebContents( |
| 488 | base::PassKey<UnownedInnerWebContentsClient>, |
| 489 | WebContents* inner_web_contents) override; |
Kevin McNee | 2585e73 | 2024-10-28 22:11:19 | [diff] [blame] | 490 | void AttachGuestPage(std::unique_ptr<GuestPageHolder> guest_page, |
| 491 | RenderFrameHost* outer_render_frame_host) override; |
W. James MacLean | 2539adb3 | 2019-12-13 00:40:44 | [diff] [blame] | 492 | bool IsInnerWebContentsForGuest() override; |
Lucas Furukawa Gadani | 2ec00c8 | 2018-12-14 15:53:16 | [diff] [blame] | 493 | RenderFrameHostImpl* GetOuterWebContentsFrame() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 494 | WebContentsImpl* GetOuterWebContents() override; |
W. James MacLean | 3f9fba23 | 2018-08-16 15:20:36 | [diff] [blame] | 495 | WebContentsImpl* GetOutermostWebContents() override; |
Lucas Furukawa Gadani | 2ec00c8 | 2018-12-14 15:53:16 | [diff] [blame] | 496 | std::vector<WebContents*> GetInnerWebContents() override; |
Jeremy Roman | 7e70bf95 | 2020-01-07 23:23:58 | [diff] [blame] | 497 | WebContentsImpl* GetResponsibleWebContents() override; |
dalecurtis | 6c58ed0 | 2016-10-28 23:02:37 | [diff] [blame] | 498 | void DidChangeVisibleSecurityState() override; |
Bruce Long | 1e3e1f54 | 2019-10-16 17:56:28 | [diff] [blame] | 499 | void SyncRendererPrefs() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 500 | void Stop() override; |
Francois Doray | 47f759d | 2018-06-11 18:13:51 | [diff] [blame] | 501 | void SetPageFrozen(bool frozen) override; |
erikchen | 6c7df7f7a | 2018-05-03 18:13:59 | [diff] [blame] | 502 | std::unique_ptr<WebContents> Clone() override; |
arthursonzogni | 818c264 | 2019-09-27 12:18:10 | [diff] [blame] | 503 | void ReloadFocusedFrame() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 504 | void Undo() override; |
| 505 | void Redo() override; |
| 506 | void Cut() override; |
| 507 | void Copy() override; |
| 508 | void CopyToFindPboard() override; |
Leonard Grey | c2bc800 | 2023-03-08 17:53:06 | [diff] [blame] | 509 | void CenterSelection() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 510 | void Paste() override; |
| 511 | void PasteAndMatchStyle() override; |
| 512 | void Delete() override; |
| 513 | void SelectAll() override; |
yabinh | 351e7ec | 2017-03-10 02:43:24 | [diff] [blame] | 514 | void CollapseSelection() override; |
Leonard Grey | f378e7d | 2021-03-25 20:53:50 | [diff] [blame] | 515 | void ScrollToTopOfDocument() override; |
| 516 | void ScrollToBottomOfDocument() override; |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 517 | void Replace(const std::u16string& word) override; |
| 518 | void ReplaceMisspelling(const std::u16string& word) override; |
Andrew Paseltiner | 31c56ab | 2024-11-20 18:26:19 | [diff] [blame] | 519 | void NotifyContextMenuClosed( |
| 520 | const GURL& link_followed, |
| 521 | const std::optional<blink::Impression>&) override; |
Gyuyoung Kim | 1bc1ba8 | 2021-02-08 23:32:44 | [diff] [blame] | 522 | void ExecuteCustomContextMenuCommand(int action, |
| 523 | const GURL& link_followed) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 524 | gfx::NativeView GetNativeView() override; |
| 525 | gfx::NativeView GetContentNativeView() override; |
| 526 | gfx::NativeWindow GetTopLevelNativeWindow() override; |
| 527 | gfx::Rect GetContainerBounds() override; |
| 528 | gfx::Rect GetViewBounds() override; |
| 529 | DropData* GetDropData() override; |
| 530 | void Focus() override; |
| 531 | void SetInitialFocus() override; |
| 532 | void StoreFocus() override; |
| 533 | void RestoreFocus() override; |
| 534 | void FocusThroughTabTraversal(bool reverse) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 535 | bool IsSavable() override; |
| 536 | void OnSavePage() override; |
| 537 | bool SavePage(const base::FilePath& main_file, |
| 538 | const base::FilePath& dir_path, |
| 539 | SavePageType save_type) override; |
Yao Xiao | e500704 | 2021-02-26 02:32:09 | [diff] [blame] | 540 | void SaveFrame(const GURL& url, |
| 541 | const Referrer& referrer, |
| 542 | RenderFrameHost* rfh) override; |
kundaji | 6c7f969 | 2015-03-09 18:00:37 | [diff] [blame] | 543 | void SaveFrameWithHeaders(const GURL& url, |
| 544 | const Referrer& referrer, |
Xing Liu | 10329bf | 2018-03-20 19:22:14 | [diff] [blame] | 545 | const std::string& headers, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 546 | const std::u16string& suggested_filename, |
Jeremy Roman | 4d408d8a | 2024-01-10 02:27:21 | [diff] [blame] | 547 | RenderFrameHost* rfh, |
| 548 | bool is_subresource) override; |
dewittj | 6dc5747a | 2016-05-17 01:48:47 | [diff] [blame] | 549 | void GenerateMHTML(const MHTMLGenerationParams& params, |
Avi Drissman | 149b783 | 2018-03-23 14:31:49 | [diff] [blame] | 550 | base::OnceCallback<void(int64_t)> callback) override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 551 | const std::string& GetContentsMimeType() override; |
Mario Sanchez Prada | 0bd8b8c | 2020-10-21 17:49:23 | [diff] [blame] | 552 | blink::RendererPreferences* GetMutableRendererPrefs() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 553 | void Close() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 554 | void SetClosedByUserGesture(bool value) override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 555 | bool GetClosedByUserGesture() override; |
| 556 | int GetMinimumZoomPercent() override; |
| 557 | int GetMaximumZoomPercent() override; |
mcnee | 432e47d | 2015-11-09 19:37:46 | [diff] [blame] | 558 | void SetPageScale(float page_scale_factor) override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 559 | gfx::Size GetPreferredSize() override; |
Takumi Fujimoto | 4661871d | 2024-01-25 02:04:18 | [diff] [blame] | 560 | bool GotResponseToPointerLockRequest( |
James Hollyer | d5c9de46 | 2020-03-10 19:02:45 | [diff] [blame] | 561 | blink::mojom::PointerLockResult result) override; |
Takumi Fujimoto | 4661871d | 2024-01-25 02:04:18 | [diff] [blame] | 562 | void GotPointerLockPermissionResponse(bool allowed) override; |
| 563 | void DropPointerLockForTesting() override; |
Joe Downing | 13dd76b | 2018-04-09 18:32:15 | [diff] [blame] | 564 | bool GotResponseToKeyboardLockRequest(bool allowed) override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 565 | bool HasOpener() override; |
| 566 | RenderFrameHostImpl* GetOpener() override; |
Rakina Zata Amni | 3a48ae4 | 2022-05-05 03:39:56 | [diff] [blame] | 567 | bool HasLiveOriginalOpenerChain() override; |
| 568 | WebContents* GetFirstWebContentsInLiveOriginalOpenerChain() override; |
Tom Burgin | f0e4862 | 2024-05-16 15:06:12 | [diff] [blame] | 569 | #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 570 | void DidChooseColorInColorChooser(SkColor color) override; |
| 571 | void DidEndColorChooser() override; |
Julie Jeongeun Kim | 88ce9ec | 2023-07-28 02:25:40 | [diff] [blame] | 572 | #endif |
Jacob Francis | 0043f24 | 2024-07-24 21:46:21 | [diff] [blame] | 573 | int DownloadImageFromAxNode(const ui::AXTreeID tree_id, |
| 574 | const ui::AXNodeID node_id, |
| 575 | const gfx::Size& preferred_size, |
| 576 | uint32_t max_bitmap_size, |
| 577 | bool bypass_cache, |
| 578 | ImageDownloadCallback callback) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 579 | int DownloadImage(const GURL& url, |
| 580 | bool is_favicon, |
Rouslan Solomakhin | db19343e | 2021-09-15 15:34:55 | [diff] [blame] | 581 | const gfx::Size& preferred_size, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 582 | uint32_t max_bitmap_size, |
pkotwicz | fd77355 | 2015-03-16 00:29:14 | [diff] [blame] | 583 | bool bypass_cache, |
Avi Drissman | a5a52dd | 2018-03-27 03:39:02 | [diff] [blame] | 584 | ImageDownloadCallback callback) override; |
Jacob Francis | 0043f24 | 2024-07-24 21:46:21 | [diff] [blame] | 585 | |
Danyao Wang | a78f3dd2 | 2020-03-05 05:31:27 | [diff] [blame] | 586 | int DownloadImageInFrame( |
Alexander Timin | 8690530c | 2021-06-19 00:34:32 | [diff] [blame] | 587 | const GlobalRenderFrameHostId& initiator_frame_routing_id, |
Danyao Wang | a78f3dd2 | 2020-03-05 05:31:27 | [diff] [blame] | 588 | const GURL& url, |
| 589 | bool is_favicon, |
Rouslan Solomakhin | db19343e | 2021-09-15 15:34:55 | [diff] [blame] | 590 | const gfx::Size& preferred_size, |
Danyao Wang | a78f3dd2 | 2020-03-05 05:31:27 | [diff] [blame] | 591 | uint32_t max_bitmap_size, |
| 592 | bool bypass_cache, |
| 593 | WebContents::ImageDownloadCallback callback) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 594 | void Find(int request_id, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 595 | const std::u16string& search_text, |
Joey Arhar | cac45bf | 2022-01-07 21:59:31 | [diff] [blame] | 596 | blink::mojom::FindOptionsPtr options, |
Avi Drissman | 5710b06 | 2024-07-02 21:23:29 | [diff] [blame] | 597 | bool skip_delay) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 598 | void StopFinding(StopFindAction action) override; |
Tommy Steimel | 1836051 | 2017-11-01 00:38:19 | [diff] [blame] | 599 | bool WasEverAudible() override; |
Avi Drissman | 97aef04 | 2020-06-30 21:04:48 | [diff] [blame] | 600 | bool IsFullscreen() override; |
Malay Keshav | 87c42c0 | 2019-01-15 08:37:47 | [diff] [blame] | 601 | bool ShouldShowStaleContentOnEviction() override; |
Muyao Xu | db226be5 | 2023-12-01 04:23:09 | [diff] [blame] | 602 | void ExitFullscreen(bool will_cause_resize) override; |
Daniel Cheng | 9c9fa1a | 2022-01-14 03:42:11 | [diff] [blame] | 603 | [[nodiscard]] base::ScopedClosureRunner ForSecurityDropFullscreen( |
Avi Drissman | 5710b06 | 2024-07-02 21:23:29 | [diff] [blame] | 604 | int64_t display_id) override; |
mariakhomenko | 44bdc473 | 2015-04-29 01:55:38 | [diff] [blame] | 605 | void ResumeLoadingCreatedWebContents() override; |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 606 | void SetIsOverlayContent(bool is_overlay_content) override; |
ekaramad | 5c1f939 | 2017-01-25 02:05:23 | [diff] [blame] | 607 | bool IsFocusedElementEditable() override; |
| 608 | void ClearFocusedElement() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 609 | bool IsShowingContextMenu() override; |
ekaramad | f6750aa | 2017-06-06 18:29:42 | [diff] [blame] | 610 | void SetShowingContextMenu(bool showing) override; |
Aidan Wolter | 52bcc12a | 2018-11-14 03:27:29 | [diff] [blame] | 611 | base::UnguessableToken GetAudioGroupId() override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 612 | bool CompletedFirstVisuallyNonEmptyPaint() override; |
Miyoung Shin | 5709ab0 | 2020-02-19 06:50:41 | [diff] [blame] | 613 | void UpdateFaviconURL( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 614 | RenderFrameHostImpl* source, |
Ian Vollick | 6d75ac3 | 2021-05-05 17:45:09 | [diff] [blame] | 615 | const std::vector<blink::mojom::FaviconURLPtr>& candidates) override; |
Miyoung Shin | 5709ab0 | 2020-02-19 06:50:41 | [diff] [blame] | 616 | const std::vector<blink::mojom::FaviconURLPtr>& GetFaviconURLs() override; |
Mugdha Lakhani | 0a0d786 | 2020-07-29 09:58:45 | [diff] [blame] | 617 | void Resize(const gfx::Rect& new_bounds) override; |
| 618 | gfx::Size GetSize() override; |
Amanda Baker | 228ec48 | 2021-03-24 19:50:08 | [diff] [blame] | 619 | void UpdateWindowControlsOverlay(const gfx::Rect& bounding_rect) override; |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 620 | #if BUILDFLAG(IS_ANDROID) |
dcheng | 48d97c5 | 2015-02-04 20:03:20 | [diff] [blame] | 621 | base::android::ScopedJavaLocalRef<jobject> GetJavaWebContents() override; |
Nicolas Ouellet-Payeur | 177a6c4 | 2023-01-25 20:25:07 | [diff] [blame] | 622 | base::android::ScopedJavaLocalRef<jthrowable> GetJavaCreatorLocation() |
| 623 | override; |
Kevin McNee | 576bb5d8 | 2019-05-29 16:47:51 | [diff] [blame] | 624 | WebContentsAndroid* GetWebContentsAndroid(); |
| 625 | void ClearWebContentsAndroid(); |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 626 | void ActivateNearestFindResult(float x, float y) override; |
| 627 | void RequestFindMatchRects(int current_version) override; |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 628 | service_manager::InterfaceProvider* GetJavaInterfaces() override; |
Shintaro Kawamura | 30df3e5 | 2025-04-10 15:08:21 | [diff] [blame] | 629 | ChildProcessImportance GetPrimaryMainFrameImportanceForTesting() override; |
Shin Kawamura | 7c2f469 | 2025-07-30 00:14:33 | [diff] [blame] | 630 | ChildProcessImportance GetPrimaryPageSubframeImportanceForTesting() override; |
| 631 | void SetPrimaryPageImportance( |
| 632 | ChildProcessImportance main_frame_importance, |
| 633 | ChildProcessImportance subframe_importance) override; |
[email protected] | 155c7f2 | 2013-12-09 17:07:18 | [diff] [blame] | 634 | #endif |
Evan Stade | 6decc97 | 2022-10-24 19:42:18 | [diff] [blame] | 635 | bool HasRecentInteraction() override; |
Takashi Toyoshima | d72a465a | 2024-03-11 23:37:31 | [diff] [blame] | 636 | [[nodiscard]] ScopedIgnoreInputEvents IgnoreInputEvents( |
| 637 | std::optional<WebInputEventAuditCallback> audit_callback) override; |
Erik Chen | fac57680 | 2024-11-14 15:26:33 | [diff] [blame] | 638 | bool ShouldIgnoreInputEventsForTesting() override; |
Sebastien Marchand | c38e5ae | 2021-02-18 20:28:13 | [diff] [blame] | 639 | bool HasActiveEffectivelyFullscreenVideo() override; |
Alexander Timin | bebb200 | 2021-04-20 15:42:24 | [diff] [blame] | 640 | void WriteIntoTrace(perfetto::TracedValue context) override; |
Lukasz Anforowicz | 2c1573a | 2021-09-21 18:58:18 | [diff] [blame] | 641 | const base::Location& GetCreatorLocation() override; |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 642 | const std::optional<blink::mojom::PictureInPictureWindowOptions>& |
Tommy Steimel | 57eafde | 2023-01-27 17:33:24 | [diff] [blame] | 643 | GetPictureInPictureOptions() const override; |
Peilin Wang | ae08e26e | 2024-06-10 20:55:30 | [diff] [blame] | 644 | void UpdateBrowserControlsState( |
| 645 | cc::BrowserControlsState constraints, |
| 646 | cc::BrowserControlsState current, |
| 647 | bool animate, |
Peilin Wang | 1187e4e8 | 2025-02-10 08:53:29 | [diff] [blame] | 648 | const std::optional<cc::BrowserControlsOffsetTagModifications>& |
| 649 | offset_tag_modifications) override; |
Marja Hölttä | 2019e9d | 2023-09-07 14:07:35 | [diff] [blame] | 650 | void SetV8CompileHints(base::ReadOnlySharedMemoryRegion data) override; |
Joe Mason | 7ae0e2b | 2021-11-01 12:30:36 | [diff] [blame] | 651 | void SetTabSwitchStartTime(base::TimeTicks start_time, |
Joe Mason | b700435 | 2022-04-06 03:11:08 | [diff] [blame] | 652 | bool destination_is_loaded) override; |
Takashi Toyoshima | 8dfc05c | 2024-01-29 21:03:51 | [diff] [blame] | 653 | bool IsInPreviewMode() const override; |
| 654 | void WillActivatePreviewPage() override; |
Takashi Toyoshima | 138cf44a | 2023-11-02 10:33:25 | [diff] [blame] | 655 | void ActivatePreviewPage() override; |
Fabio Muratori | 8ff2689 | 2025-05-06 19:07:21 | [diff] [blame] | 656 | WindowOpenDisposition GetOriginalWindowOpenDisposition() const override; |
Min Qin | 7b7cbbbf | 2018-06-04 21:49:31 | [diff] [blame] | 657 | |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 658 | // Implementation of PageNavigator. |
HuanPo Lin | 0d795c6 | 2024-03-28 03:54:05 | [diff] [blame] | 659 | WebContents* OpenURL(const OpenURLParams& params, |
| 660 | base::OnceCallback<void(content::NavigationHandle&)> |
| 661 | navigation_handle_callback) override; |
[email protected] | 151a63d | 2011-12-20 22:32:52 | [diff] [blame] | 662 | |
Gyuyoung Kim | 1ac4ca78 | 2020-09-11 03:32:51 | [diff] [blame] | 663 | const blink::web_pref::WebPreferences& GetOrCreateWebPreferences() override; |
Rakina Zata Amni | 347b7090 | 2020-07-22 10:49:04 | [diff] [blame] | 664 | void NotifyPreferencesChanged() override; |
Gyuyoung Kim | 1ac4ca78 | 2020-09-11 03:32:51 | [diff] [blame] | 665 | void SetWebPreferences(const blink::web_pref::WebPreferences& prefs) override; |
Rakina Zata Amni | 4029b6d | 2020-07-28 02:36:20 | [diff] [blame] | 666 | void OnWebPreferencesChanged() override; |
Rakina Zata Amni | 347b7090 | 2020-07-22 10:49:04 | [diff] [blame] | 667 | |
Thomas Lukaszewicz | 034b34f | 2024-08-29 22:44:32 | [diff] [blame] | 668 | void AboutToBeDiscarded(WebContents* new_contents) override; |
Thomas Lukaszewicz | 8ada31b | 2024-09-01 19:18:16 | [diff] [blame] | 669 | void NotifyWasDiscarded() override; |
Thomas Lukaszewicz | 034b34f | 2024-08-29 22:44:32 | [diff] [blame] | 670 | |
Jan Keitel | 1d8d51d | 2023-08-22 05:53:47 | [diff] [blame] | 671 | [[nodiscard]] base::ScopedClosureRunner CreateDisallowCustomCursorScope( |
| 672 | int max_dimension_dips) override; |
Andy Paicu | 5608bda8 | 2023-03-03 15:09:20 | [diff] [blame] | 673 | |
Charles Meng | c2cca37e | 2023-08-15 18:14:30 | [diff] [blame] | 674 | void SetOverscrollNavigationEnabled(bool enabled) override; |
| 675 | |
[email protected] | 92404c6 | 2013-12-04 16:40:46 | [diff] [blame] | 676 | // RenderFrameHostDelegate --------------------------------------------------- |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 677 | bool OnMessageReceived(RenderFrameHostImpl* render_frame_host, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 678 | const IPC::Message& message) override; |
Abhijeet Kandalkar | de7348e | 2020-01-13 06:06:54 | [diff] [blame] | 679 | void OnDidBlockNavigation( |
| 680 | const GURL& blocked_url, |
| 681 | const GURL& initiator_url, |
| 682 | blink::mojom::NavigationBlockedReason reason) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 683 | void OnDidFinishLoad(RenderFrameHostImpl* render_frame_host, |
Gyuyoung Kim | 525e0c5d | 2020-03-09 15:04:19 | [diff] [blame] | 684 | const GURL& url) override; |
Sreeja Kamishetty | cfb4b86 | 2022-03-29 16:59:39 | [diff] [blame] | 685 | void OnManifestUrlChanged(PageImpl& page) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 686 | void RenderFrameCreated(RenderFrameHostImpl* render_frame_host) override; |
| 687 | void RenderFrameDeleted(RenderFrameHostImpl* render_frame_host) override; |
Gyuyoung Kim | 1bc1ba8 | 2021-02-08 23:32:44 | [diff] [blame] | 688 | void ShowContextMenu( |
Dave Tapuska | cf5a962 | 2024-11-03 19:01:27 | [diff] [blame] | 689 | RenderFrameHostImpl& render_frame_host, |
Gyuyoung Kim | 1bc1ba8 | 2021-02-08 23:32:44 | [diff] [blame] | 690 | mojo::PendingAssociatedRemote<blink::mojom::ContextMenuClient> |
| 691 | context_menu_client, |
| 692 | const ContextMenuParams& params) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 693 | void RunJavaScriptDialog(RenderFrameHostImpl* render_frame_host, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 694 | const std::u16string& message, |
| 695 | const std::u16string& default_prompt, |
avi | 777ff45 | 2017-02-09 19:04:48 | [diff] [blame] | 696 | JavaScriptDialogType dialog_type, |
Carlos IL | 5c669bc | 2021-05-26 21:16:24 | [diff] [blame] | 697 | bool disable_third_party_subframe_suppresion, |
Dave Tapuska | cdf545cc | 2020-01-23 18:38:52 | [diff] [blame] | 698 | JavaScriptDialogCallback response_callback) override; |
Dave Tapuska | be4fbe4 | 2025-01-08 16:31:43 | [diff] [blame] | 699 | void Close(RenderFrameHostImpl* render_frame_host) override; |
Dave Tapuska | cdf545cc | 2020-01-23 18:38:52 | [diff] [blame] | 700 | void RunBeforeUnloadConfirm( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 701 | RenderFrameHostImpl* render_frame_host, |
Dave Tapuska | cdf545cc | 2020-01-23 18:38:52 | [diff] [blame] | 702 | bool is_reload, |
| 703 | JavaScriptDialogCallback response_callback) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 704 | void DidChangeName(RenderFrameHostImpl* render_frame_host, |
alexmos | be2f4c3 | 2015-03-10 02:30:23 | [diff] [blame] | 705 | const std::string& name) override; |
John Delaney | b625dca9 | 2021-04-14 17:00:34 | [diff] [blame] | 706 | void DidReceiveUserActivation( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 707 | RenderFrameHostImpl* render_frame_host) override; |
Jonathan Njeunje | b76968765 | 2023-06-15 16:46:30 | [diff] [blame] | 708 | void WebAuthnAssertionRequestSucceeded( |
| 709 | RenderFrameHostImpl* render_frame_host) override; |
Robert Sesek | c4eeccbd | 2021-07-23 21:20:19 | [diff] [blame] | 710 | void BindDisplayCutoutHost( |
| 711 | RenderFrameHostImpl* render_frame_host, |
| 712 | mojo::PendingAssociatedReceiver<blink::mojom::DisplayCutoutHost> receiver) |
| 713 | override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 714 | void DidChangeDisplayState(RenderFrameHostImpl* render_frame_host, |
John Delaney | 0146a74 | 2019-01-25 19:25:28 | [diff] [blame] | 715 | bool is_display_none) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 716 | void FrameSizeChanged(RenderFrameHostImpl* render_frame_host, |
John Delaney | 0146a74 | 2019-01-25 19:25:28 | [diff] [blame] | 717 | const gfx::Size& frame_size) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 718 | void DOMContentLoaded(RenderFrameHostImpl* render_frame_host) override; |
| 719 | void DocumentOnLoadCompleted(RenderFrameHostImpl* render_frame_host) override; |
| 720 | void UpdateTitle(RenderFrameHostImpl* render_frame_host, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 721 | const std::u16string& title, |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 722 | base::i18n::TextDirection title_direction) override; |
Haben Foto | 533aa35 | 2024-01-09 22:01:16 | [diff] [blame] | 723 | // The app title is an alternative title. If non-empty, the browser may choose |
| 724 | // to use the app title instead of the regular title for a web app displayed |
| 725 | // in an app window. See |
| 726 | // https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/DocumentSubtitle/explainer.md |
Stanley Hon | f83c4b8b | 2025-01-08 00:52:30 | [diff] [blame] | 727 | void UpdateApplicationTitle(RenderFrameHostImpl* render_frame_host, |
| 728 | const std::u16string& application_title) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 729 | void UpdateTargetURL(RenderFrameHostImpl* render_frame_host, |
Mario Sanchez Prada | dffbe66e | 2020-09-07 12:01:08 | [diff] [blame] | 730 | const GURL& url) override; |
danakj | 77eb7e8 | 2020-01-09 19:38:46 | [diff] [blame] | 731 | bool IsNeverComposited() override; |
Elad Alon | f156eb6 | 2021-05-17 22:02:37 | [diff] [blame] | 732 | void SetCaptureHandleConfig( |
| 733 | blink::mojom::CaptureHandleConfigPtr config) override; |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 734 | ui::AXMode GetAccessibilityMode() override; |
James Wallace-Lee | eafc94cb9 | 2018-07-23 21:35:09 | [diff] [blame] | 735 | // Broadcasts the mode change to all frames. |
Greg Thompson | f855bf88 | 2024-01-30 10:39:45 | [diff] [blame] | 736 | void ResetAccessibility() override; |
Mario Sanchez Prada | 5d7f1ac | 2020-07-16 17:18:40 | [diff] [blame] | 737 | void AXTreeIDForMainFrameHasChanged() override; |
David Tseng | 63bbdea | 2024-05-30 17:40:34 | [diff] [blame] | 738 | void ProcessAccessibilityUpdatesAndEvents( |
| 739 | ui::AXUpdatesAndEvents& details) override; |
dmazzoni | 2400c46 | 2016-08-23 15:07:13 | [diff] [blame] | 740 | void AccessibilityLocationChangesReceived( |
Ahmed Elwasefi | 79a665e | 2024-10-01 18:24:47 | [diff] [blame] | 741 | const ui::AXTreeID& tree_id, |
| 742 | ui::AXLocationAndScrollUpdates& details) override; |
Nektarios Paisios | 8e9da98 | 2024-02-20 23:14:22 | [diff] [blame] | 743 | ui::AXNode* GetAccessibilityRootNode() override; |
Alexander Surkov | 2ab5162 | 2020-09-02 12:01:42 | [diff] [blame] | 744 | std::string DumpAccessibilityTree( |
Abigail Klein | abb42833 | 2019-09-13 18:26:21 | [diff] [blame] | 745 | bool internal, |
Alexander Surkov | 9048288 | 2020-10-12 16:30:38 | [diff] [blame] | 746 | std::vector<ui::AXPropertyFilter> property_filters) override; |
Jacques Newman | e313e14 | 2024-03-13 18:47:22 | [diff] [blame] | 747 | std::string DumpAccessibilityTree( |
| 748 | ui::AXApiType::Type api_type, |
| 749 | std::vector<ui::AXPropertyFilter> property_filters) override; |
Mark Schillaci | ac6c9f7 | 2025-04-02 17:37:34 | [diff] [blame] | 750 | void ApplyAXTreeFixingResult(ui::AXTreeID tree_id, |
| 751 | ui::AXNodeID node_id, |
| 752 | ax::mojom::Role role) override; |
Abigail Klein | bb8304bd | 2020-05-18 21:44:18 | [diff] [blame] | 753 | void RecordAccessibilityEvents( |
| 754 | bool start_recording, |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 755 | std::optional<ui::AXEventCallback> callback) override; |
Jacques Newman | e313e14 | 2024-03-13 18:47:22 | [diff] [blame] | 756 | void RecordAccessibilityEvents( |
| 757 | ui::AXApiType::Type api_type, |
| 758 | bool start_recording, |
| 759 | std::optional<ui::AXEventCallback> callback) override; |
Aaron Leventhal | 6ceb588 | 2024-04-17 15:19:38 | [diff] [blame] | 760 | void UnrecoverableAccessibilityError() override; |
Ke He | 7319dbe | 2017-11-09 05:54:44 | [diff] [blame] | 761 | device::mojom::GeolocationContext* GetGeolocationContext() override; |
ke.he | 98b761e | 2017-05-09 05:59:17 | [diff] [blame] | 762 | device::mojom::WakeLockContext* GetWakeLockContext() override; |
Gyuyoung Kim | 9ce9ddda | 2025-06-19 02:01:14 | [diff] [blame] | 763 | #if BUILDFLAG(IS_ANDROID) || (BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_IOS_TVOS)) |
Dave Tapuska | b0edabb3 | 2025-06-17 17:03:20 | [diff] [blame] | 764 | void GetNFC(RenderFrameHostImpl*, |
Reilly Grant | afbe224 | 2020-02-20 21:14:55 | [diff] [blame] | 765 | mojo::PendingReceiver<device::mojom::NFC>) override; |
blundell | f5316fc | 2017-05-15 11:49:03 | [diff] [blame] | 766 | #endif |
Mike Wasserman | 16f130da | 2024-04-17 23:03:30 | [diff] [blame] | 767 | bool CanEnterFullscreenMode(RenderFrameHostImpl* requesting_frame) override; |
Dave Tapuska | a418951 | 2019-10-15 20:27:34 | [diff] [blame] | 768 | void EnterFullscreenMode( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 769 | RenderFrameHostImpl* requesting_frame, |
Dave Tapuska | a418951 | 2019-10-15 20:27:34 | [diff] [blame] | 770 | const blink::mojom::FullscreenOptions& options) override; |
Muyao Xu | db226be5 | 2023-12-01 04:23:09 | [diff] [blame] | 771 | void ExitFullscreenMode(bool will_cause_resize) override; |
Batalov Vladislav | e9a5f382 | 2020-12-02 07:31:11 | [diff] [blame] | 772 | void FullscreenStateChanged( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 773 | RenderFrameHostImpl* rfh, |
Batalov Vladislav | e9a5f382 | 2020-12-02 07:31:11 | [diff] [blame] | 774 | bool is_fullscreen, |
| 775 | blink::mojom::FullscreenOptionsPtr options) override; |
Jeremy Roman | 608bcab | 2023-11-09 22:29:30 | [diff] [blame] | 776 | bool CanUseWindowingControls(RenderFrameHostImpl* requesting_frame) override; |
Ivan Šandrk | 527711756 | 2023-07-05 14:07:28 | [diff] [blame] | 777 | void Maximize() override; |
Ivan Šandrk | 1b68e6e | 2023-06-29 11:47:22 | [diff] [blame] | 778 | void Minimize() override; |
Ivan Šandrk | bf6b730 | 2023-07-05 15:16:02 | [diff] [blame] | 779 | void Restore() override; |
Michael Thiessen | e566352 | 2022-05-25 21:23:28 | [diff] [blame] | 780 | #if BUILDFLAG(IS_ANDROID) |
| 781 | void UpdateUserGestureCarryoverInfo() override; |
| 782 | #endif |
Avi Drissman | 36f801f | 2018-02-01 20:06:04 | [diff] [blame] | 783 | void DidCallFocus() override; |
ekaramad | a110f64 | 2016-12-21 19:47:28 | [diff] [blame] | 784 | void OnFocusedElementChangedInFrame( |
| 785 | RenderFrameHostImpl* frame, |
Emily Stark | 023dbacc | 2020-08-27 22:31:40 | [diff] [blame] | 786 | const gfx::Rect& bounds_in_root_view, |
| 787 | blink::mojom::FocusType focus_type) override; |
Lucas Furukawa Gadani | abbfa34 | 2017-08-29 19:37:57 | [diff] [blame] | 788 | void OnAdvanceFocus(RenderFrameHostImpl* source_rfh) override; |
Alexander Timin | 9666d50 | 2021-06-19 01:34:50 | [diff] [blame] | 789 | FrameTree* CreateNewWindow( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 790 | RenderFrameHostImpl* opener, |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 791 | const mojom::CreateNewWindowParams& params, |
Albert J. Wong | 65fe64d | 2019-09-20 02:48:14 | [diff] [blame] | 792 | bool is_new_browsing_instance, |
Sergey Kuznetsov | 32257a2 | 2019-02-11 20:26:50 | [diff] [blame] | 793 | bool has_user_gesture, |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 794 | SessionStorageNamespace* session_storage_namespace) override; |
Stefan Zager | 6f6e57c | 2025-03-19 22:03:45 | [diff] [blame] | 795 | WebContents* ShowCreatedWindow( |
| 796 | RenderFrameHostImpl* opener, |
| 797 | int main_frame_widget_route_id, |
| 798 | WindowOpenDisposition disposition, |
| 799 | const blink::mojom::WindowFeatures& window_features, |
| 800 | bool user_gesture) override; |
Sreeja Kamishetty | 4978330 | 2022-01-28 17:52:25 | [diff] [blame] | 801 | void PrimaryMainDocumentElementAvailable() override; |
carlosk | d9d9794 | 2017-02-16 08:58:09 | [diff] [blame] | 802 | void PassiveInsecureContentFound(const GURL& resource_url) override; |
Carlos IL | 29294a6 | 2020-05-15 00:21:16 | [diff] [blame] | 803 | bool ShouldAllowRunningInsecureContent(bool allowed_per_prefs, |
carlosk | d9d9794 | 2017-02-16 08:58:09 | [diff] [blame] | 804 | const url::Origin& origin, |
| 805 | const GURL& resource_url) override; |
Lukasz Anforowicz | e1b954d9 | 2017-10-30 21:28:06 | [diff] [blame] | 806 | void ViewSource(RenderFrameHostImpl* frame) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 807 | void PrintCrossProcessSubframe( |
| 808 | const gfx::Rect& rect, |
| 809 | int document_cookie, |
| 810 | RenderFrameHostImpl* render_frame_host) override; |
ckitagawa | 8695799b | 2020-02-05 16:08:49 | [diff] [blame] | 811 | void CapturePaintPreviewOfCrossProcessSubframe( |
| 812 | const gfx::Rect& rect, |
| 813 | const base::UnguessableToken& guid, |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 814 | RenderFrameHostImpl* render_frame_host) override; |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 815 | #if BUILDFLAG(IS_ANDROID) |
rob.buis | 300b087 | 2017-03-10 20:43:58 | [diff] [blame] | 816 | base::android::ScopedJavaLocalRef<jobject> GetJavaRenderFrameHostDelegate() |
| 817 | override; |
| 818 | #endif |
Jay Civelli | 116683f | 2018-03-27 19:56:23 | [diff] [blame] | 819 | void ResourceLoadComplete( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 820 | RenderFrameHostImpl* render_frame_host, |
Clark DuVall | 36164bd | 2018-08-09 22:49:08 | [diff] [blame] | 821 | const GlobalRequestID& request_id, |
Minggang Wang | ee5af39 | 2020-02-05 02:55:28 | [diff] [blame] | 822 | blink::mojom::ResourceLoadInfoPtr resource_load_information) override; |
Alexander Timin | 1cc31f4 | 2020-05-12 16:26:01 | [diff] [blame] | 823 | void OnCookiesAccessed(RenderFrameHostImpl*, |
| 824 | const CookieAccessDetails& details) override; |
Steven Valdez | a06f680c | 2023-03-21 19:00:10 | [diff] [blame] | 825 | void OnTrustTokensAccessed(RenderFrameHostImpl*, |
| 826 | const TrustTokenAccessDetails& details) override; |
Tsuyoshi Horo | bcd0b9f6 | 2023-06-28 11:35:32 | [diff] [blame] | 827 | void OnSharedDictionaryAccessed( |
| 828 | RenderFrameHostImpl*, |
| 829 | const network::mojom::SharedDictionaryAccessDetails& details) override; |
Daniel Rubery | 6420d7430 | 2024-11-19 01:42:40 | [diff] [blame] | 830 | void OnDeviceBoundSessionAccessed( |
| 831 | RenderFrameHostImpl* render_frame_host, |
Daniel Rubery | 7cdfa53 | 2025-01-24 16:57:50 | [diff] [blame] | 832 | const net::device_bound_sessions::SessionAccess& access) override; |
Joanne de Abreu | 7cdb086 | 2024-05-03 21:12:42 | [diff] [blame] | 833 | void NotifyStorageAccessed(RenderFrameHostImpl*, |
| 834 | blink::mojom::StorageTypeAccessed storage_type, |
| 835 | bool blocked) override; |
Seung Jae Lim | c16c5e1 | 2024-05-10 23:30:00 | [diff] [blame] | 836 | void OnVibrate(RenderFrameHostImpl*) override; |
| 837 | |
Sandor Major | 878f835 | 2025-02-18 20:16:02 | [diff] [blame] | 838 | std::optional<network::ParsedPermissionsPolicy> |
Robbie McElrath | 34dab00 | 2024-02-23 20:12:35 | [diff] [blame] | 839 | GetPermissionsPolicyForIsolatedWebApp(RenderFrameHostImpl* source) override; |
Raymond Toy | e413650c | 2018-08-31 00:12:47 | [diff] [blame] | 840 | |
| 841 | // Called when WebAudio starts or stops playing audible audio in an |
| 842 | // AudioContext. |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 843 | void AudioContextPlaybackStarted(RenderFrameHostImpl* host, |
Raymond Toy | e413650c | 2018-08-31 00:12:47 | [diff] [blame] | 844 | int context_id) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 845 | void AudioContextPlaybackStopped(RenderFrameHostImpl* host, |
Raymond Toy | e413650c | 2018-08-31 00:12:47 | [diff] [blame] | 846 | int context_id) override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 847 | void OnFrameAudioStateChanged(RenderFrameHostImpl* host, |
Chris Hamilton | 16ca64a | 2020-05-14 23:13:17 | [diff] [blame] | 848 | bool is_audible) override; |
Patrick Monette | bade734 | 2024-09-09 14:07:10 | [diff] [blame] | 849 | void OnRemoteSubframeViewportIntersectionStateChanged( |
| 850 | RenderFrameHostImpl* host, |
| 851 | const blink::mojom::ViewportIntersectionState& |
| 852 | viewport_intersection_state) override; |
Patrick Monette | 214fab67 | 2023-10-29 03:56:06 | [diff] [blame] | 853 | void OnFrameVisibilityChanged( |
| 854 | RenderFrameHostImpl* host, |
| 855 | blink::mojom::FrameVisibility visibility) override; |
Patrick Monette | 6f1fc91 | 2023-11-21 22:10:18 | [diff] [blame] | 856 | void OnFrameIsCapturingMediaStreamChanged( |
Patrick Monette | 031229b | 2023-11-02 17:21:18 | [diff] [blame] | 857 | RenderFrameHostImpl* host, |
Patrick Monette | 6f1fc91 | 2023-11-21 22:10:18 | [diff] [blame] | 858 | bool is_capturing_media_stream) override; |
Kevin McNee | 5f59438 | 2021-05-06 23:18:23 | [diff] [blame] | 859 | std::vector<FrameTreeNode*> GetUnattachedOwnedNodes( |
| 860 | RenderFrameHostImpl* owner) override; |
Dave Tapuska | f9fc312 | 2019-10-18 19:42:55 | [diff] [blame] | 861 | void RegisterProtocolHandler(RenderFrameHostImpl* source, |
| 862 | const std::string& protocol, |
| 863 | const GURL& url, |
Dave Tapuska | f9fc312 | 2019-10-18 19:42:55 | [diff] [blame] | 864 | bool user_gesture) override; |
| 865 | void UnregisterProtocolHandler(RenderFrameHostImpl* source, |
| 866 | const std::string& protocol, |
| 867 | const GURL& url, |
| 868 | bool user_gesture) override; |
Kristi Saney | 9632a65 | 2025-05-30 19:44:02 | [diff] [blame] | 869 | [[nodiscard]] base::ScopedClosureRunner MarkAudible() override; |
Carlos Caballero | ede6f8c | 2021-01-28 11:01:50 | [diff] [blame] | 870 | bool IsAllowedToGoToEntryAtOffset(int32_t offset) override; |
Dominique Fauteux-Chapleau | 4407a85d | 2024-01-05 13:18:58 | [diff] [blame] | 871 | void IsClipboardPasteAllowedByPolicy( |
| 872 | const ClipboardEndpoint& source, |
| 873 | const ClipboardEndpoint& destination, |
Xu Li | 383fced | 2025-08-12 16:14:01 | [diff] [blame] | 874 | const ui::ClipboardMetadata& metadata, |
Nancy Xiao | 4f3eae5d6 | 2023-04-25 19:38:59 | [diff] [blame] | 875 | ClipboardPasteData clipboard_paste_data, |
Dominique Fauteux-Chapleau | 4407a85d | 2024-01-05 13:18:58 | [diff] [blame] | 876 | IsClipboardPasteAllowedCallback callback) override; |
siashah | 1cac9c5 | 2024-07-09 23:50:36 | [diff] [blame] | 877 | void OnTextCopiedToClipboard(RenderFrameHostImpl* render_frame_host, |
| 878 | const std::u16string& copied_text) override; |
Dominique Fauteux-Chapleau | 4407a85d | 2024-01-05 13:18:58 | [diff] [blame] | 879 | void IsClipboardPasteAllowedWrapperCallback( |
| 880 | IsClipboardPasteAllowedCallback callback, |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 881 | std::optional<ClipboardPasteData> clipboard_paste_data); |
Haihan Chen | 715e675 | 2025-06-18 19:30:25 | [diff] [blame] | 882 | std::optional<std::vector<std::u16string>> GetClipboardTypesIfPolicyApplied( |
| 883 | const ui::ClipboardSequenceNumberToken& seqno) override; |
Kevin McNee | 3183a779 | 2021-11-09 21:03:36 | [diff] [blame] | 884 | void OnPageScaleFactorChanged(PageImpl& source) override; |
Robert Sesek | 5047c41 | 2021-08-09 17:36:18 | [diff] [blame] | 885 | void BindScreenOrientation( |
| 886 | RenderFrameHost* rfh, |
| 887 | mojo::PendingAssociatedReceiver<device::mojom::ScreenOrientation> |
| 888 | receiver) override; |
Mike Wasserman | c22b7744 | 2024-01-02 19:10:18 | [diff] [blame] | 889 | bool IsTransientActivationRequiredForHtmlFullscreen() override; |
Dave Tapuska | dfff738 | 2021-04-23 19:46:41 | [diff] [blame] | 890 | bool IsBackForwardCacheSupported() override; |
Dave Tapuska | 42f9b90 | 2020-10-23 21:57:06 | [diff] [blame] | 891 | RenderWidgetHostImpl* CreateNewPopupWidget( |
Dave Tapuska | 80fb7252 | 2022-03-18 21:34:23 | [diff] [blame] | 892 | base::SafeRef<SiteInstanceGroup> site_instance_group, |
Dave Tapuska | 04ccda06 | 2020-10-21 21:58:12 | [diff] [blame] | 893 | int32_t route_id, |
| 894 | mojo::PendingAssociatedReceiver<blink::mojom::PopupWidgetHost> |
| 895 | blink_popup_widget_host, |
| 896 | mojo::PendingAssociatedReceiver<blink::mojom::WidgetHost> |
| 897 | blink_widget_host, |
| 898 | mojo::PendingAssociatedRemote<blink::mojom::Widget> blink_widget) |
| 899 | override; |
Gyuyoung Kim | 1905f7c | 2020-05-02 00:00:24 | [diff] [blame] | 900 | void DidLoadResourceFromMemoryCache( |
| 901 | RenderFrameHostImpl* source, |
| 902 | const GURL& url, |
| 903 | const std::string& http_request, |
| 904 | const std::string& mime_type, |
Arthur Sonzogni | 54013f2 | 2021-09-03 14:57:12 | [diff] [blame] | 905 | network::mojom::RequestDestination request_destination, |
| 906 | bool include_credentials) override; |
Ewelina Baran | ed2df8ad | 2021-12-22 10:05:37 | [diff] [blame] | 907 | void DomOperationResponse(RenderFrameHost* render_frame_host, |
| 908 | const std::string& json_string) override; |
Gyuyoung Kim | 4c5051784 | 2020-06-04 17:50:44 | [diff] [blame] | 909 | void SavableResourceLinksResponse( |
| 910 | RenderFrameHostImpl* source, |
| 911 | const std::vector<GURL>& resources_list, |
| 912 | blink::mojom::ReferrerPtr referrer, |
| 913 | const std::vector<blink::mojom::SavableSubframePtr>& subframes) override; |
| 914 | void SavableResourceLinksError(RenderFrameHostImpl* source) override; |
Sreeja Kamishetty | be0ccd6b | 2020-06-09 11:52:50 | [diff] [blame] | 915 | void RenderFrameHostStateChanged( |
Sreeja Kamishetty | 2771b7d | 2021-04-07 06:34:18 | [diff] [blame] | 916 | RenderFrameHost* render_frame_host, |
| 917 | RenderFrameHost::LifecycleState old_state, |
| 918 | RenderFrameHost::LifecycleState new_state) override; |
Dave Tapuska | 3f201fa | 2020-10-28 14:17:10 | [diff] [blame] | 919 | void SetWindowRect(const gfx::Rect& new_bounds) override; |
Kevin McNee | 5604b1c4 | 2025-01-09 22:30:40 | [diff] [blame] | 920 | void UpdateWindowPreferredSize(RenderFrameHostImpl* render_frame_host, |
| 921 | const gfx::Size& pref_size) override; |
Camille Lamy | 8766bd3e | 2020-11-26 11:36:32 | [diff] [blame] | 922 | std::vector<RenderFrameHostImpl*> |
| 923 | GetActiveTopLevelDocumentsInBrowsingContextGroup( |
| 924 | RenderFrameHostImpl* render_frame_host) override; |
Hiroki Nakagawa | 1cb1455 | 2021-04-23 03:37:34 | [diff] [blame] | 925 | PrerenderHostRegistry* GetPrerenderHostRegistry() override; |
Dave Tapuska | 5f966bb7 | 2024-11-25 22:39:48 | [diff] [blame] | 926 | void DidChangeLoadProgressForMainFrame( |
| 927 | RenderFrameHostImpl* render_frame_host) override; |
Hyowon Kim | 5310a2c | 2022-11-15 03:07:15 | [diff] [blame] | 928 | void DidFailLoadWithError(RenderFrameHostImpl* render_frame_host, |
| 929 | const GURL& url, |
| 930 | int error_code) override; |
Amanda Baker | f48f04b | 2024-03-26 18:12:33 | [diff] [blame] | 931 | void DraggableRegionsChanged( |
| 932 | const std::vector<blink::mojom::DraggableRegionPtr>& regions) override; |
Rakina Zata Amni | 2620dcb | 2024-11-13 01:41:58 | [diff] [blame] | 933 | void OnFirstContentfulPaintInPrimaryMainFrame() override; |
Benjamin Beaudry | fed497b | 2025-02-21 05:45:17 | [diff] [blame] | 934 | gfx::NativeWindow GetOwnerNativeWindow() override; |
Sreeja Kamishetty | be0ccd6b | 2020-06-09 11:52:50 | [diff] [blame] | 935 | |
Benjamin Keen | fdd1a3cb | 2025-04-07 20:53:58 | [diff] [blame] | 936 | media::PictureInPictureEventsInfo::AutoPipInfo GetAutoPipInfo() |
Benjamin Keen | 919ed0f | 2025-02-25 15:47:20 | [diff] [blame] | 937 | const override; |
Ming-Ying Chung | 16d0447 | 2025-04-17 22:14:39 | [diff] [blame] | 938 | void OnKeepAliveRequestCreated( |
| 939 | const network::ResourceRequest& resource_request, |
| 940 | RenderFrameHostImpl* initiator_rfh) override; |
Benjamin Keen | 919ed0f | 2025-02-25 15:47:20 | [diff] [blame] | 941 | |
Ming-Ying Chung | 16d0447 | 2025-04-17 22:14:39 | [diff] [blame] | 942 | // RenderViewHostDelegate |
| 943 | // ---------------------------------------------------- |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 944 | RenderViewHostDelegateView* GetDelegateView() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 945 | void RenderViewReady(RenderViewHost* render_view_host) override; |
| 946 | void RenderViewTerminated(RenderViewHost* render_view_host, |
| 947 | base::TerminationStatus status, |
| 948 | int error_code) override; |
| 949 | void RenderViewDeleted(RenderViewHost* render_view_host) override; |
Ian Barkley-Yeung | 07d8a26 | 2020-11-19 22:45:35 | [diff] [blame] | 950 | bool DidAddMessageToConsole( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 951 | RenderFrameHostImpl* source_frame, |
Ian Barkley-Yeung | 07d8a26 | 2020-11-19 22:45:35 | [diff] [blame] | 952 | blink::mojom::ConsoleMessageLevel log_level, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 953 | const std::u16string& message, |
Ian Barkley-Yeung | 07d8a26 | 2020-11-19 22:45:35 | [diff] [blame] | 954 | int32_t line_no, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 955 | const std::u16string& source_id, |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 956 | const std::optional<std::u16string>& untrusted_stack_trace) override; |
Kevin McNee | 7705fe8 | 2024-11-07 18:56:31 | [diff] [blame] | 957 | const blink::RendererPreferences& GetRendererPrefs( |
| 958 | RenderViewHostImpl* render_view_host) override; |
Dave Tapuska | 183b8d70 | 2025-01-07 18:47:18 | [diff] [blame] | 959 | const blink::web_pref::WebPreferences& GetOrCreateWebPreferences( |
| 960 | RenderViewHostImpl* render_view_host) override; |
Daniel Cheng | 90196c8 | 2018-04-25 21:49:14 | [diff] [blame] | 961 | void DidReceiveInputEvent(RenderWidgetHostImpl* render_widget_host, |
Emily Stark | c7bd40c4 | 2020-07-21 19:12:55 | [diff] [blame] | 962 | const blink::WebInputEvent& event) override; |
Takashi Toyoshima | d72a465a | 2024-03-11 23:37:31 | [diff] [blame] | 963 | bool ShouldIgnoreWebInputEvents(const blink::WebInputEvent& event) override; |
Avi Drissman | 738ea19 | 2018-08-29 20:24:16 | [diff] [blame] | 964 | bool ShouldIgnoreInputEvents() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 965 | void OnIgnoredUIEvent() override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 966 | void Activate() override; |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 967 | void ShowCreatedWidget(int process_id, |
Albert J. Wong | f6e13ed | 2018-09-18 15:25:47 | [diff] [blame] | 968 | int widget_route_id, |
Maksim Sisov | 113ea34 | 2021-08-26 16:19:31 | [diff] [blame] | 969 | const gfx::Rect& initial_rect, |
| 970 | const gfx::Rect& initial_anchor_rect) override; |
Mario Sanchez Prada | f68d9827 | 2020-12-09 18:47:52 | [diff] [blame] | 971 | void CreateMediaPlayerHostForRenderFrameHost( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 972 | RenderFrameHostImpl* frame_host, |
Miyoung Shin | 040d834 | 2021-02-23 15:12:31 | [diff] [blame] | 973 | mojo::PendingAssociatedReceiver<media::mojom::MediaPlayerHost> receiver) |
| 974 | override; |
Dave Tapuska | ddcf18f | 2025-01-13 19:39:36 | [diff] [blame] | 975 | void RequestMediaAccessPermission(RenderFrameHostImpl* render_frame_host, |
| 976 | const MediaStreamRequest& request, |
Mark Pilgrim | 5749908 | 2018-06-12 12:38:30 | [diff] [blame] | 977 | MediaResponseCallback callback) override; |
Olha Sirikova | a6c4d52 | 2024-11-08 18:12:50 | [diff] [blame] | 978 | |
| 979 | void ProcessSelectAudioOutput(const SelectAudioOutputRequest& request, |
| 980 | SelectAudioOutputCallback callback) override; |
| 981 | |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 982 | bool CheckMediaAccessPermission(RenderFrameHostImpl* render_frame_host, |
Raymes Khoury | ad7c24a1 | 2018-03-05 23:22:58 | [diff] [blame] | 983 | const url::Origin& security_origin, |
Antonio Gomes | c8b734b | 2019-06-05 18:22:16 | [diff] [blame] | 984 | blink::mojom::MediaStreamType type) override; |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 985 | bool IsJavaScriptDialogShowing() const override; |
avi | c031d39 | 2017-03-03 03:09:42 | [diff] [blame] | 986 | bool ShouldIgnoreUnresponsiveRenderer() override; |
Charlie Reis | 3d18960 | 2021-04-27 21:24:47 | [diff] [blame] | 987 | bool IsGuest() override; |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 988 | std::optional<SkColor> GetBaseBackgroundColor() override; |
Taiyo Mizuhashi | 15ba3bc | 2025-01-28 04:20:31 | [diff] [blame] | 989 | std::unique_ptr<PrefetchHandle> StartPrefetch( |
| 990 | const GURL& prefetch_url, |
| 991 | bool use_prefetch_proxy, |
Taiyo Mizuhashi | 49959d0 | 2025-04-22 16:07:54 | [diff] [blame] | 992 | const std::string& embedder_histogram_suffix, |
Taiyo Mizuhashi | 15ba3bc | 2025-01-28 04:20:31 | [diff] [blame] | 993 | const blink::mojom::Referrer& referrer, |
| 994 | const std::optional<url::Origin>& referring_origin, |
kenoss | 8a1493b | 2025-03-10 08:16:06 | [diff] [blame] | 995 | std::optional<net::HttpNoVarySearchData> no_vary_search_hint, |
Taiyo Mizuhashi | d7c85699 | 2025-06-23 08:56:02 | [diff] [blame] | 996 | std::optional<PrefetchPriority> priority, |
kenoss | a1af66f1 | 2025-03-07 06:10:55 | [diff] [blame] | 997 | scoped_refptr<PreloadPipelineInfo> preload_pipeline_info, |
Taiyo Mizuhashi | 15ba3bc | 2025-01-28 04:20:31 | [diff] [blame] | 998 | base::WeakPtr<PreloadingAttempt> attempt, |
kenoss | 6938554c | 2025-06-10 10:18:17 | [diff] [blame] | 999 | std::optional<PreloadingHoldbackStatus> holdback_status_override, |
| 1000 | std::optional<base::TimeDelta> ttl) override; |
Robert Lin | c37fb58 | 2021-11-11 03:18:47 | [diff] [blame] | 1001 | std::unique_ptr<PrerenderHandle> StartPrerendering( |
Asami Doi | cf0f164 | 2021-11-25 05:00:26 | [diff] [blame] | 1002 | const GURL& prerendering_url, |
Kouhei Ueno | 3f37992b | 2023-11-09 23:29:02 | [diff] [blame] | 1003 | PreloadingTriggerType trigger_type, |
Robert Lin | 125720c04 | 2022-01-21 01:14:58 | [diff] [blame] | 1004 | const std::string& embedder_histogram_suffix, |
Hiroki Nakagawa | 8348bc4 | 2024-12-13 16:24:42 | [diff] [blame] | 1005 | net::HttpRequestHeaders additional_headers, |
Rulong Chen(陈汝龙) | bf12169c | 2024-12-16 05:38:16 | [diff] [blame] | 1006 | std::optional<net::HttpNoVarySearchData> no_vary_search_hint, |
Lingqi Chi | 21d9feb | 2022-02-02 09:42:18 | [diff] [blame] | 1007 | ui::PageTransition page_transition, |
Taiyo Mizuhashi | bc91f80 | 2024-06-20 19:37:22 | [diff] [blame] | 1008 | bool should_warm_up_compositor, |
Lingqi Chi | a2efa8c | 2024-11-08 10:20:29 | [diff] [blame] | 1009 | bool should_prepare_paint_tree, |
Domenic Denicola | bb5d843c | 2023-07-18 01:47:33 | [diff] [blame] | 1010 | PreloadingHoldbackStatus holdback_status_override, |
kenoss | 8e8e411 | 2025-03-07 07:33:33 | [diff] [blame] | 1011 | scoped_refptr<PreloadPipelineInfo> preload_pipeline_info, |
Sreeja Kamishetty | ac12140e | 2022-07-14 22:16:51 | [diff] [blame] | 1012 | PreloadingAttempt* preloading_attempt, |
Liviu Tinta | cf066d5 | 2024-07-24 16:00:55 | [diff] [blame] | 1013 | base::RepeatingCallback<bool(const GURL&, |
| 1014 | const std::optional<UrlMatchType>&)>, |
Jiacheng Guo | ea20d39 | 2025-07-07 01:08:14 | [diff] [blame] | 1015 | base::RepeatingCallback<void(NavigationHandle&)>, |
| 1016 | bool allow_reuse) override; |
Hiroki Nakagawa | 2db55b3 | 2024-05-09 08:41:27 | [diff] [blame] | 1017 | void CancelAllPrerendering() override; |
Hiroki Nakagawa | 68ba6ed9 | 2025-01-29 03:39:27 | [diff] [blame] | 1018 | bool IsAllowedToStartPrerendering() override; |
Kevin McNee | 097680d | 2023-04-05 22:14:51 | [diff] [blame] | 1019 | void BackNavigationLikely(PreloadingPredictor predictor, |
| 1020 | WindowOpenDisposition disposition) override; |
Bo Liu | d4ced69 | 2023-09-18 21:17:14 | [diff] [blame] | 1021 | void SetOwnerLocationForDebug( |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 1022 | std::optional<base::Location> owner_location) override; |
Sam Davis Omekara (from Dev Box) | 26b9199 | 2023-11-07 20:07:46 | [diff] [blame] | 1023 | blink::ColorProviderColorMaps GetColorProviderColorMaps() const override; |
Rakina Zata Amni | 347b7090 | 2020-07-22 10:49:04 | [diff] [blame] | 1024 | |
Joanne de Abreu | 7cbed87 | 2023-10-30 23:25:26 | [diff] [blame] | 1025 | network::mojom::AttributionSupport GetAttributionSupport() override; |
| 1026 | void UpdateAttributionSupportRenderer() override; |
| 1027 | static void UpdateAttributionSupportAllRenderers(); |
William Liu | 6cf58fe | 2024-01-19 21:29:32 | [diff] [blame] | 1028 | BackForwardTransitionAnimationManager* |
| 1029 | GetBackForwardTransitionAnimationManager() override; |
Xiao Ma | 29b2d1e6 | 2024-06-13 06:17:09 | [diff] [blame] | 1030 | net::handles::NetworkHandle GetTargetNetwork() override; |
Joanne de Abreu | 7cbed87 | 2023-10-30 23:25:26 | [diff] [blame] | 1031 | |
Bryant Chandler | 490c6de | 2024-01-02 22:08:36 | [diff] [blame] | 1032 | void GetMediaCaptureRawDeviceIdsOpened( |
| 1033 | blink::mojom::MediaStreamType type, |
| 1034 | base::OnceCallback<void(std::vector<std::string>)> callback) override; |
| 1035 | |
[email protected] | 5291380 | 2013-12-10 05:52:18 | [diff] [blame] | 1036 | // NavigatorDelegate --------------------------------------------------------- |
| 1037 | |
clamy | 0e11988 | 2015-07-31 16:12:33 | [diff] [blame] | 1038 | void DidStartNavigation(NavigationHandle* navigation_handle) override; |
| 1039 | void DidRedirectNavigation(NavigationHandle* navigation_handle) override; |
clamy | efca29e | 2015-09-17 00:22:11 | [diff] [blame] | 1040 | void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override; |
clamy | 0e11988 | 2015-07-31 16:12:33 | [diff] [blame] | 1041 | void DidFinishNavigation(NavigationHandle* navigation_handle) override; |
William Liu | c6cc30ec | 2024-03-14 16:54:16 | [diff] [blame] | 1042 | void DidCancelNavigationBeforeStart( |
| 1043 | NavigationHandle* navigation_handle) override; |
William Liu | b26568da | 2024-02-21 20:46:14 | [diff] [blame] | 1044 | void DidNavigateMainFramePreCommit(NavigationHandle* navigation_handle, |
Liviu Tinta | 23558196 | 2021-07-14 20:37:07 | [diff] [blame] | 1045 | bool navigation_is_within_page) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1046 | void DidNavigateMainFramePostCommit( |
sky | 8b00392d | 2015-01-10 00:30:28 | [diff] [blame] | 1047 | RenderFrameHostImpl* render_frame_host, |
Rakina Zata Amni | ff10975d | 2021-10-08 06:04:24 | [diff] [blame] | 1048 | const LoadCommittedDetails& details) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1049 | void DidNavigateAnyFramePostCommit( |
[email protected] | 37567b43 | 2014-02-12 01:12:22 | [diff] [blame] | 1050 | RenderFrameHostImpl* render_frame_host, |
Rakina Zata Amni | ff10975d | 2021-10-08 06:04:24 | [diff] [blame] | 1051 | const LoadCommittedDetails& details) override; |
Rakina Zata Amni | 742c202 | 2024-07-02 05:29:17 | [diff] [blame] | 1052 | void DidUpdateNavigationHandleTiming( |
| 1053 | NavigationHandle* navigation_handle) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1054 | void NotifyChangedNavigationState(InvalidateTypes changed_flags) override; |
Alexander Timin | a0ef6df | 2021-06-24 13:34:46 | [diff] [blame] | 1055 | bool ShouldAllowRendererInitiatedCrossProcessNavigation( |
Ian Vollick | 1c6dd3e | 2022-04-13 02:06:26 | [diff] [blame] | 1056 | bool is_outermost_main_frame_navigation) override; |
Dave Tapuska | 94a6978a | 2024-11-22 14:37:29 | [diff] [blame] | 1057 | const blink::UserAgentOverride& GetUserAgentOverride( |
| 1058 | FrameTree& frame_tree) override; |
Takashi Toyoshima | 2a7f8cc0 | 2025-05-07 07:58:46 | [diff] [blame] | 1059 | void CreateThrottlesForNavigation( |
Takashi Toyoshima | be55153 | 2025-05-02 18:13:52 | [diff] [blame] | 1060 | NavigationThrottleRegistry& registry) override; |
David Bokan | 1bdb3701f | 2021-04-30 22:02:35 | [diff] [blame] | 1061 | std::vector<std::unique_ptr<CommitDeferringCondition>> |
| 1062 | CreateDeferringConditionsForNavigationCommit( |
David Bokan | 51a6df83 | 2022-02-17 18:31:19 | [diff] [blame] | 1063 | NavigationHandle& navigation_handle, |
| 1064 | CommitDeferringCondition::NavigationType type) override; |
clamy | 1e5574e9 | 2016-09-29 16:48:44 | [diff] [blame] | 1065 | std::unique_ptr<NavigationUIData> GetNavigationUIData( |
| 1066 | NavigationHandle* navigation_handle) override; |
Alexander Timin | 17edc74 | 2020-04-23 18:22:18 | [diff] [blame] | 1067 | void OnServiceWorkerAccessed(NavigationHandle* navigation, |
| 1068 | const GURL& scope, |
| 1069 | AllowServiceWorkerResult allowed) override; |
Alexander Timin | 1cc31f4 | 2020-05-12 16:26:01 | [diff] [blame] | 1070 | void OnCookiesAccessed(NavigationHandle*, |
| 1071 | const CookieAccessDetails& details) override; |
Steven Valdez | a06f680c | 2023-03-21 19:00:10 | [diff] [blame] | 1072 | void OnTrustTokensAccessed(NavigationHandle*, |
| 1073 | const TrustTokenAccessDetails& details) override; |
Daniel Rubery | 6420d7430 | 2024-11-19 01:42:40 | [diff] [blame] | 1074 | void OnDeviceBoundSessionAccessed( |
| 1075 | NavigationHandle* navigation_handle, |
Daniel Rubery | 7cdfa53 | 2025-01-24 16:57:50 | [diff] [blame] | 1076 | const net::device_bound_sessions::SessionAccess& access) override; |
Tsuyoshi Horo | bcd0b9f6 | 2023-06-28 11:35:32 | [diff] [blame] | 1077 | void OnSharedDictionaryAccessed( |
| 1078 | NavigationHandle*, |
| 1079 | const network::mojom::SharedDictionaryAccessDetails& details) override; |
W. James MacLean | c07dc41b | 2022-07-25 18:52:16 | [diff] [blame] | 1080 | void RegisterExistingOriginAsHavingDefaultIsolation( |
W. James MacLean | b70fab8 | 2020-05-01 18:51:14 | [diff] [blame] | 1081 | const url::Origin& origin, |
| 1082 | NavigationRequest* navigation_request_to_exclude) override; |
Lijin Shen | e4511c1 | 2024-03-19 19:31:30 | [diff] [blame] | 1083 | bool MaybeCopyContentAreaAsBitmap( |
| 1084 | base::OnceCallback<void(const SkBitmap&)> callback) override; |
Aldo Culquicondor | da38be1 | 2025-01-13 16:16:23 | [diff] [blame] | 1085 | bool SupportsForwardTransitionAnimation() override; |
[email protected] | 5291380 | 2013-12-10 05:52:18 | [diff] [blame] | 1086 | |
Aldo Culquicondor | 88fe396 | 2025-01-21 16:04:26 | [diff] [blame] | 1087 | #if BUILDFLAG(IS_ANDROID) |
| 1088 | void SetSupportsForwardTransitionAnimation(bool supports); |
| 1089 | #endif |
| 1090 | |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 1091 | // RenderWidgetHostDelegate -------------------------------------------------- |
| 1092 | |
Ahmed Fakhry | faa32d2 | 2018-10-05 15:56:16 | [diff] [blame] | 1093 | void SetTopControlsShownRatio(RenderWidgetHostImpl* render_widget_host, |
| 1094 | float ratio) override; |
Ahmed Fakhry | 58e6ef54 | 2018-09-04 18:05:38 | [diff] [blame] | 1095 | void SetTopControlsGestureScrollInProgress(bool in_progress) override; |
lazyboy | 63f5b31 | 2015-11-23 20:19:52 | [diff] [blame] | 1096 | void RenderWidgetCreated(RenderWidgetHostImpl* render_widget_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1097 | void RenderWidgetDeleted(RenderWidgetHostImpl* render_widget_host) override; |
rouslan | 2f5993f | 2015-01-29 00:18:31 | [diff] [blame] | 1098 | void RenderWidgetWasResized(RenderWidgetHostImpl* render_widget_host, |
| 1099 | bool width_changed) override; |
Fady Samuel | 9794711 | 2018-05-05 16:24:54 | [diff] [blame] | 1100 | void ResizeDueToAutoResize(RenderWidgetHostImpl* render_widget_host, |
| 1101 | const gfx::Size& new_size) override; |
David Black | 9cca359 | 2019-11-06 23:02:22 | [diff] [blame] | 1102 | void OnVerticalScrollDirectionChanged( |
| 1103 | viz::VerticalScrollDirection scroll_direction) override; |
David Bokan | 7ec5ac92 | 2022-11-29 03:31:31 | [diff] [blame] | 1104 | int GetVirtualKeyboardResizeHeight() override; |
Anupam Snigdha | 915824a | 2024-03-05 17:55:30 | [diff] [blame] | 1105 | bool ShouldDoLearning() override; |
akaba | c6bd121 | 2018-06-25 20:10:48 | [diff] [blame] | 1106 | |
W. James MacLean | 37af605e | 2025-01-20 16:59:38 | [diff] [blame] | 1107 | double GetPendingZoomLevel(RenderWidgetHostImpl* rwh) override; |
akaba | c6bd121 | 2018-06-25 20:10:48 | [diff] [blame] | 1108 | |
Emily Shack | 38136975 | 2025-02-19 20:49:19 | [diff] [blame] | 1109 | bool PreHandleMouseEvent(const blink::WebMouseEvent& event) override; |
Kaan Alsan | d44437c | 2025-05-08 21:46:26 | [diff] [blame] | 1110 | void PreHandleDragUpdate(const DropData& drop_data, |
| 1111 | const gfx::PointF& client_pt); |
Kaan Alsan | 570addb | 2025-05-09 18:30:32 | [diff] [blame] | 1112 | void PreHandleDragExit(); |
sky | f65d9bb | 2017-03-24 02:26:39 | [diff] [blame] | 1113 | KeyboardEventProcessingResult PreHandleKeyboardEvent( |
Kartar Singh | 5c8e0b2 | 2024-05-30 10:32:14 | [diff] [blame] | 1114 | const input::NativeWebKeyboardEvent& event) override; |
Dave Tapuska | 344399e | 2019-09-09 15:18:26 | [diff] [blame] | 1115 | bool HandleMouseEvent(const blink::WebMouseEvent& event) override; |
Kartar Singh | 5c8e0b2 | 2024-05-30 10:32:14 | [diff] [blame] | 1116 | bool HandleKeyboardEvent(const input::NativeWebKeyboardEvent& event) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1117 | bool HandleWheelEvent(const blink::WebMouseWheelEvent& event) override; |
| 1118 | bool PreHandleGestureEvent(const blink::WebGestureEvent& event) override; |
Jacques Newman | 6f230d78 | 2024-08-26 19:13:34 | [diff] [blame] | 1119 | ui::BrowserAccessibilityManager* GetRootBrowserAccessibilityManager() |
| 1120 | override; |
| 1121 | ui::BrowserAccessibilityManager* GetOrCreateRootBrowserAccessibilityManager() |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 1122 | override; |
lgarron | 145aaa8 | 2015-07-10 07:39:56 | [diff] [blame] | 1123 | // The following 4 functions are already listed under WebContents overrides: |
mohsen | 7ab1ec16ec | 2015-07-02 18:26:23 | [diff] [blame] | 1124 | // void Cut() override; |
| 1125 | // void Copy() override; |
| 1126 | // void Paste() override; |
lgarron | 145aaa8 | 2015-07-10 07:39:56 | [diff] [blame] | 1127 | // void SelectAll() override; |
Dave Tapuska | b336b92 | 2017-07-06 19:24:05 | [diff] [blame] | 1128 | void ExecuteEditCommand(const std::string& command, |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 1129 | const std::optional<std::u16string>& value) override; |
mohsen | 7ab1ec16ec | 2015-07-02 18:26:23 | [diff] [blame] | 1130 | void MoveRangeSelectionExtent(const gfx::Point& extent) override; |
| 1131 | void SelectRange(const gfx::Point& base, const gfx::Point& extent) override; |
Michelle | bb18e2d | 2023-02-22 04:52:22 | [diff] [blame] | 1132 | void SelectAroundCaret(blink::mojom::SelectionGranularity granularity, |
| 1133 | bool should_show_handle, |
| 1134 | bool should_show_context_menu) override; |
Dave Tapuska | b336b92 | 2017-07-06 19:24:05 | [diff] [blame] | 1135 | void MoveCaret(const gfx::Point& extent) override; |
Aman Verma | 7908f956 | 2024-12-13 18:45:48 | [diff] [blame] | 1136 | base::UnguessableToken GetCompositorFrameSinkGroupingId() const override; |
Shimi Zhang | 37deeb2 | 2017-09-28 00:59:01 | [diff] [blame] | 1137 | void AdjustSelectionByCharacterOffset(int start_adjust, |
| 1138 | int end_adjust, |
| 1139 | bool show_selection_menu) override; |
Kartar Singh | b1bfa1a | 2024-06-24 13:14:57 | [diff] [blame] | 1140 | input::RenderWidgetHostInputEventRouter* GetInputEventRouter() override; |
Aman Verma | b3ed74e | 2024-04-29 13:58:13 | [diff] [blame] | 1141 | void GetRenderWidgetHostAtPointAsynchronously( |
| 1142 | RenderWidgetHostViewBase* root_view, |
| 1143 | const gfx::PointF& point, |
| 1144 | base::OnceCallback<void(base::WeakPtr<RenderWidgetHostViewBase>, |
| 1145 | std::optional<gfx::PointF>)> callback) override; |
alexmos | c4cbacb | 2015-11-21 01:29:22 | [diff] [blame] | 1146 | RenderWidgetHostImpl* GetFocusedRenderWidgetHost( |
| 1147 | RenderWidgetHostImpl* receiving_widget) override; |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1148 | RenderWidgetHostImpl* GetRenderWidgetHostWithPageFocus() override; |
| 1149 | void FocusOwningWebContents( |
| 1150 | RenderWidgetHostImpl* render_widget_host) override; |
Lukasz Anforowicz | 52b9372 | 2018-06-20 16:11:39 | [diff] [blame] | 1151 | void RendererUnresponsive( |
| 1152 | RenderWidgetHostImpl* render_widget_host, |
| 1153 | base::RepeatingClosure hang_monitor_restarter) override; |
avi | c3aa842 | 2015-11-09 20:57:22 | [diff] [blame] | 1154 | void RendererResponsive(RenderWidgetHostImpl* render_widget_host) override; |
Takumi Fujimoto | 4661871d | 2024-01-25 02:04:18 | [diff] [blame] | 1155 | void RequestToLockPointer(RenderWidgetHostImpl* render_widget_host, |
| 1156 | bool user_gesture, |
Dave Tapuska | 291304d3 | 2025-06-27 15:21:09 | [diff] [blame] | 1157 | bool last_unlocked_by_target) override; |
Anantanarayanan G Iyengar | 21c80ce | 2024-10-07 16:39:56 | [diff] [blame] | 1158 | bool IsWaitingForPointerLockPrompt( |
| 1159 | RenderWidgetHostImpl* render_widget_host) override; |
Joe Downing | 13dd76b | 2018-04-09 18:32:15 | [diff] [blame] | 1160 | bool RequestKeyboardLock(RenderWidgetHostImpl* render_widget_host, |
| 1161 | bool esc_key_locked) override; |
Joe Downing | 192998b2 | 2018-03-22 15:51:36 | [diff] [blame] | 1162 | void CancelKeyboardLock(RenderWidgetHostImpl* render_widget_host) override; |
| 1163 | RenderWidgetHostImpl* GetKeyboardLockWidget() override; |
avi | 0720b02e | 2017-06-13 03:22:13 | [diff] [blame] | 1164 | // The following function is already listed under WebContents overrides: |
Avi Drissman | 97aef04 | 2020-06-30 21:04:48 | [diff] [blame] | 1165 | // bool IsFullscreen() const override; |
danakj | 45d4245 | 2020-04-08 17:24:18 | [diff] [blame] | 1166 | blink::mojom::DisplayMode GetDisplayMode() const override; |
Md Hasibul Hasan | 2fe709feb | 2024-09-12 15:39:56 | [diff] [blame] | 1167 | ui::mojom::WindowShowState GetWindowShowState() override; |
Alexis Menard | 634234d | 2024-05-10 14:27:33 | [diff] [blame] | 1168 | blink::mojom::DevicePostureProvider* GetDevicePostureProvider() override; |
Sonja | 1e9d6bc1 | 2023-09-19 11:19:30 | [diff] [blame] | 1169 | bool GetResizable() override; |
Takumi Fujimoto | 4661871d | 2024-01-25 02:04:18 | [diff] [blame] | 1170 | void LostPointerLock(RenderWidgetHostImpl* render_widget_host) override; |
| 1171 | bool HasPointerLock(RenderWidgetHostImpl* render_widget_host) override; |
| 1172 | RenderWidgetHostImpl* GetPointerLockWidget() override; |
Dave Tapuska | e1c6295 | 2021-11-02 23:14:06 | [diff] [blame] | 1173 | bool OnRenderFrameProxyVisibilityChanged( |
| 1174 | RenderFrameProxyHost* render_frame_proxy_host, |
Dave Tapuska | c334436 | 2019-02-20 17:54:28 | [diff] [blame] | 1175 | blink::mojom::FrameVisibility visibility) override; |
lfg | bb9c28a | 2016-03-01 03:19:49 | [diff] [blame] | 1176 | void SendScreenRects() override; |
Dave Tapuska | 3450d0b | 2022-04-08 21:27:53 | [diff] [blame] | 1177 | void SendActiveState(bool active) override; |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 1178 | TextInputManager* GetTextInputManager() override; |
Dave Tapuska | 1d72e33 | 2021-10-13 19:24:38 | [diff] [blame] | 1179 | bool IsWidgetForPrimaryMainFrame( |
| 1180 | RenderWidgetHostImpl* render_widget_host) override; |
ekaramad | f6750aa | 2017-06-06 18:29:42 | [diff] [blame] | 1181 | bool IsShowingContextMenuOnPage() const override; |
Klaus Weidner | d32baf4 | 2020-02-21 04:10:55 | [diff] [blame] | 1182 | void DidChangeScreenOrientation() override; |
Mike Jackson | f116a2e | 2021-06-09 16:48:30 | [diff] [blame] | 1183 | gfx::Rect GetWindowsControlsOverlayRect() const override; |
Joe Mason | 4dc51d4 | 2022-12-17 00:00:14 | [diff] [blame] | 1184 | VisibleTimeRequestTrigger& GetVisibleTimeRequestTrigger() final; |
Aman Verma | bb589a3 | 2024-05-07 16:38:17 | [diff] [blame] | 1185 | gfx::mojom::DelegatedInkPointRenderer* GetDelegatedInkRenderer( |
| 1186 | ui::Compositor* compositor) override; |
Baran Erfani | de163bd | 2024-08-26 22:26:27 | [diff] [blame] | 1187 | void OnInputIgnored(const blink::WebInputEvent& event) override; |
Kartar Singh | 48fb0a7 | 2025-03-21 15:52:22 | [diff] [blame] | 1188 | #if BUILDFLAG(IS_ANDROID) |
| 1189 | float GetCurrentTouchSequenceYOffset() override; |
| 1190 | #endif |
[email protected] | 4ca76c0 | 2012-05-16 16:19:05 | [diff] [blame] | 1191 | |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 1192 | // RenderFrameHostManager::Delegate ------------------------------------------ |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 1193 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1194 | bool CreateRenderViewForRenderManager( |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 1195 | RenderViewHost* render_view_host, |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 1196 | const std::optional<blink::FrameToken>& opener_frame_token, |
Alex Moshchuk | d0d759c2 | 2025-05-09 18:18:35 | [diff] [blame] | 1197 | RenderFrameProxyHost* proxy_host, |
| 1198 | const std::optional<base::UnguessableToken>& navigation_metrics_token) |
| 1199 | override; |
Fergal Daly | 6de62f5 | 2020-10-14 01:56:44 | [diff] [blame] | 1200 | void ReattachOuterDelegateIfNeeded() override; |
lfg | bede639 | 2015-09-11 21:54:06 | [diff] [blame] | 1201 | void CreateRenderWidgetHostViewForRenderManager( |
| 1202 | RenderViewHost* render_view_host) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1203 | void BeforeUnloadFiredFromRenderManager( |
| 1204 | bool proceed, |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 1205 | bool* proceed_to_fire_unload) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1206 | void CancelModalDialogsForRenderManager() override; |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 1207 | void NotifySwappedFromRenderManager(RenderFrameHostImpl* old_frame, |
Dave Tapuska | e45d6fd | 2021-09-29 17:03:59 | [diff] [blame] | 1208 | RenderFrameHostImpl* new_frame) override; |
Jonathan Ross | 61ec6534 | 2021-12-14 23:01:40 | [diff] [blame] | 1209 | void NotifySwappedFromRenderManagerWithoutFallbackContent( |
| 1210 | RenderFrameHostImpl* new_frame) override; |
nasko | f5940b9f | 2015-03-02 23:04:05 | [diff] [blame] | 1211 | void NotifyMainFrameSwappedFromRenderManager( |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 1212 | RenderFrameHostImpl* old_frame, |
| 1213 | RenderFrameHostImpl* new_frame) override; |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1214 | bool FocusLocationBarByDefault() override; |
Carlos Caballero | 6ff6ace | 2021-02-05 16:53:00 | [diff] [blame] | 1215 | void OnFrameTreeNodeDestroyed(FrameTreeNode* node) override; |
[email protected] | 0bfbf88 | 2011-12-22 18:19:27 | [diff] [blame] | 1216 | |
Jeremy Roman | 2d8dfe13 | 2021-07-06 20:51:26 | [diff] [blame] | 1217 | // PageDelegate ------------------------------------------------------------- |
| 1218 | |
| 1219 | void OnFirstVisuallyNonEmptyPaint(PageImpl& page) override; |
| 1220 | |
| 1221 | // These both check that the color has in fact changed before notifying |
| 1222 | // observers. |
| 1223 | void OnThemeColorChanged(PageImpl& page) override; |
| 1224 | void OnBackgroundColorChanged(PageImpl& page) override; |
Michael Bai | 19f17a30 | 2021-12-08 04:08:33 | [diff] [blame] | 1225 | void DidInferColorScheme(PageImpl& page) override; |
David Bokan | d6e44055b | 2022-09-21 03:58:08 | [diff] [blame] | 1226 | void OnVirtualKeyboardModeChanged(PageImpl& page) override; |
Julie Jeongeun Kim | d4597df1 | 2022-11-11 02:44:51 | [diff] [blame] | 1227 | void NotifyPageBecamePrimary(PageImpl& page) override; |
Jeremy Roman | 2d8dfe13 | 2021-07-06 20:51:26 | [diff] [blame] | 1228 | |
Takashi Toyoshima | 8dfc05c | 2024-01-29 21:03:51 | [diff] [blame] | 1229 | bool IsPageInPreviewMode() const override; |
Takashi Toyoshima | a35e5fc | 2023-10-20 04:00:34 | [diff] [blame] | 1230 | void CancelPreviewByMojoBinderPolicy( |
| 1231 | const std::string& interface_name) override; |
Robert Ferens | 9610d728 | 2025-02-17 09:52:32 | [diff] [blame] | 1232 | void OnWebApiWindowResizableChanged() override; |
Takashi Toyoshima | 1b73e31 | 2023-10-17 04:53:35 | [diff] [blame] | 1233 | |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 1234 | // blink::mojom::ColorChooserFactory --------------------------------------- |
Miyoung Shin | cb6475a | 2019-11-09 10:49:45 | [diff] [blame] | 1235 | void OnColorChooserFactoryReceiver( |
Julie Jeongeun Kim | 8e2879e | 2019-08-06 23:55:20 | [diff] [blame] | 1236 | mojo::PendingReceiver<blink::mojom::ColorChooserFactory> receiver); |
Tom Burgin | f0e4862 | 2024-05-16 15:06:12 | [diff] [blame] | 1237 | #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 1238 | void OpenColorChooser( |
Julie Jeongeun Kim | 8e2879e | 2019-08-06 23:55:20 | [diff] [blame] | 1239 | mojo::PendingReceiver<blink::mojom::ColorChooser> chooser, |
| 1240 | mojo::PendingRemote<blink::mojom::ColorChooserClient> client, |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 1241 | SkColor color, |
Joel Hockey | 163835a | 2017-12-20 11:51:57 | [diff] [blame] | 1242 | std::vector<blink::mojom::ColorSuggestionPtr> suggestions) override; |
Julie Jeongeun Kim | 88ce9ec | 2023-07-28 02:25:40 | [diff] [blame] | 1243 | #endif |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 1244 | |
Carlos Caballero | 0326252 | 2021-02-05 14:49:58 | [diff] [blame] | 1245 | // FrameTree::Delegate ------------------------------------------------------- |
| 1246 | |
Nate Chapin | 470dbc6 | 2023-04-25 16:34:38 | [diff] [blame] | 1247 | void LoadingStateChanged(LoadingState new_state) override; |
| 1248 | void DidStartLoading(FrameTreeNode* frame_tree_node) override; |
Carlos Caballero | 0326252 | 2021-02-05 14:49:58 | [diff] [blame] | 1249 | void DidStopLoading() override; |
Tsuyoshi Horo | cd82846 | 2021-04-21 04:59:58 | [diff] [blame] | 1250 | bool IsHidden() override; |
Avi Drissman | bd15364 | 2024-09-03 18:58:05 | [diff] [blame] | 1251 | FrameTreeNodeId GetOuterDelegateFrameTreeNodeId() override; |
Kevin McNee | 86e64ee | 2023-02-17 16:35:50 | [diff] [blame] | 1252 | RenderFrameHostImpl* GetProspectiveOuterDocument() override; |
Sreeja Kamishetty | d64b993d | 2022-02-14 12:04:42 | [diff] [blame] | 1253 | FrameTree* LoadingTree() override; |
Julie Jeongeun Kim | 2132b37f8 | 2022-11-23 08:30:46 | [diff] [blame] | 1254 | void SetFocusedFrame(FrameTreeNode* node, SiteInstanceGroup* source) override; |
Tommy Steimel | 71f15446 | 2024-05-22 19:05:07 | [diff] [blame] | 1255 | FrameTree* GetOwnedPictureInPictureFrameTree() override; |
| 1256 | FrameTree* GetPictureInPictureOpenerFrameTree() override; |
Carlos Caballero | 0326252 | 2021-02-05 14:49:58 | [diff] [blame] | 1257 | |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 1258 | // NavigationControllerDelegate ---------------------------------------------- |
| 1259 | |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1260 | void NotifyNavigationEntryCommitted( |
anand.ratn | 120b0b00 | 2014-10-07 15:49:32 | [diff] [blame] | 1261 | const LoadCommittedDetails& load_details) override; |
Sam McNally | 5c087a3 | 2017-08-25 01:46:14 | [diff] [blame] | 1262 | void NotifyNavigationEntryChanged( |
| 1263 | const EntryChangedDetails& change_details) override; |
| 1264 | void NotifyNavigationListPruned(const PrunedDetails& pruned_details) override; |
Christian Dullweber | 1af31e6 | 2018-02-22 11:49:48 | [diff] [blame] | 1265 | void NotifyNavigationEntriesDeleted() override; |
arthursonzogni | 66f711c | 2019-10-08 14:40:36 | [diff] [blame] | 1266 | bool ShouldPreserveAbortedURLs() override; |
Abhijeet Kandalkar | 3dc6e60 | 2022-11-09 05:08:37 | [diff] [blame] | 1267 | void NotifyNavigationStateChangedFromController( |
| 1268 | InvalidateTypes changed_flags) override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 1269 | |
Aman Verma | 3047aa41 | 2024-05-28 09:09:24 | [diff] [blame] | 1270 | // RenderWidgetHostInputEventRouter::Delegate ------------------------------- |
Kartar Singh | b1bfa1a | 2024-06-24 13:14:57 | [diff] [blame] | 1271 | input::TouchEmulator* GetTouchEmulator(bool create_if_necessary) override; |
Aman Verma | 3047aa41 | 2024-05-28 09:09:24 | [diff] [blame] | 1272 | |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 1273 | // Invoked before a form repost warning is shown. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1274 | void NotifyBeforeFormRepostWarningShow() override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 1275 | |
| 1276 | // Activate this WebContents and show a form repost warning. |
dcheng | c2282aa | 2014-10-21 12:07:58 | [diff] [blame] | 1277 | void ActivateAndShowRepostFormWarningDialog() override; |
[email protected] | ec6c05f | 2013-10-23 18:41:57 | [diff] [blame] | 1278 | |
Mounir Lamouri | 0f5bdf5 | 2019-04-04 16:32:35 | [diff] [blame] | 1279 | void MediaMutedStatusChanged(const MediaPlayerId& id, bool muted); |
Becca Hughes | 9f6fd4b8 | 2017-06-15 10:01:40 | [diff] [blame] | 1280 | |
aelias | 5252baa | 2016-04-10 01:18:02 | [diff] [blame] | 1281 | void UpdateOverridingUserAgent() override; |
| 1282 | |
[email protected] | 34ff1cfc | 2014-08-20 06:16:05 | [diff] [blame] | 1283 | // Forces overscroll to be disabled (used by touch emulation). |
| 1284 | void SetForceDisableOverscrollContent(bool force_disable); |
| 1285 | |
Jianzhou Feng | d8720c7 | 2018-01-18 03:06:30 | [diff] [blame] | 1286 | // Override the render view/widget size of the main frame, return whether the |
| 1287 | // size changed. |
| 1288 | bool SetDeviceEmulationSize(const gfx::Size& new_size); |
| 1289 | void ClearDeviceEmulationSize(); |
| 1290 | |
rajendrant | 4c28846 | 2020-10-13 07:35:35 | [diff] [blame] | 1291 | AudioStreamMonitor* audio_stream_monitor() { return &audio_stream_monitor_; } |
dalecurtis | bc6572e1 | 2014-09-12 19:22:30 | [diff] [blame] | 1292 | |
Max Morin | 5bc74f5 | 2018-05-09 07:00:21 | [diff] [blame] | 1293 | ForwardingAudioStreamFactory* GetAudioStreamFactory(); |
| 1294 | |
Dave Tapuska | 894bfb4 | 2024-11-04 22:44:35 | [diff] [blame] | 1295 | // Creates a new ForwardingAudioStreamFactory. This can only be used by |
| 1296 | // GuestPageHolders, if you are looking for the audio stream factory you |
| 1297 | // likely want to use GetAudioStreamFactory(); |
| 1298 | std::unique_ptr<ForwardingAudioStreamFactory> CreateAudioStreamFactory( |
| 1299 | base::PassKey<GuestPageHolderImpl> pass_key); |
| 1300 | |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 1301 | // Called by MediaWebContentsObserver when playback starts or stops. See the |
| 1302 | // WebContentsObserver function stubs for more details. |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 1303 | void MediaStartedPlaying( |
| 1304 | const WebContentsObserver::MediaPlayerInfo& media_info, |
Mounir Lamouri | 0f5bdf5 | 2019-04-04 16:32:35 | [diff] [blame] | 1305 | const MediaPlayerId& id); |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 1306 | void MediaStoppedPlaying( |
| 1307 | const WebContentsObserver::MediaPlayerInfo& media_info, |
Mounir Lamouri | 0f5bdf5 | 2019-04-04 16:32:35 | [diff] [blame] | 1308 | const MediaPlayerId& id, |
Becca Hughes | 220bfc10 | 2017-11-14 18:24:07 | [diff] [blame] | 1309 | WebContentsObserver::MediaStoppedReason reason); |
Wojciech Dzierżanowski | 71c3e4c | 2025-04-29 09:54:08 | [diff] [blame] | 1310 | |
| 1311 | // Called when the set of tracks changes. |
| 1312 | void MediaMetadataChanged( |
| 1313 | const WebContentsObserver::MediaPlayerInfo& media_info, |
| 1314 | const MediaPlayerId& id); |
| 1315 | |
peconn | 25795152 | 2017-06-09 18:24:59 | [diff] [blame] | 1316 | // This will be called before playback is started, check |
| 1317 | // GetCurrentlyPlayingVideoCount if you need this when playback starts. |
Mounir Lamouri | 0f5bdf5 | 2019-04-04 16:32:35 | [diff] [blame] | 1318 | void MediaResized(const gfx::Size& size, const MediaPlayerId& id); |
Peter E Conn | eccb34c2 | 2017-09-08 09:37:58 | [diff] [blame] | 1319 | void MediaEffectivelyFullscreenChanged(bool is_fullscreen); |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 1320 | |
Michael Crouse | e75c7a4 | 2020-07-31 21:11:55 | [diff] [blame] | 1321 | // Called by MediaWebContentsObserver when a buffer underflow occurs. See the |
| 1322 | // WebContentsObserver function stubs for more details. |
| 1323 | void MediaBufferUnderflow(const MediaPlayerId& id); |
| 1324 | |
rajendrant | 4c28846 | 2020-10-13 07:35:35 | [diff] [blame] | 1325 | // Called by MediaWebContentsObserver when player seek event occurs. |
| 1326 | void MediaPlayerSeek(const MediaPlayerId& id); |
| 1327 | |
Chris Hamilton | c347e10 | 2020-11-18 23:10:21 | [diff] [blame] | 1328 | // Called by MediaWebContentsObserver when a media player is destroyed. |
| 1329 | void MediaDestroyed(const MediaPlayerId& id); |
| 1330 | |
Tommy Steimel | e95348e | 2024-01-09 21:15:33 | [diff] [blame] | 1331 | // Called by MediaSessionImpl when one is created and initialized for this. |
| 1332 | void MediaSessionCreated(MediaSession* media_session); |
| 1333 | |
Wojciech Dzierżanowski | 71c3e4c | 2025-04-29 09:54:08 | [diff] [blame] | 1334 | int GetCurrentlyPlayingVideoCount() const override; |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 1335 | std::optional<gfx::Size> GetFullscreenVideoSize() override; |
dalecurtis | bc6572e1 | 2014-09-12 19:22:30 | [diff] [blame] | 1336 | |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 1337 | MediaWebContentsObserver* media_web_contents_observer() { |
| 1338 | return media_web_contents_observer_.get(); |
| 1339 | } |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 1340 | |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 1341 | // Update the web contents visibility. |
Sreeja Kamishetty | 1c1ca7a | 2023-05-12 16:36:40 | [diff] [blame] | 1342 | void UpdateWebContentsVisibility(Visibility visibility) override; |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 1343 | |
Tsuyoshi Horo | cd82846 | 2021-04-21 04:59:58 | [diff] [blame] | 1344 | // Returns the PageVisibilityState for the primary page of this web contents, |
| 1345 | // taking the capturing state into account. |
| 1346 | PageVisibilityState GetPageVisibilityState() const; |
| 1347 | |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 1348 | // Called by FindRequestManager when find replies come in from a renderer |
| 1349 | // process. |
| 1350 | void NotifyFindReply(int request_id, |
| 1351 | int number_of_matches, |
| 1352 | const gfx::Rect& selection_rect, |
| 1353 | int active_match_ordinal, |
| 1354 | bool final_update); |
| 1355 | |
ortuno | 467e579 | 2016-06-10 04:32:39 | [diff] [blame] | 1356 | // Modify the counter of connected devices for this WebContents. |
| 1357 | void IncrementBluetoothConnectedDeviceCount(); |
| 1358 | void DecrementBluetoothConnectedDeviceCount(); |
| 1359 | |
Ovidio Henriquez | 76696f6 | 2020-07-08 03:06:59 | [diff] [blame] | 1360 | void IncrementBluetoothScanningSessionsCount(); |
| 1361 | void DecrementBluetoothScanningSessionsCount(); |
| 1362 | |
Reilly Grant | 5e7c79b2 | 2019-04-09 17:26:20 | [diff] [blame] | 1363 | // Modify the counter of frames in this WebContents actively using serial |
| 1364 | // ports. |
| 1365 | void IncrementSerialActiveFrameCount(); |
| 1366 | void DecrementSerialActiveFrameCount(); |
| 1367 | |
Matt Reynolds | e8c6c1f | 2019-11-02 09:53:53 | [diff] [blame] | 1368 | // Modify the counter of frames in this WebContents actively using HID |
| 1369 | // devices. |
| 1370 | void IncrementHidActiveFrameCount(); |
| 1371 | void DecrementHidActiveFrameCount(); |
| 1372 | |
Yifan Luo | 8e5d3d5 | 2024-10-22 19:18:16 | [diff] [blame] | 1373 | // Modify the counter of frames in this WebContents actively using |
| 1374 | // geolocation. |
| 1375 | void IncrementGeolocationActiveFrameCount(); |
| 1376 | void DecrementGeolocationActiveFrameCount(); |
| 1377 | |
François Doray | e753bf90 | 2024-09-17 15:03:08 | [diff] [blame] | 1378 | // Notifies the delegate and observers when device connection types used by |
| 1379 | // the WebContents change. |
Patrick Monette | 15442a1 | 2025-01-22 20:09:31 | [diff] [blame] | 1380 | void OnCapabilityTypesChanged( |
| 1381 | WebContentsCapabilityType device_capability_type, |
| 1382 | bool used); |
Matt Reynolds | ed00ca7e7 | 2022-08-18 20:56:20 | [diff] [blame] | 1383 | |
| 1384 | // Modify the counter of frames in this WebContents actively using USB |
| 1385 | // devices. |
| 1386 | void IncrementUsbActiveFrameCount(); |
| 1387 | void DecrementUsbActiveFrameCount(); |
| 1388 | |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 1389 | // Modify the counter of File System Access handles for this WebContents. |
| 1390 | void IncrementFileSystemAccessHandleCount(); |
| 1391 | void DecrementFileSystemAccessHandleCount(); |
Marijn Kruisselbrink | 2905104 | 2019-08-06 22:56:55 | [diff] [blame] | 1392 | |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 1393 | // Called when the WebContents gains or loses a persistent video. |
zqzhang | 8ac4900 | 2017-03-16 21:51:35 | [diff] [blame] | 1394 | void SetHasPersistentVideo(bool has_persistent_video); |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 1395 | |
François Beaufort | ad6c523 | 2018-02-26 11:00:44 | [diff] [blame] | 1396 | // Whether the WebContents effectively fullscreen active player allows |
| 1397 | // Picture-in-Picture. |
| 1398 | // |IsFullscreen| must return |true| when this method is called. |
| 1399 | bool IsPictureInPictureAllowedForFullscreenVideo() const; |
| 1400 | |
Carlos Caballero | b65b6e3a | 2021-11-15 10:09:00 | [diff] [blame] | 1401 | // Set this WebContents's `primary_frame_tree_` as the focused frame tree. |
| 1402 | // `primary_frame_tree_`'s main frame RenderWidget (and all of its |
Dave Tapuska | 54c76a03 | 2021-10-27 22:10:42 | [diff] [blame] | 1403 | // subframe widgets) will be activated. GetFocusedRenderWidgetHost will search |
| 1404 | // this WebContentsImpl for a focused RenderWidgetHost. The previously focused |
| 1405 | // WebContentsImpl, if any, will have its RenderWidgetHosts deactivated. |
lfg | 1453e41 | 2017-04-11 00:48:50 | [diff] [blame] | 1406 | void SetAsFocusedWebContentsIfNecessary(); |
| 1407 | |
Dave Tapuska | 54c76a03 | 2021-10-27 22:10:42 | [diff] [blame] | 1408 | // Sets the focused frame tree to be the `frame_tree_to_focus`. |
| 1409 | // `frame_tree_to_focus` must be either this WebContents's frame tree or |
| 1410 | // contained within it (but not owned by another WebContents). |
| 1411 | void SetFocusedFrameTree(FrameTree* frame_tree_to_focus); |
| 1412 | |
Klaus Weidner | d821943 | 2022-02-08 21:50:59 | [diff] [blame] | 1413 | // Notifies the Picture-in-Picture controller that there is a new video player |
| 1414 | // entering video Picture-in-Picture. (This is not used for document |
| 1415 | // Picture-in-Picture, |
| 1416 | // cf. PictureInPictureWindowManager::EnterDocumentPictureInPicture().) |
Becca Hughes | 112832e | 2019-06-11 17:19:02 | [diff] [blame] | 1417 | // Returns the result of the enter request. |
François Beaufort | 1388f289 | 2022-01-29 08:22:47 | [diff] [blame] | 1418 | PictureInPictureResult EnterPictureInPicture(); |
Mounir Lamouri | 11e9ef43 | 2018-05-22 03:10:16 | [diff] [blame] | 1419 | |
Mounir Lamouri | 6d759e1 | 2018-05-16 20:01:30 | [diff] [blame] | 1420 | // Updates the Picture-in-Picture controller with a signal that |
| 1421 | // Picture-in-Picture mode has ended. |
| 1422 | void ExitPictureInPicture(); |
| 1423 | |
sawtelle | a7333a8 | 2018-05-31 02:36:36 | [diff] [blame] | 1424 | // Updates the tracking information for |this| to know if there is |
| 1425 | // a video currently in Picture-in-Picture mode. |
| 1426 | void SetHasPictureInPictureVideo(bool has_picture_in_picture_video); |
| 1427 | |
Klaus Weidner | d821943 | 2022-02-08 21:50:59 | [diff] [blame] | 1428 | // Updates the tracking information for |this| to know if there is |
| 1429 | // a document currently in Picture-in-Picture mode. |
| 1430 | void SetHasPictureInPictureDocument(bool has_picture_in_picture_document); |
| 1431 | |
Ian Vollick | 5d5c37f | 2019-06-19 22:50:57 | [diff] [blame] | 1432 | // Sets the spatial navigation state. |
| 1433 | void SetSpatialNavigationDisabled(bool disabled); |
| 1434 | |
Yaroslav Shalivskyy | d76a81f4 | 2024-10-21 20:08:20 | [diff] [blame] | 1435 | #if BUILDFLAG(IS_ANDROID) |
Mahesh Machavolu | 6cb8018 | 2022-07-22 08:09:31 | [diff] [blame] | 1436 | // Sets the Stylus handwriting feature status. This status is updated to web |
| 1437 | // preferences. |
| 1438 | void SetStylusHandwritingEnabled(bool enabled); |
Yaroslav Shalivskyy | d76a81f4 | 2024-10-21 20:08:20 | [diff] [blame] | 1439 | #endif // BUILDFLAG(IS_ANDROID) |
Mahesh Machavolu | 6cb8018 | 2022-07-22 08:09:31 | [diff] [blame] | 1440 | |
Avi Drissman | bd3e98644 | 2020-05-20 21:09:20 | [diff] [blame] | 1441 | // Called when a file selection is to be done. |
| 1442 | void RunFileChooser( |
Bo Liu | 3afe258 | 2023-08-11 23:02:56 | [diff] [blame] | 1443 | base::WeakPtr<FileChooserImpl> file_chooser, |
Avi Drissman | bd3e98644 | 2020-05-20 21:09:20 | [diff] [blame] | 1444 | RenderFrameHost* render_frame_host, |
Kent Tamura | 3abb32d | 2020-07-02 00:23:01 | [diff] [blame] | 1445 | scoped_refptr<FileChooserImpl::FileSelectListenerImpl> listener, |
Avi Drissman | bd3e98644 | 2020-05-20 21:09:20 | [diff] [blame] | 1446 | const blink::mojom::FileChooserParams& params); |
| 1447 | |
| 1448 | // Request to enumerate a directory. This is equivalent to running the file |
| 1449 | // chooser in directory-enumeration mode and having the user select the given |
| 1450 | // directory. |
| 1451 | void EnumerateDirectory( |
Bo Liu | 3afe258 | 2023-08-11 23:02:56 | [diff] [blame] | 1452 | base::WeakPtr<FileChooserImpl> file_chooser, |
Avi Drissman | bd3e98644 | 2020-05-20 21:09:20 | [diff] [blame] | 1453 | RenderFrameHost* render_frame_host, |
Kent Tamura | 3abb32d | 2020-07-02 00:23:01 | [diff] [blame] | 1454 | scoped_refptr<FileChooserImpl::FileSelectListenerImpl> listener, |
Avi Drissman | bd3e98644 | 2020-05-20 21:09:20 | [diff] [blame] | 1455 | const base::FilePath& directory_path); |
| 1456 | |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 1457 | #if BUILDFLAG(IS_ANDROID) |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 1458 | // Called by FindRequestManager when all of the find match rects are in. |
| 1459 | void NotifyFindMatchRectsReply(int version, |
| 1460 | const std::vector<gfx::RectF>& rects, |
| 1461 | const gfx::RectF& active_rect); |
| 1462 | #endif |
| 1463 | |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 1464 | #if BUILDFLAG(IS_ANDROID) |
Becca Hughes | 6daf566 | 2018-06-27 16:50:54 | [diff] [blame] | 1465 | // Called by WebContentsAndroid to send the Display Cutout safe area to |
| 1466 | // DisplayCutoutHostImpl. |
| 1467 | void SetDisplayCutoutSafeArea(gfx::Insets insets); |
Mason Freed | 098db03 | 2025-05-06 11:52:11 | [diff] [blame] | 1468 | // Called by WebContentsAndroid to instruct the web contents to "show |
| 1469 | // interest" in the referenced element. |
| 1470 | void ShowInterestInElement(int nodeID); |
Becca Hughes | 6daf566 | 2018-06-27 16:50:54 | [diff] [blame] | 1471 | #endif |
| 1472 | |
Becca Hughes | d11d650 | 2018-07-31 17:01:28 | [diff] [blame] | 1473 | // Notify observers that the viewport fit value changed. This is called by |
Wenyu Fu | 29b3bb7 | 2024-12-27 17:48:04 | [diff] [blame] | 1474 | // |SafeAreaInsetsHost|. |
Becca Hughes | d11d650 | 2018-07-31 17:01:28 | [diff] [blame] | 1475 | void NotifyViewportFitChanged(blink::mojom::ViewportFit value); |
Wenyu Fu | 29b3bb7 | 2024-12-27 17:48:04 | [diff] [blame] | 1476 | // Notify observers that safe area constraint has changed. This is called by |
| 1477 | // |SafeAreaInsetsHost|. |
| 1478 | void NotifySafeAreaConstraintChanged(bool has_constraint); |
Becca Hughes | d11d650 | 2018-07-31 17:01:28 | [diff] [blame] | 1479 | |
Ehsan Karamad | 6beb2ea | 2018-11-25 18:15:13 | [diff] [blame] | 1480 | // Returns the current FindRequestManager associated with the WebContents; |
| 1481 | // this won't create one if none exists. |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 1482 | FindRequestManager* GetFindRequestManagerForTesting(); |
Ehsan Karamad | 6beb2ea | 2018-11-25 18:15:13 | [diff] [blame] | 1483 | |
Kevin McNee | 8576c40 | 2020-09-10 21:58:57 | [diff] [blame] | 1484 | // Convenience method to notify observers that an inner WebContents was |
| 1485 | // created with |this| WebContents as its owner. This does *not* immediately |
| 1486 | // guarantee that |inner_web_contents| has been added to the WebContents tree. |
| 1487 | void InnerWebContentsCreated(WebContents* inner_web_contents); |
| 1488 | |
Lucas Furukawa Gadani | 9912582 | 2019-01-03 15:41:49 | [diff] [blame] | 1489 | // Reattaches this inner WebContents to its outer WebContents. |
Adithya Srinivasan | 5bc3b71 | 2020-05-21 13:07:57 | [diff] [blame] | 1490 | virtual void ReattachToOuterWebContentsFrame(); |
Lucas Furukawa Gadani | 9912582 | 2019-01-03 15:41:49 | [diff] [blame] | 1491 | |
Takashi Toyoshima | 138cf44a | 2023-11-02 10:33:25 | [diff] [blame] | 1492 | // Notifies observers that this WebContents completed preview activation |
| 1493 | // steps. |
| 1494 | // `activation_time` is the time the activation happened, in wall time. |
| 1495 | void DidActivatePreviewedPage(base::TimeTicks activation_time); |
| 1496 | |
Alexander Timin | 17edc74 | 2020-04-23 18:22:18 | [diff] [blame] | 1497 | void OnServiceWorkerAccessed(RenderFrameHost* render_frame_host, |
| 1498 | const GURL& scope, |
| 1499 | AllowServiceWorkerResult allowed); |
| 1500 | |
David Bokan | 1bdb3701f | 2021-04-30 22:02:35 | [diff] [blame] | 1501 | bool JavaScriptDialogDefersNavigations() { |
| 1502 | return javascript_dialog_dismiss_notifier_.get(); |
Charlie Reis | 9607736 | 2019-07-04 00:34:04 | [diff] [blame] | 1503 | } |
| 1504 | |
David Bokan | 1bdb3701f | 2021-04-30 22:02:35 | [diff] [blame] | 1505 | void NotifyOnJavaScriptDialogDismiss(base::OnceClosure callback); |
| 1506 | |
John Abd-El-Malek | 74f0b95c | 2021-04-05 06:24:02 | [diff] [blame] | 1507 | bool has_persistent_video() { return has_persistent_video_; } |
| 1508 | |
Dave Tapuska | e782bea | 2019-07-09 16:21:51 | [diff] [blame] | 1509 | // Returns the focused frame's input handler. |
Dave Tapuska | 58a099e | 2020-06-08 21:48:40 | [diff] [blame] | 1510 | blink::mojom::FrameWidgetInputHandler* GetFocusedFrameWidgetInputHandler(); |
Dave Tapuska | e782bea | 2019-07-09 16:21:51 | [diff] [blame] | 1511 | |
Alexander Timin | c7bee32 | 2020-05-19 17:54:34 | [diff] [blame] | 1512 | // A render view-originated drag has ended. Informs the render view host and |
| 1513 | // WebContentsDelegate. |
| 1514 | void SystemDragEnded(RenderWidgetHost* source_rwh); |
| 1515 | |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 1516 | // These are the content internal equivalents of |
Peter Kasting | d2876a2 | 2024-12-03 01:12:55 | [diff] [blame] | 1517 | // `WebContents::ForEachRenderFrameHost` whose comment can be referred to |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 1518 | // for details. Content internals can also access speculative |
| 1519 | // RenderFrameHostImpls if necessary by using the |
Peter Kasting | d2876a2 | 2024-12-03 01:12:55 | [diff] [blame] | 1520 | // `ForEachRenderFrameHostImplIncludingSpeculative` variations. |
| 1521 | void ForEachRenderFrameHostImplWithAction( |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 1522 | base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame); |
Peter Kasting | d2876a2 | 2024-12-03 01:12:55 | [diff] [blame] | 1523 | void ForEachRenderFrameHostImpl( |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 1524 | base::FunctionRef<void(RenderFrameHostImpl*)> on_frame); |
Peter Kasting | d2876a2 | 2024-12-03 01:12:55 | [diff] [blame] | 1525 | void ForEachRenderFrameHostImplIncludingSpeculativeWithAction( |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 1526 | base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame); |
Peter Kasting | d2876a2 | 2024-12-03 01:12:55 | [diff] [blame] | 1527 | void ForEachRenderFrameHostImplIncludingSpeculative( |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 1528 | base::FunctionRef<void(RenderFrameHostImpl*)> on_frame); |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 1529 | |
Rakina Zata Amni | 4029b6d | 2020-07-28 02:36:20 | [diff] [blame] | 1530 | // Computes and returns the content specific preferences for this WebContents. |
| 1531 | // Recomputes only the "fast" preferences (those not requiring slow |
| 1532 | // platform/device polling); the remaining "slow" ones are recomputed only if |
| 1533 | // the preference cache is empty. |
Dave Tapuska | 183b8d70 | 2025-01-07 18:47:18 | [diff] [blame] | 1534 | const blink::web_pref::WebPreferences ComputeWebPreferences( |
| 1535 | RenderFrameHostImpl* main_frame); |
Rakina Zata Amni | 4029b6d | 2020-07-28 02:36:20 | [diff] [blame] | 1536 | |
Alexander Cooper | 987d046cc | 2021-04-14 00:07:21 | [diff] [blame] | 1537 | // Certain WebXr modes integrate with Viz as a compositor directly, and thus |
| 1538 | // have their own FrameSinkId that typically renders fullscreen, obscuring |
| 1539 | // the WebContents. This allows those WebXr modes to notify us if that |
| 1540 | // is occurring. When it has finished, this method may be called again with an |
| 1541 | // Invalid FrameSinkId to indicate such. Note that other fullscreen modes, |
| 1542 | // e.g. Fullscreen videos, are largely controlled by the renderer process and |
| 1543 | // as such are still parented under the existing FrameSinkId. |
| 1544 | void OnXrHasRenderTarget(const viz::FrameSinkId& frame_sink_id); |
| 1545 | |
| 1546 | // Because something else may be rendering as the primary contents of this |
| 1547 | // WebContents rather than the RenderHostView, targets that wish to capture |
Jordan Bayles | cf838785 | 2023-09-13 21:16:35 | [diff] [blame] | 1548 | // the contents of this WebContents should query its capture target here. |
| 1549 | struct CaptureTarget { |
| 1550 | viz::FrameSinkId sink_id; |
| 1551 | gfx::NativeView view; |
| 1552 | }; |
| 1553 | CaptureTarget GetCaptureTarget(); |
Alexander Cooper | 987d046cc | 2021-04-14 00:07:21 | [diff] [blame] | 1554 | |
Sreeja Kamishetty | 0be3b1b | 2021-08-12 17:04:15 | [diff] [blame] | 1555 | // Sets the value in tests to ensure expected ordering and correctness. |
| 1556 | void set_minimum_delay_between_loading_updates_for_testing( |
| 1557 | base::TimeDelta duration) { |
| 1558 | minimum_delay_between_loading_updates_ms_ = duration; |
| 1559 | } |
| 1560 | |
Kevin McNee | ab98c4a5 | 2022-01-28 16:53:06 | [diff] [blame] | 1561 | // If the given frame is prerendered, cancels the associated prerender. |
| 1562 | // Returns true if a prerender was canceled. |
| 1563 | bool CancelPrerendering(FrameTreeNode* frame_tree_node, |
Yoshiki Tanioka | 49b4cfb | 2022-10-20 09:25:31 | [diff] [blame] | 1564 | PrerenderFinalStatus final_status); |
Kevin McNee | ab98c4a5 | 2022-01-28 16:53:06 | [diff] [blame] | 1565 | |
David Bokan | e86aa03 | 2022-05-08 18:21:24 | [diff] [blame] | 1566 | void set_suppress_ime_events_for_testing(bool suppress) { |
| 1567 | suppress_ime_events_for_testing_ = suppress; |
| 1568 | } |
| 1569 | |
Alex Moshchuk | 8380553 | 2022-08-12 15:15:23 | [diff] [blame] | 1570 | RenderWidgetHost* mouse_lock_widget_for_testing() { |
Takumi Fujimoto | 4661871d | 2024-01-25 02:04:18 | [diff] [blame] | 1571 | return pointer_lock_widget_; |
Alex Moshchuk | 8380553 | 2022-08-12 15:15:23 | [diff] [blame] | 1572 | } |
| 1573 | |
David Bokan | d6e44055b | 2022-09-21 03:58:08 | [diff] [blame] | 1574 | ui::mojom::VirtualKeyboardMode GetVirtualKeyboardMode() const; |
| 1575 | |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 1576 | const std::optional<base::Location>& ownership_location() const { |
Bo Liu | d4ced69 | 2023-09-18 21:17:14 | [diff] [blame] | 1577 | return ownership_location_; |
| 1578 | } |
| 1579 | |
Ari Chivukula | 41f7bfc9 | 2024-07-17 18:16:01 | [diff] [blame] | 1580 | bool IsPopup() const override; |
| 1581 | |
Ari Chivukula | 17ba533d | 2024-09-11 22:47:42 | [diff] [blame] | 1582 | bool IsPartitionedPopin() const override; |
| 1583 | |
Ari Chivukula | 2d8d5e0 | 2024-11-04 20:09:57 | [diff] [blame] | 1584 | const struct PartitionedPopinOpenerProperties& |
| 1585 | GetPartitionedPopinOpenerProperties() const override; |
Ari Chivukula | 9390bf1 | 2024-08-14 18:08:01 | [diff] [blame] | 1586 | |
Ari Chivukula | 2d8d5e0 | 2024-11-04 20:09:57 | [diff] [blame] | 1587 | // Returns the opener of this window if this window is a partitioned popin |
| 1588 | // and the opener still exists. This may return null for if the opener was |
| 1589 | // already deleted even if this window is a popin. |
| 1590 | // See https://explainers-by-googlers.github.io/partitioned-popins/ |
| 1591 | RenderFrameHostImpl* GetPartitionedPopinOpener( |
| 1592 | base::PassKey<PartitionedPopinsController>) const; |
| 1593 | |
| 1594 | // Clears `partitioned_popin_opener_` to test what happens if the opener |
| 1595 | // disappears after the popin is opened. |
| 1596 | void ClearPartitionedPopinOpenerForTesting(); |
| 1597 | |
| 1598 | WebContents* GetOpenedPartitionedPopin() const override; |
Ari Chivukula | ee50305 | 2024-08-30 20:33:53 | [diff] [blame] | 1599 | |
Ari Chivukula | f6f09ba | 2025-03-04 20:01:34 | [diff] [blame] | 1600 | // Returns the origin of the popin's opener if this is a partitioned popin. |
| 1601 | // CHECKS if this is not a partitioned popin, as it should never be called |
| 1602 | // in that case. This is used in permissions checks. |
| 1603 | // See https://explainers-by-googlers.github.io/partitioned-popins/ |
| 1604 | GURL GetPartitionedPopinEmbedderOrigin( |
| 1605 | base::PassKey<StorageAccessGrantPermissionContext>) const override; |
| 1606 | |
| 1607 | // Same as GetPartitionedPopinEmbedderOrigin but for testing to bypass |
| 1608 | // PassKey requirements. |
| 1609 | GURL GetPartitionedPopinEmbedderOriginForTesting() const; |
| 1610 | |
lof84 | 501da08 | 2016-05-23 21:22:54 | [diff] [blame] | 1611 | private: |
Dave Tapuska | 894bfb4 | 2024-11-04 22:44:35 | [diff] [blame] | 1612 | using FrameTreeIterationCallback = base::FunctionRef<void(FrameTree&)>; |
Dave Tapuska | 05fcfb6 | 2021-10-18 17:09:03 | [diff] [blame] | 1613 | using RenderViewHostIterationCallback = |
| 1614 | base::RepeatingCallback<void(RenderViewHostImpl*)>; |
Takashi Toyoshima | dc3f747 | 2021-07-21 08:02:32 | [diff] [blame] | 1615 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1616 | friend class WebContentsObserver; |
| 1617 | friend class WebContents; // To implement factory methods. |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1618 | |
Alex Moshchuk | 6fcaca75 | 2018-07-14 02:13:59 | [diff] [blame] | 1619 | friend class RenderFrameHostImplBeforeUnloadBrowserTest; |
Becca Hughes | fd5d8f89 | 2018-06-14 18:23:36 | [diff] [blame] | 1620 | friend class WebContentsImplBrowserTest; |
Sarah Murphy | 3bccae6 | 2022-02-15 20:22:45 | [diff] [blame] | 1621 | friend class TestWebContentsDestructionObserver; |
Arthur Hemery | 2b6bc5a4 | 2019-06-20 09:25:12 | [diff] [blame] | 1622 | friend class BeforeUnloadBlockingDelegate; |
Avi Drissman | 360847d | 2018-11-02 22:46:51 | [diff] [blame] | 1623 | friend class TestWCDelegateForDialogsAndFullscreen; |
Becca Hughes | fd5d8f89 | 2018-06-14 18:23:36 | [diff] [blame] | 1624 | |
Dale Curtis | c496a776 | 2021-02-24 01:15:44 | [diff] [blame] | 1625 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, CaptureHoldsWakeLock); |
[email protected] | 2db9bd7 | 2012-04-13 20:20:56 | [diff] [blame] | 1626 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, NoJSMessageOnInterstitials); |
| 1627 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, UpdateTitle); |
[email protected] | 45a22ad | 2013-02-21 03:25:00 | [diff] [blame] | 1628 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FindOpenerRVHWhenPending); |
[email protected] | 2db9bd7 | 2012-04-13 20:20:56 | [diff] [blame] | 1629 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 1630 | CrossSiteCantPreemptAfterUnload); |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 1631 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsDestroyed); |
| 1632 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, PendingContentsShown); |
[email protected] | 5090445 | 2013-05-09 02:05:12 | [diff] [blame] | 1633 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FrameTreeShape); |
Elad Alon | 0feb660 | 2021-10-14 09:26:36 | [diff] [blame] | 1634 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 1635 | NonActivityCaptureDoesNotCountAsActivity); |
Olivier ROBIN | 4b58dd93 | 2024-08-06 13:30:32 | [diff] [blame] | 1636 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, GetLastActiveTimeTicks); |
estark | a5635c4 | 2015-07-14 00:06:53 | [diff] [blame] | 1637 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 1638 | LoadResourceFromMemoryCacheWithBadSecurityInfo); |
jww | f4684d1 | 2015-09-02 06:12:52 | [diff] [blame] | 1639 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
jam | 91dd24e | 2016-08-12 17:16:42 | [diff] [blame] | 1640 | LoadResourceWithEmptySecurityInfo); |
avi | d53461d | 2016-02-25 17:15:04 | [diff] [blame] | 1641 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, |
| 1642 | ResetJavaScriptDialogOnUserNavigate); |
Megan Jablonski | 2f6a4c5 | 2017-07-10 23:01:25 | [diff] [blame] | 1643 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, ParseDownloadHeaders); |
Mounir Lamouri | 7b4a1f23 | 2019-12-23 16:32:10 | [diff] [blame] | 1644 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FaviconURLsSet); |
| 1645 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FaviconURLsResetWithNavigation); |
| 1646 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplTest, FaviconURLsUpdateDelay); |
Becca Hughes | fd5d8f89 | 2018-06-14 18:23:36 | [diff] [blame] | 1647 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1648 | NotifyFullscreenAcquired); |
| 1649 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1650 | NotifyFullscreenAcquired_Navigate); |
| 1651 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1652 | NotifyFullscreenAcquired_SameOrigin); |
Arthur Sonzogni | 22e314b0 | 2018-08-23 13:55:56 | [diff] [blame] | 1653 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
Batalov Vladislav | e9a5f382 | 2020-12-02 07:31:11 | [diff] [blame] | 1654 | PropagateFullscreenOptions); |
| 1655 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
Nasko Oskov | 0f3cbb1 | 2020-01-07 17:52:14 | [diff] [blame] | 1656 | FullscreenAfterFrameUnload); |
yilkal | 796e89e | 2019-10-02 23:58:28 | [diff] [blame] | 1657 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1658 | MaxFrameCountForCrossProcessNavigation); |
| 1659 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1660 | MaxFrameCountRemovedIframes); |
| 1661 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1662 | MaxFrameCountInjectedIframes); |
Kevin McNee | 53f0b2d | 2021-11-02 18:00:45 | [diff] [blame] | 1663 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1664 | ForEachFrameTreeInnerContents); |
Andrew Comminos | d225665 | 2024-06-21 00:58:37 | [diff] [blame] | 1665 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1666 | UserAgentOverrideDuringDeferredNavigation); |
Xiaochen Zhou | 6443f75 | 2022-08-10 16:40:46 | [diff] [blame] | 1667 | FRIEND_TEST_ALL_PREFIXES(FencedFrameMPArchBrowserTest, FrameIteration); |
| 1668 | FRIEND_TEST_ALL_PREFIXES(FencedFrameParameterizedBrowserTest, |
| 1669 | ShouldIgnoreJsDialog); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1670 | FRIEND_TEST_ALL_PREFIXES(FormStructureBrowserTest, HTMLFiles); |
| 1671 | FRIEND_TEST_ALL_PREFIXES(NavigationControllerTest, HistoryNavigate); |
[email protected] | b0936d2 | 2013-11-28 06:47:36 | [diff] [blame] | 1672 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostManagerTest, PageDoesBackAndReload); |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 1673 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, CrossSiteIframe); |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1674 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 1675 | TwoSubframesCreatePopupsSimultaneously); |
Antonio Gomes | da7e03d | 2020-08-05 15:03:08 | [diff] [blame] | 1676 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, TextAutosizerPageInfo); |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1677 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessBrowserTest, |
| 1678 | TwoSubframesCreatePopupMenuWidgetsSimultaneously); |
dmazzoni | 0b5d248 | 2014-09-10 19:45:57 | [diff] [blame] | 1679 | FRIEND_TEST_ALL_PREFIXES(SitePerProcessAccessibilityBrowserTest, |
| 1680 | CrossSiteIframeAccessibility); |
avi | 2d7d2c3 | 2017-03-15 21:55:02 | [diff] [blame] | 1681 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
| 1682 | IframeBeforeUnloadParentHang); |
avi | 336125f7 | 2017-05-06 22:25:40 | [diff] [blame] | 1683 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
| 1684 | BeforeUnloadDialogRequiresGesture); |
Charles Reis | 15d60b13 | 2017-11-03 17:43:47 | [diff] [blame] | 1685 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
| 1686 | CancelBeforeUnloadResetsURL); |
Chris Hamilton | 8199770 | 2018-09-12 14:18:06 | [diff] [blame] | 1687 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
| 1688 | BeforeUnloadDialogSuppressedForDiscard); |
| 1689 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
Dave Tapuska | 19578e9 | 2021-08-09 17:14:02 | [diff] [blame] | 1690 | BeforeUnloadConfirmOnNonActive); |
| 1691 | FRIEND_TEST_ALL_PREFIXES(RenderFrameHostImplBrowserTest, |
Chris Hamilton | 8199770 | 2018-09-12 14:18:06 | [diff] [blame] | 1692 | PendingDialogMakesDiscardUnloadReturnFalse); |
Pavel Feldman | 3c1842b | 2017-08-02 05:00:16 | [diff] [blame] | 1693 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogNotifications); |
| 1694 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, JavaScriptDialogInterop); |
| 1695 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, BeforeUnloadDialog); |
Pavel Feldman | fab3cb6 | 2017-10-05 01:02:01 | [diff] [blame] | 1696 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, PageDisableWithOpenedDialog); |
| 1697 | FRIEND_TEST_ALL_PREFIXES(DevToolsProtocolTest, |
| 1698 | PageDisableWithNoDialogManager); |
Adithya Srinivasan | 1964f7e | 2021-09-21 20:40:02 | [diff] [blame] | 1699 | FRIEND_TEST_ALL_PREFIXES( |
| 1700 | PrerenderWithRenderDocumentBrowserTest, |
| 1701 | ModalDialogShouldNotBeDismissedAfterPrerenderSubframeNavigation); |
Peter Kasting | d2876a2 | 2024-12-03 01:12:55 | [diff] [blame] | 1702 | FRIEND_TEST_ALL_PREFIXES(PrerenderBrowserTest, ForEachRenderFrameHostImpl); |
Yuzu Saijo | a11069a | 2020-04-22 10:56:55 | [diff] [blame] | 1703 | FRIEND_TEST_ALL_PREFIXES(PluginContentOriginAllowlistTest, |
Yuzu Saijo | 97addc3 | 2020-04-22 07:51:12 | [diff] [blame] | 1704 | ClearAllowlistOnNavigate); |
Yuzu Saijo | a11069a | 2020-04-22 10:56:55 | [diff] [blame] | 1705 | FRIEND_TEST_ALL_PREFIXES(PluginContentOriginAllowlistTest, |
Yuzu Saijo | 97addc3 | 2020-04-22 07:51:12 | [diff] [blame] | 1706 | SubframeInheritsAllowlist); |
Nick Carter | d73635b | 2018-03-13 18:31:41 | [diff] [blame] | 1707 | FRIEND_TEST_ALL_PREFIXES(PointerLockBrowserTest, |
| 1708 | PointerLockInnerContentsCrashes); |
Lucas Gadani | a0ea017 | 2018-09-20 18:31:37 | [diff] [blame] | 1709 | FRIEND_TEST_ALL_PREFIXES(PointerLockBrowserTest, PointerLockOopifCrashes); |
Wang Hui | 9f7884a | 2023-02-20 02:17:59 | [diff] [blame] | 1710 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1711 | PopupWindowBrowserNavResumeLoad); |
| 1712 | FRIEND_TEST_ALL_PREFIXES(WebContentsImplBrowserTest, |
| 1713 | SuppressedPopupWindowBrowserNavResumeLoad); |
Thomas Nguyen | 583f07e | 2023-07-19 17:45:37 | [diff] [blame] | 1714 | FRIEND_TEST_ALL_PREFIXES(RenderWidgetHostSitePerProcessTest, |
| 1715 | BrowserClosesPopupIntersectsPermissionPrompt); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1716 | |
paulmeyer | a41de3b | 2016-05-05 16:30:18 | [diff] [blame] | 1717 | // So |find_request_manager_| can be accessed for testing. |
| 1718 | friend class FindRequestManagerTest; |
| 1719 | |
[email protected] | 80e776ae | 2012-03-23 16:17:20 | [diff] [blame] | 1720 | // TODO(brettw) TestWebContents shouldn't exist! |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1721 | friend class TestWebContents; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1722 | |
Avi Drissman | 783c123 | 2021-02-05 01:27:05 | [diff] [blame] | 1723 | class RenderWidgetHostDestructionObserver; |
| 1724 | class WebContentsDestructionObserver; |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 1725 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1726 | // Represents a WebContents node in a tree of WebContents structure. |
| 1727 | // |
| 1728 | // Two WebContents with separate FrameTrees can be connected by |
| 1729 | // outer/inner relationship using this class. Note that their FrameTrees |
| 1730 | // still remain disjoint. |
| 1731 | // The parent is referred to as "outer WebContents" and the descendents are |
| 1732 | // referred to as "inner WebContents". |
| 1733 | // For each inner WebContents, the outer WebContents will have a |
| 1734 | // corresponding FrameTreeNode. |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1735 | class WebContentsTreeNode final : public FrameTreeNode::Observer { |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1736 | public: |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1737 | explicit WebContentsTreeNode(WebContentsImpl* current_web_contents); |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1738 | ~WebContentsTreeNode() final; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1739 | |
Keren Zhu | b5adf39c | 2025-05-19 20:20:30 | [diff] [blame] | 1740 | // Attaches `inner_web_contents` to the `render_frame_host` within this |
| 1741 | // WebContents. If `should_take_ownership` is true, this WebContents will |
| 1742 | // take ownership of `inner_web_contents`. |
| 1743 | void AttachInnerWebContents(WebContents* inner_web_contents, |
| 1744 | RenderFrameHostImpl* render_frame_host, |
| 1745 | bool should_take_ownership); |
| 1746 | |
| 1747 | // Detaches `inner_web_contents` from the outer WebContents. |
| 1748 | void DetachInnerWebContents(WebContents* inner_web_contents); |
| 1749 | |
| 1750 | // Returns true if `inner_web_contents` is attached but not owned by this |
| 1751 | // WebContentsTreeNode. This function will CHECK fail if |
| 1752 | // `inner_web_contents` is not attached to this WebContentsTreeNode. |
| 1753 | bool IsUnownedInnerWebContents(WebContents* inner_web_contents) const; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1754 | |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1755 | WebContentsImpl* outer_web_contents() const { return outer_web_contents_; } |
Avi Drissman | 13d20e9 | 2024-09-05 16:56:30 | [diff] [blame] | 1756 | FrameTreeNodeId outer_contents_frame_tree_node_id() const { |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1757 | return outer_contents_frame_tree_node_id_; |
| 1758 | } |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1759 | FrameTreeNode* OuterContentsFrameTreeNode() const; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1760 | |
Daniel Cheng | 3f2c5ff | 2024-05-30 19:58:18 | [diff] [blame] | 1761 | FrameTree* focused_frame_tree(); |
Dave Tapuska | d8b0530f | 2021-10-19 15:12:31 | [diff] [blame] | 1762 | void SetFocusedFrameTree(FrameTree* frame_tree); |
avallee | 0206f78 | 2016-07-28 18:55:33 | [diff] [blame] | 1763 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1764 | // Returns the inner WebContents within |frame|, if one exists, or nullptr |
| 1765 | // otherwise. |
| 1766 | WebContentsImpl* GetInnerWebContentsInFrame(const FrameTreeNode* frame); |
| 1767 | |
Lucas Furukawa Gadani | 3d38ec15 | 2018-10-26 20:55:18 | [diff] [blame] | 1768 | std::vector<WebContentsImpl*> GetInnerWebContents() const; |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1769 | |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1770 | private: |
Keren Zhu | b5adf39c | 2025-05-19 20:20:30 | [diff] [blame] | 1771 | void DetachUnownedInnerWebContents(WebContentsImpl* inner_web_contents); |
| 1772 | void DestroyOwnedInnerWebContents(WebContentsImpl* inner_web_contents); |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1773 | |
lfg | a3e2bdc | 2017-03-07 20:44:01 | [diff] [blame] | 1774 | // FrameTreeNode::Observer implementation. |
| 1775 | void OnFrameTreeNodeDestroyed(FrameTreeNode* node) final; |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1776 | |
| 1777 | // The WebContents that owns this WebContentsTreeNode. |
Ali Hijazi | 4d4e2409 | 2022-10-20 22:59:31 | [diff] [blame] | 1778 | const raw_ptr<WebContentsImpl, DanglingUntriaged> current_web_contents_; |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1779 | |
| 1780 | // The outer WebContents of |current_web_contents_|, or nullptr if |
| 1781 | // |current_web_contents_| is the outermost WebContents. |
Ali Hijazi | 4d4e2409 | 2022-10-20 22:59:31 | [diff] [blame] | 1782 | raw_ptr<WebContentsImpl, DanglingUntriaged> outer_web_contents_; |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1783 | |
| 1784 | // The ID of the FrameTreeNode in the |outer_web_contents_| that hosts |
| 1785 | // |current_web_contents_| as an inner WebContents. |
Avi Drissman | 13d20e9 | 2024-09-05 16:56:30 | [diff] [blame] | 1786 | FrameTreeNodeId outer_contents_frame_tree_node_id_; |
lfg | 60123369 | 2017-03-06 22:45:44 | [diff] [blame] | 1787 | |
Keren Zhu | b5adf39c | 2025-05-19 20:20:30 | [diff] [blame] | 1788 | // List of inner WebContents that we host and own. |
| 1789 | std::vector<std::unique_ptr<WebContents>> owned_inner_web_contents_; |
| 1790 | |
| 1791 | // List of inner WebContents that we host but don't own. |
| 1792 | std::vector<raw_ptr<WebContents>> unowned_inner_web_contents_; |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 1793 | |
Dave Tapuska | d8b0530f | 2021-10-19 15:12:31 | [diff] [blame] | 1794 | // Only the root node should have this set. This indicates the FrameTree |
| 1795 | // that has the focused frame. The FrameTree tree could be arbitrarily deep. |
| 1796 | // An inner WebContents if focused is responsible for setting this back to |
| 1797 | // another valid during its destruction. See WebContentsImpl destructor. |
Alison Gale | 81f4f2c7 | 2024-04-22 19:33:31 | [diff] [blame] | 1798 | // TODO(crbug.com/40200744): Support clearing this for inner frame trees. |
Daniel Cheng | 3f2c5ff | 2024-05-30 19:58:18 | [diff] [blame] | 1799 | raw_ptr<FrameTree> focused_frame_tree_; |
lazyboy | 6ec48b2a | 2015-06-29 15:18:14 | [diff] [blame] | 1800 | }; |
| 1801 | |
Alexander Timin | 90c20c3 | 2020-08-12 15:28:32 | [diff] [blame] | 1802 | // Container for WebContentsObservers, which knows when we are iterating over |
| 1803 | // observer set. |
| 1804 | class WebContentsObserverList { |
| 1805 | public: |
| 1806 | WebContentsObserverList(); |
| 1807 | ~WebContentsObserverList(); |
| 1808 | |
| 1809 | void AddObserver(WebContentsObserver* observer); |
| 1810 | void RemoveObserver(WebContentsObserver* observer); |
| 1811 | |
Andrew Grieve | e19cd93e | 2021-01-22 05:43:06 | [diff] [blame] | 1812 | // T1 must be a pointer to a WebContentsObserver method. |
| 1813 | template <typename T1, typename... P1> |
| 1814 | void NotifyObservers(T1 func, P1&&... args) { |
Etienne Pierre-doray | 2f16b8292 | 2024-11-08 15:10:25 | [diff] [blame] | 1815 | TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), |
| 1816 | "WebContentsObserverList::NotifyObservers"); |
Alexander Timin | 90c20c3 | 2020-08-12 15:28:32 | [diff] [blame] | 1817 | base::AutoReset<bool> scope(&is_notifying_observers_, true); |
| 1818 | for (WebContentsObserver& observer : observers_) { |
| 1819 | TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("content.verbose"), |
| 1820 | "Dispatching WebContentsObserver callback"); |
Andrew Grieve | e19cd93e | 2021-01-22 05:43:06 | [diff] [blame] | 1821 | ((observer).*(func))(std::forward<P1>(args)...); |
Alexander Timin | 90c20c3 | 2020-08-12 15:28:32 | [diff] [blame] | 1822 | } |
| 1823 | } |
| 1824 | |
| 1825 | bool is_notifying_observers() { return is_notifying_observers_; } |
| 1826 | |
| 1827 | // Exposed to deal with IPC message handlers which need to stop iteration |
| 1828 | // early. |
Jordan Bayles | a4d7edbe | 2023-10-07 05:59:34 | [diff] [blame] | 1829 | const base::ObserverList<WebContentsObserver>& observer_list() { |
Alexander Timin | 90c20c3 | 2020-08-12 15:28:32 | [diff] [blame] | 1830 | return observers_; |
| 1831 | } |
| 1832 | |
| 1833 | private: |
| 1834 | bool is_notifying_observers_ = false; |
Jordan Bayles | a4d7edbe | 2023-10-07 05:59:34 | [diff] [blame] | 1835 | base::ObserverList<WebContentsObserver> observers_; |
Alexander Timin | 90c20c3 | 2020-08-12 15:28:32 | [diff] [blame] | 1836 | }; |
| 1837 | |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 1838 | // See WebContents::Create for a description of these parameters. |
Lukasz Anforowicz | e9ae372 | 2017-09-29 17:37:38 | [diff] [blame] | 1839 | explicit WebContentsImpl(BrowserContext* browser_context); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 1840 | |
Albert J. Wong | 65fe64d | 2019-09-20 02:48:14 | [diff] [blame] | 1841 | // Covariant return type alternative for WebContents::Create(). Avoids |
| 1842 | // need for casting of objects inside the content layer. |
| 1843 | static std::unique_ptr<WebContentsImpl> Create(const CreateParams& params); |
| 1844 | |
[email protected] | e2225bf | 2013-11-15 16:09:38 | [diff] [blame] | 1845 | // Add and remove observers for page navigation notifications. The order in |
| 1846 | // which notifications are sent to observers is undefined. Clients must be |
| 1847 | // sure to remove the observer before they go away. |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 1848 | void AddObserver(WebContentsObserver* observer); |
| 1849 | void RemoveObserver(WebContentsObserver* observer); |
[email protected] | d1198fd | 2012-08-13 22:50:19 | [diff] [blame] | 1850 | |
danakj | cdab6ed5 | 2021-02-10 23:44:13 | [diff] [blame] | 1851 | // Indicates whether this tab should be considered crashed. The setter will |
| 1852 | // also notify the delegate when the flag is changed. |
Khushal | c5eaf22 | 2021-06-30 20:15:48 | [diff] [blame] | 1853 | void SetPrimaryMainFrameProcessStatus(base::TerminationStatus status, |
| 1854 | int error_code); |
danakj | cdab6ed5 | 2021-02-10 23:44:13 | [diff] [blame] | 1855 | |
alexmos | e201c7cd | 2015-06-10 17:14:21 | [diff] [blame] | 1856 | // Clears a pending contents that has been closed before being shown. |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 1857 | void OnWebContentsDestroyed(WebContentsImpl* web_contents); |
| 1858 | |
Daniel Cheng | 036c5b9 | 2024-05-07 15:19:37 | [diff] [blame] | 1859 | // Creates and adds to the map a destruction observer watching |
| 1860 | // `render_widget_host`. There must be no observer already watching |
| 1861 | // `render_widget_host`. |
| 1862 | void AddRenderWidgetHostDestructionObserver( |
| 1863 | RenderWidgetHost* render_widget_host); |
| 1864 | |
| 1865 | // Deletes and removes from the map a destruction observer |
| 1866 | // watching `render_widget_host`. No-op if there is no such observer. |
| 1867 | void RemoveRenderWidgetHostDestructionObserver( |
| 1868 | RenderWidgetHost* render_widget_host); |
| 1869 | |
Avi Drissman | 783c123 | 2021-02-05 01:27:05 | [diff] [blame] | 1870 | // Clears a pending render widget host that has been closed before being |
| 1871 | // shown. |
| 1872 | void OnRenderWidgetHostDestroyed(RenderWidgetHost* render_widget_host); |
| 1873 | |
| 1874 | // Creates and adds to the map a destruction observer watching `web_contents`. |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 1875 | // No-op if such an observer already exists. |
Avi Drissman | 783c123 | 2021-02-05 01:27:05 | [diff] [blame] | 1876 | void AddWebContentsDestructionObserver(WebContentsImpl* web_contents); |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 1877 | |
| 1878 | // Deletes and removes from the map a destruction observer |
Avi Drissman | 783c123 | 2021-02-05 01:27:05 | [diff] [blame] | 1879 | // watching `web_contents`. No-op if there is no such observer. |
| 1880 | void RemoveWebContentsDestructionObserver(WebContentsImpl* web_contents); |
| 1881 | |
Adithya Srinivasan | e6e7f84 | 2019-12-16 18:41:36 | [diff] [blame] | 1882 | // Traverses all the WebContents in the WebContentsTree and creates a set of |
| 1883 | // all the unique RenderWidgetHostViews. |
Kevin McNee | ef1e936 | 2021-06-08 21:31:52 | [diff] [blame] | 1884 | std::set<RenderWidgetHostViewBase*> |
| 1885 | GetRenderWidgetHostViewsInWebContentsTree(); |
Adithya Srinivasan | e6e7f84 | 2019-12-16 18:41:36 | [diff] [blame] | 1886 | |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1887 | // Called with the result of a DownloadImage() request. |
Mikel Astiz | 034ba14e | 2021-04-30 07:23:49 | [diff] [blame] | 1888 | void OnDidDownloadImage(base::WeakPtr<RenderFrameHostImpl> rfh, |
| 1889 | ImageDownloadCallback callback, |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1890 | int id, |
| 1891 | const GURL& image_url, |
leon.han | cbc4bc3c | 2016-02-26 07:08:52 | [diff] [blame] | 1892 | int32_t http_status_code, |
leon.han | c222853 | 2016-08-16 05:59:18 | [diff] [blame] | 1893 | const std::vector<SkBitmap>& images, |
| 1894 | const std::vector<gfx::Size>& original_image_sizes); |
pkotwicz | 75ca8ffd | 2016-02-16 23:10:19 | [diff] [blame] | 1895 | |
Jacob Francis | 0043f24 | 2024-07-24 21:46:21 | [diff] [blame] | 1896 | int GetNextDownloadId(); |
| 1897 | |
Pavel Feldman | 3c1842b | 2017-08-02 05:00:16 | [diff] [blame] | 1898 | // Callback function when showing JavaScript dialogs. Takes in a routing ID |
[email protected] | 6fba26d | 2014-04-29 09:38:28 | [diff] [blame] | 1899 | // pair to identify the RenderFrameHost that opened the dialog, because it's |
| 1900 | // possible for the RenderFrameHost to be deleted by the time this is called. |
| 1901 | void OnDialogClosed(int render_process_id, |
| 1902 | int render_frame_id, |
Dave Tapuska | cdf545cc | 2020-01-23 18:38:52 | [diff] [blame] | 1903 | JavaScriptDialogCallback response_callback, |
Avi Drissman | 1a55a9d6 | 2020-03-10 18:56:45 | [diff] [blame] | 1904 | base::ScopedClosureRunner fullscreen_block, |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 1905 | bool dialog_was_suppressed, |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 1906 | bool success, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 1907 | const std::u16string& user_input); |
[email protected] | 51da7e3 | 2012-01-30 19:24:52 | [diff] [blame] | 1908 | |
[email protected] | d0759f49 | 2012-04-19 22:50:50 | [diff] [blame] | 1909 | // IPC message handlers. |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1910 | void OnUpdateZoomLimits(RenderViewHostImpl* source, |
| 1911 | int minimum_percent, |
[email protected] | fce82322 | 2014-05-30 16:24:30 | [diff] [blame] | 1912 | int maximum_percent); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1913 | void OnShowValidationMessage(RenderViewHostImpl* source, |
| 1914 | const gfx::Rect& anchor_in_root_view, |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 1915 | const std::u16string& main_text, |
| 1916 | const std::u16string& sub_text); |
nick | a0ac838 | 2016-12-15 23:59:23 | [diff] [blame] | 1917 | void OnHideValidationMessage(RenderViewHostImpl* source); |
| 1918 | void OnMoveValidationMessage(RenderViewHostImpl* source, |
| 1919 | const gfx::Rect& anchor_in_root_view); |
[email protected] | edc3af8 | 2013-12-12 21:24:07 | [diff] [blame] | 1920 | |
danakj | 5f22bcc | 2021-02-12 18:09:01 | [diff] [blame] | 1921 | // Determines if content is allowed to overscroll. This value comes from the |
| 1922 | // WebContentsDelegate, but can also be overridden by the WebContents. |
| 1923 | bool CanOverscrollContent() const; |
| 1924 | |
Aman Verma | b3ed74e | 2024-04-29 13:58:13 | [diff] [blame] | 1925 | // void CastToViewBaseSafely( |
| 1926 | // RenderWidgetTargeter::RenderWidgetHostAtPointCallback callback, |
| 1927 | // base::WeakPtr<RenderWidgetHostViewInput> view, |
| 1928 | // std::optional<gfx::PointF> point) ; |
| 1929 | |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1930 | // Inner WebContents Helpers ------------------------------------------------- |
| 1931 | // |
| 1932 | // These functions are helpers in managing a hierarchy of WebContents |
| 1933 | // involved in rendering inner WebContents. |
| 1934 | |
K. Moon | 97def7d | 2022-02-01 15:56:02 | [diff] [blame] | 1935 | // The following functions update registrations for all RenderWidgetHostViews |
| 1936 | // rooted at this WebContents. They are used when attaching/detaching an inner |
| 1937 | // WebContents. |
| 1938 | // |
| 1939 | // Some properties of RenderWidgetHostViews, such as the FrameSinkId and |
| 1940 | // TextInputManager, depend on the outermost WebContents, and must be updated |
| 1941 | // during attach/detach. |
| 1942 | void RecursivelyRegisterRenderWidgetHostViews(); |
| 1943 | void RecursivelyUnregisterRenderWidgetHostViews(); |
W. James MacLean | 2dc75ed4 | 2019-03-06 14:31:09 | [diff] [blame] | 1944 | |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1945 | // When multiple WebContents are present within a tab or window, a single one |
| 1946 | // is focused and will route keyboard events in most cases to a RenderWidget |
| 1947 | // contained within it. |GetFocusedWebContents()|'s main frame widget will |
| 1948 | // receive page focus and blur events when the containing window changes focus |
| 1949 | // state. |
| 1950 | |
avallee | 9993fca | 2016-11-17 06:16:50 | [diff] [blame] | 1951 | // Returns true if |this| is the focused WebContents or an ancestor of the |
| 1952 | // focused WebContents. |
| 1953 | bool ContainsOrIsFocusedWebContents(); |
| 1954 | |
Keren Zhu | b5adf39c | 2025-05-19 20:20:30 | [diff] [blame] | 1955 | // Internal implementation of AttachInnerWebContents() and |
| 1956 | // AttachUnownedInnerWebContents(). |
| 1957 | void AttachInnerWebContentsImpl(WebContents* inner_web_contents, |
| 1958 | RenderFrameHost* render_frame_host, |
| 1959 | bool is_full_page, |
| 1960 | bool should_take_ownership); |
| 1961 | |
Keren Zhu | 9e37803 | 2025-05-26 19:20:39 | [diff] [blame] | 1962 | // Internal implementation of DetachUnownedInnerWebContents() that does not |
| 1963 | // require a pass key. Called by ~WebContentsImpl. |
| 1964 | void DetachUnownedInnerWebContents(WebContents* inner_web_contents); |
| 1965 | |
Jeremy Roman | 03ce13ce | 2020-05-29 22:16:57 | [diff] [blame] | 1966 | // Called just after an inner web contents is attached. |
| 1967 | void InnerWebContentsAttached(WebContents* inner_web_contents); |
| 1968 | |
| 1969 | // Called just after an inner web contents is detached. |
| 1970 | void InnerWebContentsDetached(WebContents* inner_web_contents); |
| 1971 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 1972 | // Navigation helpers -------------------------------------------------------- |
| 1973 | // |
| 1974 | // These functions are helpers for Navigate() and DidNavigate(). |
| 1975 | |
| 1976 | // Handles post-navigation tasks in DidNavigate AFTER the entry has been |
| 1977 | // committed to the navigation controller. Note that the navigation entry is |
| 1978 | // not provided since it may be invalid/changed after being committed. The |
| 1979 | // current navigation entry is in the NavigationController at this point. |
[email protected] | 2f7b3c5a | 2013-06-21 04:59:25 | [diff] [blame] | 1980 | |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1981 | // Finds the new RenderWidgetHost and returns it. Note that this can only be |
| 1982 | // called once as this call also removes it from the internal map. |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 1983 | RenderWidgetHostView* GetCreatedWidget(int process_id, int route_id); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1984 | |
Joel Hockey | 8c2011b2 | 2020-04-30 05:07:19 | [diff] [blame] | 1985 | // Finds the new CreatedWindow by |main_frame_widget_route_id|, initializes |
nick | 5ae4d2d | 2017-01-06 01:18:35 | [diff] [blame] | 1986 | // it for renderer-initiated creation, and returns it. Note that this can only |
| 1987 | // be called once as this call also removes it from the internal map. |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 1988 | std::optional<CreatedWindow> GetCreatedWindow(int process_id, |
| 1989 | int main_frame_widget_route_id); |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 1990 | |
Gyuyoung Kim | 877e86d | 2020-07-21 04:01:02 | [diff] [blame] | 1991 | // Execute a PageBroadcast Mojo method. |
| 1992 | void ExecutePageBroadcastMethod(PageBroadcastMethodCallback callback); |
| 1993 | |
Takashi Toyoshima | df3f4e31 | 2021-11-19 03:51:48 | [diff] [blame] | 1994 | // Execute a PageBroadcast Mojo method for all MPArch pages. |
| 1995 | void ExecutePageBroadcastMethodForAllPages( |
| 1996 | PageBroadcastMethodCallback callback); |
| 1997 | |
lukasza | 6f8ac62 | 2017-06-06 03:10:20 | [diff] [blame] | 1998 | void SetOpenerForNewContents(FrameTreeNode* opener, bool opener_suppressed); |
| 1999 | |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 2000 | // Tracking loading progress ------------------------------------------------- |
| 2001 | |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 2002 | // Resets the tracking state of the current load progress. |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 2003 | void ResetLoadProgressState(); |
| 2004 | |
fdegans | a696e511 | 2015-04-17 01:57:59 | [diff] [blame] | 2005 | // Notifies the delegate that the load progress was updated. |
| 2006 | void SendChangeLoadProgress(); |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 2007 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2008 | // Misc non-view stuff ------------------------------------------------------- |
| 2009 | |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 2010 | // Sets the history for a specified RenderViewHost to |history_length| |
Charlie Reis | 99b2eba2 | 2025-01-31 19:18:57 | [diff] [blame] | 2011 | // entries, with an index of |history_index|. |
| 2012 | void SetHistoryIndexAndLengthForView(RenderViewHost* render_view_host, |
| 2013 | int history_index, |
| 2014 | int history_length); |
avi | 2b17759 | 2014-12-10 02:08:02 | [diff] [blame] | 2015 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2016 | // Helper functions for sending notifications. |
danakj | a0bce4c95 | 2020-05-12 20:40:28 | [diff] [blame] | 2017 | void NotifyViewSwapped(RenderViewHost* old_view, RenderViewHost* new_view); |
Kevin McNee | fb86fcf | 2021-02-26 23:20:57 | [diff] [blame] | 2018 | void NotifyFrameSwapped(RenderFrameHostImpl* old_frame, |
Dave Tapuska | e45d6fd | 2021-09-29 17:03:59 | [diff] [blame] | 2019 | RenderFrameHostImpl* new_frame); |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2020 | |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 2021 | // TODO(creis): This should take in a FrameTreeNode to know which node's |
| 2022 | // render manager to return. For now, we just return the root's. |
Paul Semel | 3e24104 | 2022-10-11 12:57:31 | [diff] [blame] | 2023 | RenderFrameHostManager* GetRenderManager(); |
[email protected] | fa944cb8 | 2013-11-15 17:51:21 | [diff] [blame] | 2024 | |
[email protected] | 7a846df | 2012-09-20 19:17:39 | [diff] [blame] | 2025 | // Removes browser plugin embedder if there is one. |
| 2026 | void RemoveBrowserPluginEmbedder(); |
| 2027 | |
danakj | a0bce4c95 | 2020-05-12 20:40:28 | [diff] [blame] | 2028 | // Returns the size that the main frame should be sized to. |
| 2029 | gfx::Size GetSizeForMainFrame(); |
[email protected] | dc0fd43 | 2013-08-27 15:29:21 | [diff] [blame] | 2030 | |
[email protected] | 222f582 | 2014-02-05 23:40:49 | [diff] [blame] | 2031 | // Helper method that's called whenever |preferred_size_| or |
| 2032 | // |preferred_size_for_capture_| changes, to propagate the new value to the |
| 2033 | // |delegate_|. |
| 2034 | void OnPreferredSizeChanged(const gfx::Size& old_size); |
| 2035 | |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 2036 | // Returns the FindRequestManager, which may be found in an outer WebContents. |
Lucas Furukawa Gadani | e1c5dfda | 2018-11-29 17:57:41 | [diff] [blame] | 2037 | FindRequestManager* GetFindRequestManager(); |
paulmeyer | feafc2d | 2017-04-25 21:46:40 | [diff] [blame] | 2038 | |
Ehsan Karamad | 6beb2ea | 2018-11-25 18:15:13 | [diff] [blame] | 2039 | // Returns the FindRequestManager, or tries to create one if it doesn't |
| 2040 | // already exist. The FindRequestManager may be found in an outer |
| 2041 | // WebContents. If this is an inner WebContents which is not yet attached to |
| 2042 | // an outer WebContents the method will return nullptr. |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 2043 | FindRequestManager* GetOrCreateFindRequestManager(); |
| 2044 | |
falken | 52a56e3 | 2016-12-08 05:02:40 | [diff] [blame] | 2045 | // Prints a console warning when visiting a localhost site with a bad |
| 2046 | // certificate via --allow-insecure-localhost. |
Jeremy Roman | d597d337 | 2021-07-09 23:36:56 | [diff] [blame] | 2047 | void ShowInsecureLocalhostWarningIfNeeded(PageImpl& page); |
falken | 52a56e3 | 2016-12-08 05:02:40 | [diff] [blame] | 2048 | |
Megan Jablonski | 2f6a4c5 | 2017-07-10 23:01:25 | [diff] [blame] | 2049 | // Format of |headers| is a new line separated list of key value pairs: |
| 2050 | // "<key1>: <value1>\r\n<key2>: <value2>". |
Min Qin | a904f330 | 2018-02-13 23:33:34 | [diff] [blame] | 2051 | static download::DownloadUrlParameters::RequestHeadersType |
| 2052 | ParseDownloadHeaders(const std::string& headers); |
Megan Jablonski | 2f6a4c5 | 2017-07-10 23:01:25 | [diff] [blame] | 2053 | |
EhsanK | 2075c7e | 2017-08-21 02:42:39 | [diff] [blame] | 2054 | // Sets the visibility of immediate child views, i.e. views whose parent view |
| 2055 | // is that of the main frame. |
| 2056 | void SetVisibilityForChildViews(bool visible); |
| 2057 | |
Lukasz Anforowicz | fd70714 | 2018-02-07 19:46:13 | [diff] [blame] | 2058 | // A helper for clearing the link status bubble after navigating away. |
| 2059 | // See also UpdateTargetURL. |
| 2060 | void ClearTargetURL(); |
| 2061 | |
Arthur Sonzogni | 929d29f | 2018-09-17 14:19:44 | [diff] [blame] | 2062 | // Called each time |fullscreen_frames_| is updated. Find the new |
Charlie Reis | 207e93c | 2023-10-04 23:48:49 | [diff] [blame] | 2063 | // |current_fullscreen_frame_id_| and notify observers whenever it changes. |
Arthur Sonzogni | 929d29f | 2018-09-17 14:19:44 | [diff] [blame] | 2064 | void FullscreenFrameSetUpdated(); |
| 2065 | |
Sonja | 3e1acb1 | 2024-01-15 12:06:41 | [diff] [blame] | 2066 | // Adjusts bounds for minimum window size and available screen area |
| 2067 | // constraints. This compliments similar renderer-side adjustments, using the |
| 2068 | // resolved display mode for new windows, which renderers may be unable to |
| 2069 | // determine. |
| 2070 | int64_t AdjustWindowRect(gfx::Rect* bounds, RenderFrameHostImpl* opener); |
| 2071 | |
Alison Maher | 7f366dc6 | 2020-03-03 19:46:00 | [diff] [blame] | 2072 | // ui::NativeThemeObserver: |
| 2073 | void OnNativeThemeUpdated(ui::NativeTheme* observed_theme) override; |
Abigail Klein | 08cfe3f | 2021-04-01 02:09:31 | [diff] [blame] | 2074 | void OnCaptionStyleUpdated() override; |
Alison Maher | 7f366dc6 | 2020-03-03 19:46:00 | [diff] [blame] | 2075 | |
tom | 855c4bf3 | 2021-09-30 00:27:26 | [diff] [blame] | 2076 | // ui::ColorProviderSourceObserver: |
| 2077 | void OnColorProviderChanged() override; |
| 2078 | |
| 2079 | // Returns the ColorProvider instance for this WebContents object. This will |
| 2080 | // always return a valid ColorProvider instance. |
Tom Lukaszewicz | 63b3da5 | 2022-01-26 01:37:57 | [diff] [blame] | 2081 | const ui::ColorProvider& GetColorProvider() const override; |
tom | 855c4bf3 | 2021-09-30 00:27:26 | [diff] [blame] | 2082 | |
Shintaro Kawamura | 1042d57 | 2024-09-30 13:52:22 | [diff] [blame] | 2083 | // implements SlowWebPreferenceCacheObserver |
| 2084 | void OnSlowWebPreferenceChanged() override; |
| 2085 | |
Collin Baker | 989e088 | 2019-11-01 01:27:17 | [diff] [blame] | 2086 | // Sets the visibility to |new_visibility| and propagates this to the |
| 2087 | // renderer side, taking into account the current capture state. This |
Elad Alon | 0feb660 | 2021-10-14 09:26:36 | [diff] [blame] | 2088 | // can be called with the current visibility to affect capturing |
Collin Baker | 989e088 | 2019-11-01 01:27:17 | [diff] [blame] | 2089 | // changes. |
Elad Alon | 0feb660 | 2021-10-14 09:26:36 | [diff] [blame] | 2090 | // |is_activity| controls whether a change to |visible| affects |
Olivier ROBIN | 4b58dd93 | 2024-08-06 13:30:32 | [diff] [blame] | 2091 | // the value returned by GetLastActiveTimeTicks(). |
Elad Alon | 0feb660 | 2021-10-14 09:26:36 | [diff] [blame] | 2092 | void UpdateVisibilityAndNotifyPageAndView(Visibility new_visibility, |
| 2093 | bool is_activity = true); |
Collin Baker | 989e088 | 2019-11-01 01:27:17 | [diff] [blame] | 2094 | |
Alexander Timin | e3ec419 | 2020-04-20 16:39:40 | [diff] [blame] | 2095 | // Returns UKM source id for the currently displayed page. |
| 2096 | // Intentionally kept private, prefer using |
| 2097 | // render_frame_host->GetPageUkmSourceId() if you already have a |
Dave Tapuska | 327c06c9 | 2022-06-13 20:31:51 | [diff] [blame] | 2098 | // |render_frame_host| reference or |
| 2099 | // GetPrimaryMainFrame()->GetPageUkmSourceId() if you don't. |
Alexander Timin | e3ec419 | 2020-04-20 16:39:40 | [diff] [blame] | 2100 | ukm::SourceId GetCurrentPageUkmSourceId() override; |
| 2101 | |
Dave Tapuska | 05fcfb6 | 2021-10-18 17:09:03 | [diff] [blame] | 2102 | // Bit mask to indicate what types of RenderViewHosts to be returned in |
| 2103 | // ForEachRenderViewHost. |
| 2104 | enum ForEachRenderViewHostTypes { |
| 2105 | kPrerenderViews = 1 << 0, |
| 2106 | kBackForwardCacheViews = 1 << 1, |
| 2107 | kActiveViews = 1 << 2, |
| 2108 | kAllViews = kActiveViews | kBackForwardCacheViews | kPrerenderViews, |
| 2109 | }; |
| 2110 | |
| 2111 | // For each RenderViewHost (including bfcache, prerendering) call the |
| 2112 | // callback, this will be filtered by `view_mask`. |
| 2113 | void ForEachRenderViewHost( |
| 2114 | ForEachRenderViewHostTypes view_mask, |
| 2115 | RenderViewHostIterationCallback on_render_view_host); |
Yuzu Saijo | 232076f | 2020-05-29 07:14:02 | [diff] [blame] | 2116 | |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 2117 | // This is the actual implementation of the various overloads of |
| 2118 | // |ForEachRenderFrameHost|. |
| 2119 | void ForEachRenderFrameHostImpl( |
Daniel Cheng | 982f2b2 | 2022-08-25 23:46:16 | [diff] [blame] | 2120 | base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame, |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 2121 | bool include_speculative); |
| 2122 | |
Takashi Toyoshima | dc3f747 | 2021-07-21 08:02:32 | [diff] [blame] | 2123 | // Calls |on_frame_tree| for every FrameTree in this WebContents. |
Kevin McNee | 53f0b2d | 2021-11-02 18:00:45 | [diff] [blame] | 2124 | // This does not descend into inner WebContents, but does include inner frame |
| 2125 | // trees based on MPArch. |
Takashi Toyoshima | dc3f747 | 2021-07-21 08:02:32 | [diff] [blame] | 2126 | void ForEachFrameTree(FrameTreeIterationCallback on_frame_tree); |
| 2127 | |
Kevin McNee | 53f0b2d | 2021-11-02 18:00:45 | [diff] [blame] | 2128 | // Returns the primary frame tree, followed by any other outermost frame trees |
| 2129 | // in this WebContents. Outermost frame trees include, for example, |
Jeremy Roman | c0c69be | 2023-11-21 19:14:52 | [diff] [blame] | 2130 | // prerendering frame trees, and do not include, for example, fenced frames. |
| 2131 | // Also note that bfcached pages do not have a distinct frame tree, |
Kevin McNee | 53f0b2d | 2021-11-02 18:00:45 | [diff] [blame] | 2132 | // so the primary frame tree in the result would be the only FrameTree |
| 2133 | // representing any bfcached pages. |
| 2134 | std::vector<FrameTree*> GetOutermostFrameTrees(); |
| 2135 | |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 2136 | // Returns the primary main frame, followed by the main frames of any other |
Kevin McNee | 53f0b2d | 2021-11-02 18:00:45 | [diff] [blame] | 2137 | // outermost frame trees in this WebContents and the main frames of any |
| 2138 | // bfcached pages. Note that unlike GetOutermostFrameTrees, bfcached pages |
| 2139 | // have a distinct RenderFrameHostImpl in this result. |
Kevin McNee | c9d0fda | 2021-05-19 15:55:17 | [diff] [blame] | 2140 | std::vector<RenderFrameHostImpl*> GetOutermostMainFrames(); |
| 2141 | |
Dale Curtis | 7030f25 | 2021-04-07 14:05:31 | [diff] [blame] | 2142 | // Called when the base::ScopedClosureRunner returned by |
| 2143 | // IncrementCapturerCount() is destructed. |
Elad Alon | 0feb660 | 2021-10-14 09:26:36 | [diff] [blame] | 2144 | void DecrementCapturerCount(bool stay_hidden, |
| 2145 | bool stay_awake, |
| 2146 | bool is_activity = true); |
Dale Curtis | 7030f25 | 2021-04-07 14:05:31 | [diff] [blame] | 2147 | |
Tsuyoshi Horo | cd82846 | 2021-04-21 04:59:58 | [diff] [blame] | 2148 | // Calculates the PageVisibilityState for |visibility|, taking the capturing |
| 2149 | // state into account. |
| 2150 | PageVisibilityState CalculatePageVisibilityState(Visibility visibility) const; |
| 2151 | |
Khushal | c5eaf22 | 2021-06-30 20:15:48 | [diff] [blame] | 2152 | // Called when the process hosting the primary main RenderFrameHost is known |
| 2153 | // to be alive. |
| 2154 | void NotifyPrimaryMainFrameProcessIsAlive(); |
| 2155 | |
Rakina Zata Amni | 46087a1 | 2022-11-11 08:28:38 | [diff] [blame] | 2156 | // Updates |entry|'s title. |entry| must belong to the WebContents' primary |
| 2157 | // NavigationController. Returns true if |entry|'s title was changed, and |
| 2158 | // false otherwise. |
Adithya Srinivasan | 9b0c99c | 2021-08-10 15:19:45 | [diff] [blame] | 2159 | bool UpdateTitleForEntryImpl(NavigationEntryImpl* entry, |
| 2160 | const std::u16string& title); |
| 2161 | // Dispatches WebContentsObserver::TitleWasSet and also notifies the delegate |
| 2162 | // of a title change if |entry| is the entry whose title is being used as the |
| 2163 | // display title. |
| 2164 | void NotifyTitleUpdateForEntry(NavigationEntryImpl* entry); |
| 2165 | // Returns the navigation entry whose title is used as the display title for |
Rakina Zata Amni | 46087a1 | 2022-11-11 08:28:38 | [diff] [blame] | 2166 | // this WebContents (i.e. for WebContents::GetTitle()). |
Adithya Srinivasan | 9b0c99c | 2021-08-10 15:19:45 | [diff] [blame] | 2167 | NavigationEntry* GetNavigationEntryForTitle(); |
| 2168 | |
Klaus Weidner | d821943 | 2022-02-08 21:50:59 | [diff] [blame] | 2169 | // Apply shared logic for SetHasPictureInPictureVideo() and |
| 2170 | // SetHasPictureInPictureDocument(). |
| 2171 | void SetHasPictureInPictureCommon(bool has_picture_in_picture); |
| 2172 | |
Andy Paicu | 5608bda8 | 2023-03-03 15:09:20 | [diff] [blame] | 2173 | // A scope that disallows custom cursors has expired. |
| 2174 | void DisallowCustomCursorScopeExpired(); |
| 2175 | |
Jiacheng Guo | 6dcc29c | 2024-07-26 00:28:40 | [diff] [blame] | 2176 | // WarmUp a spare render process for future navigations. |
| 2177 | void WarmUpAndroidSpareRenderer(); |
| 2178 | |
Ari Chivukula | ee50305 | 2024-08-30 20:33:53 | [diff] [blame] | 2179 | // If the new window will be a partitioned popin, we need to validate the |
| 2180 | // settings and set the opener. |
| 2181 | // See https://explainers-by-googlers.github.io/partitioned-popins/ |
| 2182 | void SetPartitionedPopinOpenerOnNewWindowIfNeeded( |
| 2183 | WebContentsImpl* new_window, |
| 2184 | const mojom::CreateNewWindowParams& params, |
| 2185 | RenderFrameHostImpl* opener); |
| 2186 | |
Dave Tapuska | 894bfb4 | 2024-11-04 22:44:35 | [diff] [blame] | 2187 | // Creates a new ForwardingAudioStreamFactory. |
| 2188 | std::unique_ptr<ForwardingAudioStreamFactory> CreateAudioStreamFactory(); |
| 2189 | |
Dave Tapuska | 463717e | 2024-11-21 18:42:47 | [diff] [blame] | 2190 | // Cancel any pending dialogs created from the delegate's |
| 2191 | // JavascriptDialogManager. |
| 2192 | void CancelDialogManagerDialogs(bool reset_state); |
| 2193 | |
Ari Chivukula | f6f09ba | 2025-03-04 20:01:34 | [diff] [blame] | 2194 | // See GetPartitionedPopinEmbedderOrigin for details. |
| 2195 | GURL GetPartitionedPopinEmbedderOriginImpl() const; |
| 2196 | |
Mark Schillaci | c1e067e8 | 2025-04-02 17:36:11 | [diff] [blame] | 2197 | // Recursively constructs a vector of AXNodeData objects for the children of |
| 2198 | // the given |node|. |
| 2199 | void RecursivelyConstructAXTree(ui::AXNode* node, |
| 2200 | std::vector<ui::AXNodeData>& nodes); |
| 2201 | |
Shin Kawamura | 7c2f469 | 2025-07-30 00:14:33 | [diff] [blame] | 2202 | #if BUILDFLAG(IS_ANDROID) |
| 2203 | // Apply the cached primary subframe importance to the primary frame tree. |
| 2204 | void ApplyPrimaryPageSubframeImportance(); |
| 2205 | #endif |
| 2206 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2207 | // Data for core operation --------------------------------------------------- |
| 2208 | |
| 2209 | // Delegate for notifying our owner about stuff. Not owned by us. |
Ali Hijazi | 4d4e2409 | 2022-10-20 22:59:31 | [diff] [blame] | 2210 | raw_ptr<WebContentsDelegate, DanglingUntriaged> delegate_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2211 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2212 | // The corresponding view. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 2213 | std::unique_ptr<WebContentsView> view_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2214 | |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 2215 | // The view of the RVHD. Usually this is our WebContentsView implementation, |
| 2216 | // but if an embedder uses a different WebContentsView, they'll need to |
| 2217 | // provide this. |
Lukasz Anforowicz | 3eacd9e6 | 2023-05-17 21:58:54 | [diff] [blame] | 2218 | raw_ptr<RenderViewHostDelegateView> render_view_host_delegate_view_; |
[email protected] | 5a3bdf5 | 2012-05-24 15:12:57 | [diff] [blame] | 2219 | |
Joel Hockey | 8c2011b2 | 2020-04-30 05:07:19 | [diff] [blame] | 2220 | // Tracks CreatedWindow objects that have not been shown yet. They are |
| 2221 | // identified by the process ID and routing ID passed to CreateNewWindow. |
| 2222 | std::map<GlobalRoutingID, CreatedWindow> pending_contents_; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 2223 | |
Avi Drissman | 783c123 | 2021-02-05 01:27:05 | [diff] [blame] | 2224 | // Watches for the destruction of items in `pending_contents_`. |
| 2225 | std::map<WebContentsImpl*, std::unique_ptr<WebContentsDestructionObserver>> |
| 2226 | web_contents_destruction_observers_; |
| 2227 | |
alexmos | c2a8cec | 2016-05-23 22:19:53 | [diff] [blame] | 2228 | // This map holds widgets that were created on behalf of the renderer but |
| 2229 | // haven't been shown yet. |
Ali Hijazi | 60a72b0a | 2024-09-30 17:58:53 | [diff] [blame] | 2230 | std::map<GlobalRoutingID, raw_ptr<RenderWidgetHost, CtnExperimental>> |
| 2231 | pending_widgets_; |
[email protected] | bafe6cd | 2012-05-23 23:09:50 | [diff] [blame] | 2232 | |
Avi Drissman | 783c123 | 2021-02-05 01:27:05 | [diff] [blame] | 2233 | // Watches for the destruction of items in `pending_widgets_`. |
| 2234 | std::map<RenderWidgetHost*, |
| 2235 | std::unique_ptr<RenderWidgetHostDestructionObserver>> |
| 2236 | render_widget_host_destruction_observers_; |
[email protected] | 7fff43e | 2013-05-21 20:21:10 | [diff] [blame] | 2237 | |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 2238 | // A list of observers notified when page state changes. Weak references. |
Carlos Caballero | b65b6e3a | 2021-11-15 10:09:00 | [diff] [blame] | 2239 | // This MUST be listed above `primary_frame_tree_` since at destruction time |
| 2240 | // the latter might cause RenderViewHost's destructor to call us and we might |
| 2241 | // use the observer list then. |
Alexander Timin | 90c20c3 | 2020-08-12 15:28:32 | [diff] [blame] | 2242 | WebContentsObserverList observers_; |
[email protected] | 99604297 | 2011-11-08 22:43:59 | [diff] [blame] | 2243 | |
Greg Thompson | 9cb19276 | 2025-05-12 08:11:57 | [diff] [blame] | 2244 | // True if the WebContents is never user-visible, thus the renderer need never |
| 2245 | // produce pixels for display. |
| 2246 | bool is_never_composited_ = false; |
| 2247 | |
Rakina Zata Amni | c7ffea88 | 2021-08-16 10:04:28 | [diff] [blame] | 2248 | // True if this tab was opened by another window. This is true even if the tab |
| 2249 | // is opened with "noopener", and won't be unset if the opener is closed. |
| 2250 | bool opened_by_another_window_; |
[email protected] | c7c0d82 | 2014-04-16 20:19:49 | [diff] [blame] | 2251 | |
Daniel Cheng | bcbc30f | 2024-05-28 09:02:12 | [diff] [blame] | 2252 | // Set to true while calling out to notify one-off observers (ie non- |
| 2253 | // WebContentsObservers). These observers should not destroy WebContentsImpl |
| 2254 | // while it is on the call stack, as that leads to use-after-frees. |
| 2255 | bool prevent_destruction_ = false; |
| 2256 | |
| 2257 | bool is_being_destroyed_ = false; |
| 2258 | |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 2259 | #if BUILDFLAG(IS_ANDROID) |
Kevin McNee | 576bb5d8 | 2019-05-29 16:47:51 | [diff] [blame] | 2260 | std::unique_ptr<WebContentsAndroid> web_contents_android_; |
Shin Kawamura | 7c2f469 | 2025-07-30 00:14:33 | [diff] [blame] | 2261 | // Caches the importance of subframes in the primary frame tree. |
| 2262 | // WebContentsImpl::RenderFrameCreated() sets the importance to a new |
| 2263 | // RenderWidgetHost for new subframes. |
| 2264 | ChildProcessImportance primary_subframe_importance_ = |
| 2265 | ChildProcessImportance::NORMAL; |
Kevin McNee | 576bb5d8 | 2019-05-29 16:47:51 | [diff] [blame] | 2266 | #endif |
| 2267 | |
Daniel Cheng | 37d2272 | 2024-06-29 00:43:44 | [diff] [blame] | 2268 | // Manages the embedder state for browser plugins, if this WebContents is an |
| 2269 | // embedder; NULL otherwise. |
| 2270 | std::unique_ptr<BrowserPluginEmbedder> browser_plugin_embedder_; |
| 2271 | |
| 2272 | // Manages the guest state for browser plugin, if this WebContents is a guest; |
| 2273 | // NULL otherwise. |
| 2274 | std::unique_ptr<BrowserPluginGuest> browser_plugin_guest_; |
| 2275 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2276 | // Helper classes ------------------------------------------------------------ |
| 2277 | |
Daniel Cheng | 3f2c5ff | 2024-05-30 19:58:18 | [diff] [blame] | 2278 | // Contains information about the WebContents tree structure. |
| 2279 | WebContentsTreeNode node_; |
| 2280 | |
Carlos Caballero | b65b6e3a | 2021-11-15 10:09:00 | [diff] [blame] | 2281 | // Primary FrameTree of this WebContents instance. This WebContents might have |
| 2282 | // additional FrameTrees for features like prerendering and fenced frames, |
| 2283 | // which either might be standalone (prerendering) to nested within a |
| 2284 | // different FrameTree (fenced frame). |
| 2285 | FrameTree primary_frame_tree_; |
Lucas Furukawa Gadani | 9912582 | 2019-01-03 15:41:49 | [diff] [blame] | 2286 | |
[email protected] | c7dd2f6 | 2011-07-18 15:57:59 | [diff] [blame] | 2287 | // SavePackage, lazily created. |
| 2288 | scoped_refptr<SavePackage> save_package_; |
| 2289 | |
paulmeyer | c8cb7cb | 2016-06-07 01:14:19 | [diff] [blame] | 2290 | // Manages/coordinates multi-process find-in-page requests. Created lazily. |
dcheng | 18ec0b54 | 2016-04-26 19:28:53 | [diff] [blame] | 2291 | std::unique_ptr<FindRequestManager> find_request_manager_; |
paulmeyer | c0b762b | 2016-04-13 11:55:17 | [diff] [blame] | 2292 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2293 | // Data for loading state ---------------------------------------------------- |
| 2294 | |
danakj | cdab6ed5 | 2021-02-10 23:44:13 | [diff] [blame] | 2295 | // Indicates the process state of the primary main frame's renderer process. |
| 2296 | // If the process is not live due to a crash, this will be reflected by |
| 2297 | // IsCrashed(), though it's possible to not be live while not indicating a |
| 2298 | // crash occurred. |
Khushal | c5eaf22 | 2021-06-30 20:15:48 | [diff] [blame] | 2299 | base::TerminationStatus primary_main_frame_process_status_; |
| 2300 | int primary_main_frame_process_error_code_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2301 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2302 | // The current load state and the URL associated with it. |
[email protected] | 9c235f04 | 2011-08-10 22:28:21 | [diff] [blame] | 2303 | net::LoadStateWithParam load_state_; |
Jan Wilken Dörrie | aace0cfef | 2021-03-11 22:01:58 | [diff] [blame] | 2304 | std::u16string load_state_host_; |
Dave Tapuska | e1a08aaf | 2021-03-05 18:31:59 | [diff] [blame] | 2305 | base::TimeTicks load_info_timestamp_; |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 2306 | |
[email protected] | 960b037 | 2014-05-19 18:01:00 | [diff] [blame] | 2307 | base::TimeTicks loading_last_progress_update_; |
| 2308 | |
Sreeja Kamishetty | 0be3b1b | 2021-08-12 17:04:15 | [diff] [blame] | 2309 | // Default value is set to 100ms between LoadProgressChanged events. |
| 2310 | base::TimeDelta minimum_delay_between_loading_updates_ms_ = |
Peter Kasting | e5a38ed | 2021-10-02 03:06:35 | [diff] [blame] | 2311 | base::Milliseconds(100); |
Sreeja Kamishetty | 0be3b1b | 2021-08-12 17:04:15 | [diff] [blame] | 2312 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2313 | // Upload progress, for displaying in the status bar. |
| 2314 | // Set to zero when there is no significant upload happening. |
avi | b734894 | 2015-12-25 20:57:10 | [diff] [blame] | 2315 | uint64_t upload_size_; |
| 2316 | uint64_t upload_position_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2317 | |
dfalcantara | e6b7b4675 | 2015-07-10 18:14:16 | [diff] [blame] | 2318 | // Tracks that this WebContents needs to unblock requests to the renderer. |
| 2319 | // See ResumeLoadingCreatedWebContents. |
| 2320 | bool is_resume_pending_; |
| 2321 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2322 | // Data for current page ----------------------------------------------------- |
| 2323 | |
yusufo | d41c5f9 | 2015-03-06 00:14:28 | [diff] [blame] | 2324 | // The last published theme color. |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 2325 | std::optional<SkColor> last_sent_theme_color_; |
yusufo | d41c5f9 | 2015-03-06 00:14:28 | [diff] [blame] | 2326 | |
Alan Cutter | d73a15d9 | 2020-08-21 07:12:45 | [diff] [blame] | 2327 | // The last published background color. |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 2328 | std::optional<SkColor> last_sent_background_color_; |
Alan Cutter | d73a15d9 | 2020-08-21 07:12:45 | [diff] [blame] | 2329 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2330 | // Data for misc internal state ---------------------------------------------- |
| 2331 | |
Collin Baker | c525996 | 2019-11-14 17:51:58 | [diff] [blame] | 2332 | // When either > 0, the WebContents is currently being captured (e.g., |
| 2333 | // for screenshots or mirroring); and the underlying RenderWidgetHost |
| 2334 | // should not be told it is hidden. If |visible_capturer_count_| > 0, |
| 2335 | // the underlying Page is set to fully visible. Otherwise, it is set |
| 2336 | // to be hidden but still paint. |
Dale Curtis | 7030f25 | 2021-04-07 14:05:31 | [diff] [blame] | 2337 | int visible_capturer_count_ = 0; |
| 2338 | int hidden_capturer_count_ = 0; |
| 2339 | |
| 2340 | // When > 0, |capture_wake_lock_| will be held to prevent display sleep. |
| 2341 | int stay_awake_capturer_count_ = 0; |
| 2342 | |
| 2343 | // WakeLock held to ensure screen capture keeps the display on. E.g., for |
| 2344 | // presenting through tab capture APIs. |
Dale Curtis | c496a776 | 2021-02-24 01:15:44 | [diff] [blame] | 2345 | mojo::Remote<device::mojom::WakeLock> capture_wake_lock_; |
[email protected] | 5459798 | 2013-02-06 01:59:55 | [diff] [blame] | 2346 | |
Aman Verma | bb589a3 | 2024-05-07 16:38:17 | [diff] [blame] | 2347 | // Remote end of the connection for sending delegated ink points to viz to |
| 2348 | // support the delegated ink trails feature. |
| 2349 | mojo::Remote<gfx::mojom::DelegatedInkPointRenderer> |
| 2350 | delegated_ink_point_renderer_; |
| 2351 | |
Francois Doray | e616115 | 2018-03-27 22:05:37 | [diff] [blame] | 2352 | // The visibility of the WebContents. Initialized from |
| 2353 | // |CreateParams::initially_hidden|. Updated from |
| 2354 | // UpdateWebContentsVisibility(), WasShown(), WasHidden(), WasOccluded(). |
| 2355 | Visibility visibility_ = Visibility::VISIBLE; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2356 | |
Francois Doray | e616115 | 2018-03-27 22:05:37 | [diff] [blame] | 2357 | // Whether there has been a call to UpdateWebContentsVisibility(VISIBLE). |
| 2358 | bool did_first_set_visible_ = false; |
tapted | 65ff2ea7 | 2016-03-01 23:39:00 | [diff] [blame] | 2359 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2360 | // Indicates whether we should notify about disconnection of this |
[email protected] | b172aee | 2012-04-10 17:05:26 | [diff] [blame] | 2361 | // WebContentsImpl. This is used to ensure disconnection notifications only |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2362 | // happen if a connection notification has happened and that they happen only |
| 2363 | // once. |
| 2364 | bool notify_disconnection_; |
| 2365 | |
Frank Liberato | e837b36 | 2023-10-20 23:31:15 | [diff] [blame] | 2366 | // Counts the number of outstanding requests to ignore input events. They will |
| 2367 | // not be sent when this is greater than zero. |
| 2368 | int ignore_input_events_count_ = 0; |
Takashi Toyoshima | d72a465a | 2024-03-11 23:37:31 | [diff] [blame] | 2369 | uint64_t next_web_input_event_audit_callback_id_ = 0; |
| 2370 | base::flat_map<uint64_t, WebInputEventAuditCallback> |
| 2371 | web_input_event_audit_callbacks_; |
Avi Drissman | 738ea19 | 2018-08-29 20:24:16 | [diff] [blame] | 2372 | |
Dave Tapuska | 463717e | 2024-11-21 18:42:47 | [diff] [blame] | 2373 | // Whether a dialog has been created since the last cancel of dialogs. |
| 2374 | bool created_dialog_since_last_cancel_ = false; |
[email protected] | 2e5b90c | 2011-08-16 21:11:55 | [diff] [blame] | 2375 | |
avi | 85ee836 | 2016-10-08 02:09:08 | [diff] [blame] | 2376 | // Set to true when there is an active JavaScript dialog showing. |
| 2377 | bool is_showing_javascript_dialog_ = false; |
| 2378 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2379 | // Set to true when there is an active "before unload" dialog. When true, |
| 2380 | // we've forced the throbber to start in Navigate, and we need to remember to |
| 2381 | // turn it off in OnJavaScriptMessageBoxClosed if the navigation is canceled. |
| 2382 | bool is_showing_before_unload_dialog_; |
| 2383 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2384 | // Settings that get passed to the renderer process. |
Mario Sanchez Prada | 0bd8b8c | 2020-10-21 17:49:23 | [diff] [blame] | 2385 | blink::RendererPreferences renderer_preferences_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2386 | |
Olivier ROBIN | da292fb | 2024-08-07 14:32:29 | [diff] [blame] | 2387 | // The time ticks that this WebContents was last made active. The initial |
| 2388 | // value is the WebContents creation time. |
| 2389 | base::TimeTicks last_active_time_ticks_; |
| 2390 | |
[email protected] | 9a89045 | 2014-02-13 22:21:02 | [diff] [blame] | 2391 | // The time that this WebContents was last made active. The initial value is |
| 2392 | // the WebContents creation time. |
Olivier ROBIN | da292fb | 2024-08-07 14:32:29 | [diff] [blame] | 2393 | base::Time last_active_time_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2394 | |
Evan Stade | 6decc97 | 2022-10-24 19:42:18 | [diff] [blame] | 2395 | // The most recent time that this WebContents was interacted with. Currently, |
| 2396 | // this counts: |
| 2397 | // * 'interactive' input events from the user, like mouse clicks and keyboard |
| 2398 | // input but not mouse wheel scrolling |
| 2399 | // * editing commands such as `Paste()`, which are invoked programmatically, |
| 2400 | // presumably in response to user action |
| 2401 | base::TimeTicks last_interaction_time_; |
Daniel Cheng | 90196c8 | 2018-04-25 21:49:14 | [diff] [blame] | 2402 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2403 | // See description above setter. |
| 2404 | bool closed_by_user_gesture_; |
| 2405 | |
Avi Drissman | 1a55a9d6 | 2020-03-10 18:56:45 | [diff] [blame] | 2406 | // The number of active fullscreen blockers. |
| 2407 | int fullscreen_blocker_count_ = 0; |
| 2408 | |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2409 | // Minimum/maximum zoom percent. |
danakj | 30f73313 | 2019-09-20 16:14:14 | [diff] [blame] | 2410 | const int minimum_zoom_percent_; |
| 2411 | const int maximum_zoom_percent_; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2412 | |
w.shackleton | 49bcd39 | 2016-01-06 17:38:22 | [diff] [blame] | 2413 | // Used to correctly handle integer zooming through a smooth scroll device. |
| 2414 | float zoom_scroll_remainder_; |
| 2415 | |
[email protected] | bcd281560 | 2012-01-14 18:17:23 | [diff] [blame] | 2416 | // The intrinsic size of the page. |
| 2417 | gfx::Size preferred_size_; |
| 2418 | |
[email protected] | 222f582 | 2014-02-05 23:40:49 | [diff] [blame] | 2419 | // The preferred size for content screen capture. When |capturer_count_| > 0, |
| 2420 | // this overrides |preferred_size_|. |
| 2421 | gfx::Size preferred_size_for_capture_; |
| 2422 | |
Jianzhou Feng | d8720c7 | 2018-01-18 03:06:30 | [diff] [blame] | 2423 | // When device emulation is enabled, override the size of current and newly |
| 2424 | // created render views/widgets. |
| 2425 | gfx::Size device_emulation_size_; |
| 2426 | gfx::Size view_size_before_emulation_; |
| 2427 | |
Tom Burgin | f0e4862 | 2024-05-16 15:06:12 | [diff] [blame] | 2428 | #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS) |
[email protected] | 8ed1647 | 2014-04-11 19:02:48 | [diff] [blame] | 2429 | // Holds information about a current color chooser dialog, if one is visible. |
Bo Liu | 2bceebc | 2021-06-03 15:06:33 | [diff] [blame] | 2430 | class ColorChooserHolder; |
| 2431 | std::unique_ptr<ColorChooserHolder> color_chooser_holder_; |
Julie Jeongeun Kim | 88ce9ec | 2023-07-28 02:25:40 | [diff] [blame] | 2432 | #endif |
[email protected] | da854376 | 2012-03-20 08:52:20 | [diff] [blame] | 2433 | |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 2434 | // All live RenderWidgetHostImpls that are created by this object and may |
| 2435 | // outlive it. |
Aman Verma | ea1fcd0 | 2024-11-07 20:04:28 | [diff] [blame] | 2436 | base::flat_map<viz::FrameSinkId, |
| 2437 | raw_ptr<RenderWidgetHostImpl, SetExperimental>> |
| 2438 | created_widgets_; |
[email protected] | b24b68a | 2012-09-24 21:57:26 | [diff] [blame] | 2439 | |
alexmos | c9e76ec | 2016-05-16 22:59:37 | [diff] [blame] | 2440 | // Process id of the shown fullscreen widget, or kInvalidUniqueID if there is |
| 2441 | // no fullscreen widget. |
| 2442 | int fullscreen_widget_process_id_; |
| 2443 | |
Tom Sepez | cc69c44 | 2025-07-17 02:00:30 | [diff] [blame] | 2444 | // Routing id of the shown fullscreen widget or IPC::mojom::kRoutingIdNone |
| 2445 | // otherwise. |
[email protected] | 44470a2 | 2013-01-24 01:21:54 | [diff] [blame] | 2446 | int fullscreen_widget_routing_id_; |
| 2447 | |
[email protected] | 0b43199 | 2014-06-24 00:08:03 | [diff] [blame] | 2448 | // At the time the fullscreen widget was being shut down, did it have focus? |
| 2449 | // This is used to restore focus to the WebContentsView after both: 1) the |
| 2450 | // fullscreen widget is destroyed, and 2) the WebContentsDelegate has |
| 2451 | // completed making layout changes to effect an exit from fullscreen mode. |
| 2452 | bool fullscreen_widget_had_focus_at_shutdown_; |
| 2453 | |
mariakhomenko | a4971c1 | 2015-07-21 19:04:37 | [diff] [blame] | 2454 | // When a new tab is created asynchronously, stores the OpenURLParams needed |
| 2455 | // to continue loading the page once the tab is ready. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 2456 | std::unique_ptr<OpenURLParams> delayed_open_url_params_; |
mariakhomenko | a4971c1 | 2015-07-21 19:04:37 | [diff] [blame] | 2457 | |
Nasko Oskov | 83a8cf9 | 2018-10-19 14:58:56 | [diff] [blame] | 2458 | // When a new tab is created with window.open(), navigation can be deferred |
| 2459 | // to execute asynchronously. In such case, the parameters need to be saved |
| 2460 | // for the navigation to be started at a later point. |
| 2461 | std::unique_ptr<NavigationController::LoadURLParams> delayed_load_url_params_; |
HuanPo Lin | 0d795c6 | 2024-03-28 03:54:05 | [diff] [blame] | 2462 | base::OnceCallback<void(content::NavigationHandle&)> |
| 2463 | delayed_navigation_handle_callback_; |
Nasko Oskov | 83a8cf9 | 2018-10-19 14:58:56 | [diff] [blame] | 2464 | |
[email protected] | 34ff1cfc | 2014-08-20 06:16:05 | [diff] [blame] | 2465 | // Whether overscroll should be unconditionally disabled. |
| 2466 | bool force_disable_overscroll_content_; |
[email protected] | e85165c64 | 2014-06-10 14:34:31 | [diff] [blame] | 2467 | |
[email protected] | 87de04b0 | 2014-04-08 22:14:49 | [diff] [blame] | 2468 | // Whether the last JavaScript dialog shown was suppressed. Used for testing. |
| 2469 | bool last_dialog_suppressed_; |
| 2470 | |
Miyoung Shin | 0f4480d | 2019-09-12 01:15:26 | [diff] [blame] | 2471 | mojo::Remote<device::mojom::GeolocationContext> geolocation_context_; |
blundell | c57b93f | 2014-10-29 13:19:57 | [diff] [blame] | 2472 | |
Gyuyoung Kim | 1bc1ba8 | 2021-02-08 23:32:44 | [diff] [blame] | 2473 | mojo::AssociatedRemote<blink::mojom::ContextMenuClient> context_menu_client_; |
| 2474 | |
blundell | e75a8f9 | 2017-03-27 08:11:17 | [diff] [blame] | 2475 | std::unique_ptr<WakeLockContextHost> wake_lock_context_host_; |
Thoren Paulson | d344c0a | 2021-10-14 19:20:31 | [diff] [blame] | 2476 | bool enable_wake_locks_ = true; |
alogvinov | f50445a | 2015-10-30 13:00:12 | [diff] [blame] | 2477 | |
Rakina Zata Amni | 347b7090 | 2020-07-22 10:49:04 | [diff] [blame] | 2478 | // The last set/computed value of WebPreferences for this WebContents, either |
| 2479 | // set directly through SetWebPreferences, or set after recomputing values |
Rakina Zata Amni | 4029b6d | 2020-07-28 02:36:20 | [diff] [blame] | 2480 | // from ComputeWebPreferences. |
Gyuyoung Kim | 1ac4ca78 | 2020-09-11 03:32:51 | [diff] [blame] | 2481 | std::unique_ptr<blink::web_pref::WebPreferences> web_preferences_; |
Rakina Zata Amni | 347b7090 | 2020-07-22 10:49:04 | [diff] [blame] | 2482 | |
Rakina Zata Amni | 4029b6d | 2020-07-28 02:36:20 | [diff] [blame] | 2483 | bool updating_web_preferences_ = false; |
| 2484 | |
Gyuyoung Kim | 9ce9ddda | 2025-06-19 02:01:14 | [diff] [blame] | 2485 | #if BUILDFLAG(IS_ANDROID) || (BUILDFLAG(IS_IOS) && !BUILDFLAG(IS_IOS_TVOS)) |
Reilly Grant | afbe224 | 2020-02-20 21:14:55 | [diff] [blame] | 2486 | std::unique_ptr<NFCHost> nfc_host_; |
| 2487 | #endif |
| 2488 | |
Julie Jeongeun Kim | 8e2879e | 2019-08-06 23:55:20 | [diff] [blame] | 2489 | mojo::ReceiverSet<blink::mojom::ColorChooserFactory> |
| 2490 | color_chooser_factory_receivers_; |
Joel Hockey | 85b379d | 2017-12-11 10:42:13 | [diff] [blame] | 2491 | |
leon.han | e4db177a | 2017-02-07 14:19:16 | [diff] [blame] | 2492 | std::unique_ptr<ScreenOrientationProvider> screen_orientation_provider_; |
[email protected] | 01f83f9 | 2014-06-17 14:41:54 | [diff] [blame] | 2493 | |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 2494 | // The accessibility mode for all frames. This is queried when each frame |
| 2495 | // is created, and broadcast to all frames when it changes. |
Doug Turner | 63f3c7b | 2017-07-29 05:10:01 | [diff] [blame] | 2496 | ui::AXMode accessibility_mode_; |
[email protected] | 9564021 | 2014-07-26 18:14:30 | [diff] [blame] | 2497 | |
Alexander Surkov | 862feee | 2021-01-29 21:27:48 | [diff] [blame] | 2498 | std::unique_ptr<ui::AXEventRecorder> event_recorder_; |
Abigail Klein | aa89874 | 2019-11-01 02:31:25 | [diff] [blame] | 2499 | |
Greg Thompson | f855bf88 | 2024-01-30 10:39:45 | [diff] [blame] | 2500 | // Enables ui::kAXModeBasic for the duration of a recording session. |
| 2501 | std::unique_ptr<ScopedAccessibilityMode> recording_mode_; |
| 2502 | |
avayvod | cc85bbd | 2015-08-28 19:11:15 | [diff] [blame] | 2503 | // Monitors power levels for audio streams associated with this WebContents. |
| 2504 | AudioStreamMonitor audio_stream_monitor_; |
| 2505 | |
Max Morin | 5bc74f5 | 2018-05-09 07:00:21 | [diff] [blame] | 2506 | // Coordinates all the audio streams for this WebContents. Lazily initialized. |
Dave Tapuska | 894bfb4 | 2024-11-04 22:44:35 | [diff] [blame] | 2507 | std::unique_ptr<ForwardingAudioStreamFactory> audio_stream_factory_; |
Max Morin | 5bc74f5 | 2018-05-09 07:00:21 | [diff] [blame] | 2508 | |
Reilly Grant | 5e7c79b2 | 2019-04-09 17:26:20 | [diff] [blame] | 2509 | size_t bluetooth_connected_device_count_ = 0; |
Ovidio Henriquez | 76696f6 | 2020-07-08 03:06:59 | [diff] [blame] | 2510 | size_t bluetooth_scanning_sessions_count_ = 0; |
Reilly Grant | 5e7c79b2 | 2019-04-09 17:26:20 | [diff] [blame] | 2511 | size_t serial_active_frame_count_ = 0; |
Matt Reynolds | e8c6c1f | 2019-11-02 09:53:53 | [diff] [blame] | 2512 | size_t hid_active_frame_count_ = 0; |
Matt Reynolds | ed00ca7e7 | 2022-08-18 20:56:20 | [diff] [blame] | 2513 | size_t usb_active_frame_count_ = 0; |
Yifan Luo | 8e5d3d5 | 2024-10-22 19:18:16 | [diff] [blame] | 2514 | size_t geolocation_active_frame_count_ = 0; |
ortuno | 32e7db3c | 2016-03-29 16:14:20 | [diff] [blame] | 2515 | |
Austin Sullivan | afefb72 | 2021-01-14 01:26:39 | [diff] [blame] | 2516 | size_t file_system_access_handle_count_ = 0; |
Marijn Kruisselbrink | f1714aa2 | 2019-07-02 03:45:33 | [diff] [blame] | 2517 | |
sawtelle | a7333a8 | 2018-05-31 02:36:36 | [diff] [blame] | 2518 | bool has_picture_in_picture_video_ = false; |
Klaus Weidner | d821943 | 2022-02-08 21:50:59 | [diff] [blame] | 2519 | bool has_picture_in_picture_document_ = false; |
sawtelle | a7333a8 | 2018-05-31 02:36:36 | [diff] [blame] | 2520 | |
dalecurtis | 88c24007 | 2015-12-09 02:11:18 | [diff] [blame] | 2521 | // Manages media players, CDMs, and power save blockers for media. |
dcheng | 5971627 | 2016-04-09 05:19:08 | [diff] [blame] | 2522 | std::unique_ptr<MediaWebContentsObserver> media_web_contents_observer_; |
qinmin | 58567c8 | 2015-01-07 21:00:20 | [diff] [blame] | 2523 | |
Aman Verma | df974d4d2 | 2024-09-30 18:12:49 | [diff] [blame] | 2524 | // RenderWidgetHostInputEventRouter is uniquely owned by WebContentsImpl in |
| 2525 | // the browser process. |
| 2526 | scoped_refptr<input::RenderWidgetHostInputEventRouter> |
Kartar Singh | b1bfa1a | 2024-06-24 13:14:57 | [diff] [blame] | 2527 | rwh_input_event_router_; |
kenrb | 2a565f8 | 2015-09-02 20:24:59 | [diff] [blame] | 2528 | |
Aman Verma | 3047aa41 | 2024-05-28 09:09:24 | [diff] [blame] | 2529 | std::unique_ptr<TouchEmulatorImpl> touch_emulator_; |
| 2530 | |
ekaramad | add88229 | 2016-06-08 15:22:56 | [diff] [blame] | 2531 | // TextInputManager tracks the IME-related state for all the |
| 2532 | // RenderWidgetHostViews on this WebContents. Only exists on the outermost |
| 2533 | // WebContents and is automatically destroyed when a WebContents becomes an |
| 2534 | // inner WebContents by attaching to an outer WebContents. Then the |
| 2535 | // IME-related state for RenderWidgetHosts on the inner WebContents is tracked |
| 2536 | // by the TextInputManager in the outer WebContents. |
| 2537 | std::unique_ptr<TextInputManager> text_input_manager_; |
| 2538 | |
David Bokan | e86aa03 | 2022-05-08 18:21:24 | [diff] [blame] | 2539 | // Tests can set this to true in order to force this web contents to always |
| 2540 | // return nullptr for the above `text_input_manager_`, effectively blocking |
| 2541 | // IME events from propagating out of the renderer. |
| 2542 | bool suppress_ime_events_for_testing_ = false; |
| 2543 | |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 2544 | // Stores the RenderWidgetHost that currently holds a mouse lock or nullptr if |
| 2545 | // there's no RenderWidgetHost holding a lock. |
Takumi Fujimoto | 4661871d | 2024-01-25 02:04:18 | [diff] [blame] | 2546 | raw_ptr<RenderWidgetHostImpl, DanglingUntriaged> pointer_lock_widget_ = |
| 2547 | nullptr; |
Joe Downing | 192998b2 | 2018-03-22 15:51:36 | [diff] [blame] | 2548 | |
| 2549 | // Stores the RenderWidgetHost that currently holds a keyboard lock or nullptr |
| 2550 | // if no RenderWidgetHost has the keyboard locked. |
Ali Hijazi | 4d4e2409 | 2022-10-20 22:59:31 | [diff] [blame] | 2551 | raw_ptr<RenderWidgetHostImpl, DanglingUntriaged> keyboard_lock_widget_ = |
| 2552 | nullptr; |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 2553 | |
Joe Downing | 13dd76b | 2018-04-09 18:32:15 | [diff] [blame] | 2554 | // Indicates whether the escape key is one of the requested keys to be locked. |
| 2555 | // This information is used to drive the browser UI so the correct exit |
| 2556 | // instructions are displayed to the user in fullscreen mode. |
| 2557 | bool esc_key_locked_ = false; |
| 2558 | |
Xiaohan Wang | 24ec934 | 2022-01-15 17:34:22 | [diff] [blame] | 2559 | #if BUILDFLAG(IS_ANDROID) |
rockot | 400ea35b | 2016-10-15 19:15:32 | [diff] [blame] | 2560 | std::unique_ptr<service_manager::InterfaceProvider> java_interfaces_; |
sammc | f5f1b0f | 2016-09-20 23:05:11 | [diff] [blame] | 2561 | #endif |
| 2562 | |
qinmin | 72e8bd0 | 2016-10-21 19:35:37 | [diff] [blame] | 2563 | // Whether this WebContents is for content overlay. |
| 2564 | bool is_overlay_content_; |
| 2565 | |
ekaramad | f6750aa | 2017-06-06 18:29:42 | [diff] [blame] | 2566 | bool showing_context_menu_; |
| 2567 | |
Mounir Lamouri | 0f5bdf5 | 2019-04-04 16:32:35 | [diff] [blame] | 2568 | base::flat_map<MediaPlayerId, gfx::Size> cached_video_sizes_; |
billorr | 21c005d | 2016-11-17 03:57:04 | [diff] [blame] | 2569 | |
mlamouri | 5cd9ae8 | 2017-02-18 11:05:09 | [diff] [blame] | 2570 | bool has_persistent_video_ = false; |
| 2571 | |
Ian Vollick | 5d5c37f | 2019-06-19 22:50:57 | [diff] [blame] | 2572 | bool is_spatial_navigation_disabled_ = false; |
| 2573 | |
Jinsuk Kim | c8eac44 | 2024-07-19 18:33:52 | [diff] [blame] | 2574 | #if BUILDFLAG(IS_ANDROID) |
Yaroslav Shalivskyy | d76a81f4 | 2024-10-21 20:08:20 | [diff] [blame] | 2575 | bool stylus_handwriting_enabled_ = false; |
Jinsuk Kim | c8eac44 | 2024-07-19 18:33:52 | [diff] [blame] | 2576 | bool long_press_link_select_text_ = false; |
| 2577 | #endif |
| 2578 | |
Chris Hamilton | df0d72cd | 2018-05-29 16:23:53 | [diff] [blame] | 2579 | bool is_currently_audible_ = false; |
Tommy Steimel | 1836051 | 2017-11-01 00:38:19 | [diff] [blame] | 2580 | bool was_ever_audible_ = false; |
| 2581 | |
Lukasz Anforowicz | fd70714 | 2018-02-07 19:46:13 | [diff] [blame] | 2582 | // Helper variable for resolving races in UpdateTargetURL / ClearTargetURL. |
Ali Hijazi | 4d4e2409 | 2022-10-20 22:59:31 | [diff] [blame] | 2583 | raw_ptr<RenderFrameHost, DanglingUntriaged> frame_that_set_last_target_url_ = |
| 2584 | nullptr; |
Lukasz Anforowicz | fd70714 | 2018-02-07 19:46:13 | [diff] [blame] | 2585 | |
Changwan Ryu | c1134a8 | 2018-03-07 02:10:14 | [diff] [blame] | 2586 | // Whether we should override user agent in new tabs. |
| 2587 | bool should_override_user_agent_in_new_tabs_ = false; |
| 2588 | |
Becca Hughes | 6fe54e43 | 2018-06-09 04:18:56 | [diff] [blame] | 2589 | // Gets notified about changes in viewport fit events. |
Donn Denman | a6d9183 | 2023-11-28 21:25:46 | [diff] [blame] | 2590 | std::unique_ptr<SafeAreaInsetsHost> safe_area_insets_host_; |
Becca Hughes | 6fe54e43 | 2018-06-09 04:18:56 | [diff] [blame] | 2591 | |
Arthur Sonzogni | 929d29f | 2018-09-17 14:19:44 | [diff] [blame] | 2592 | // Stores a set of frames that are fullscreen. |
| 2593 | // See https://fullscreen.spec.whatwg.org. |
Ali Hijazi | 133b2d9 | 2024-02-09 14:01:52 | [diff] [blame] | 2594 | std::set<raw_ptr<RenderFrameHostImpl, SetExperimental>> fullscreen_frames_; |
Becca Hughes | fd5d8f89 | 2018-06-14 18:23:36 | [diff] [blame] | 2595 | |
Charlie Reis | 207e93c | 2023-10-04 23:48:49 | [diff] [blame] | 2596 | // Store an ID for the frame that is currently fullscreen, or an invalid ID if |
| 2597 | // there is none. |
| 2598 | GlobalRenderFrameHostId current_fullscreen_frame_id_ = |
| 2599 | GlobalRenderFrameHostId(); |
Becca Hughes | fd5d8f89 | 2018-06-14 18:23:36 | [diff] [blame] | 2600 | |
Xiyuan Xia | 2a66b11 | 2018-12-06 15:52:16 | [diff] [blame] | 2601 | // Whether location bar should be focused by default. This is computed in |
| 2602 | // DidStartNavigation/DidFinishNavigation and only set for an initial |
| 2603 | // navigation triggered by the browser going to about:blank. |
| 2604 | bool should_focus_location_bar_by_default_ = false; |
| 2605 | |
Mike Jackson | f116a2e | 2021-06-09 16:48:30 | [diff] [blame] | 2606 | // Stores the rect of the Windows Control Overlay, which contains system UX |
| 2607 | // affordances (e.g. close), for installed desktop Progress Web Apps (PWAs), |
| 2608 | // if the app specifies the 'window-controls-overlay' DisplayMode in its |
| 2609 | // manifest. This is in frame space coordinates. |
| 2610 | gfx::Rect window_controls_overlay_rect_; |
| 2611 | |
Sam Davis Omekara | db307cf | 2024-03-05 00:15:41 | [diff] [blame] | 2612 | // Observe native theme for changes to dark mode, forced_colors, preferred |
| 2613 | // color scheme, and preferred contrast. Used to notify the renderer of |
| 2614 | // preferred color scheme and preferred contrast changes. |
Sigurdur Asgeirsson | 103e2fb | 2020-11-10 00:50:16 | [diff] [blame] | 2615 | base::ScopedObservation<ui::NativeTheme, ui::NativeThemeObserver> |
| 2616 | native_theme_observation_{this}; |
Alison Maher | 7f366dc6 | 2020-03-03 19:46:00 | [diff] [blame] | 2617 | |
Shintaro Kawamura | 1042d57 | 2024-09-30 13:52:22 | [diff] [blame] | 2618 | base::ScopedObservation<SlowWebPreferenceCache, |
| 2619 | SlowWebPreferenceCacheObserver> |
| 2620 | slow_web_preference_cache_observation_{this}; |
| 2621 | |
Alison Maher | 7f366dc6 | 2020-03-03 19:46:00 | [diff] [blame] | 2622 | bool using_dark_colors_ = false; |
Sam Davis Omekara | db307cf | 2024-03-05 00:15:41 | [diff] [blame] | 2623 | bool in_forced_colors_ = false; |
Alison Maher | 7f366dc6 | 2020-03-03 19:46:00 | [diff] [blame] | 2624 | ui::NativeTheme::PreferredColorScheme preferred_color_scheme_ = |
Alison Maher | 60ddf6f | 2020-06-12 17:30:28 | [diff] [blame] | 2625 | ui::NativeTheme::PreferredColorScheme::kLight; |
Alison Maher | 3b11e94 | 2020-10-27 17:17:50 | [diff] [blame] | 2626 | ui::NativeTheme::PreferredContrast preferred_contrast_ = |
| 2627 | ui::NativeTheme::PreferredContrast::kNoPreference; |
Luke Warlow | a995293 | 2023-07-18 01:38:14 | [diff] [blame] | 2628 | bool prefers_reduced_transparency_ = false; |
Luke Warlow | a93b1ca | 2023-08-04 10:08:25 | [diff] [blame] | 2629 | bool inverted_colors_ = false; |
Alison Maher | 7f366dc6 | 2020-03-03 19:46:00 | [diff] [blame] | 2630 | |
David Bokan | 1bdb3701f | 2021-04-30 22:02:35 | [diff] [blame] | 2631 | // Tracks clients who want to be notified when a JavaScript dialog is |
| 2632 | // dismissed. |
| 2633 | std::unique_ptr<JavaScriptDialogDismissNotifier> |
| 2634 | javascript_dialog_dismiss_notifier_; |
Charlie Reis | 9607736 | 2019-07-04 00:34:04 | [diff] [blame] | 2635 | |
yilkal | 172da77 | 2019-11-06 22:49:07 | [diff] [blame] | 2636 | // The max number of loaded frames that have been seen in this WebContents. |
| 2637 | // This number is reset with each main frame navigation. |
| 2638 | size_t max_loaded_frame_count_ = 0; |
yilkal | 796e89e | 2019-10-02 23:58:28 | [diff] [blame] | 2639 | |
yilkal | 172da77 | 2019-11-06 22:49:07 | [diff] [blame] | 2640 | // This boolean value is used to keep track of whether we finished the first |
Khushal | 97d31e8 | 2021-06-23 21:07:54 | [diff] [blame] | 2641 | // successful navigation in this WebContents's primary main frame. |
| 2642 | bool first_primary_navigation_completed_ = false; |
yilkal | 796e89e | 2019-10-02 23:58:28 | [diff] [blame] | 2643 | |
Mike Wasserman | b213b935 | 2020-04-16 00:32:34 | [diff] [blame] | 2644 | // Monitors system screen info changes to notify the renderer. |
| 2645 | std::unique_ptr<ScreenChangeMonitor> screen_change_monitor_; |
| 2646 | |
Mike Wasserman | db8f4f0 | 2020-10-06 01:18:37 | [diff] [blame] | 2647 | // Records the last time we saw a screen orientation change. |
Lan Wei | f81c6e7c | 2020-02-12 16:46:09 | [diff] [blame] | 2648 | base::TimeTicks last_screen_orientation_change_time_; |
| 2649 | |
Dominique Fauteux-Chapleau | 9924438 | 2020-07-08 20:37:00 | [diff] [blame] | 2650 | // Indicates how many sources are currently suppressing the unresponsive |
| 2651 | // renderer dialog. |
| 2652 | int suppress_unresponsive_renderer_count_ = 0; |
| 2653 | |
Aman Verma | 2e89724 | 2025-01-14 12:08:26 | [diff] [blame] | 2654 | // Stores the force enable zoom state for Accessibility. |
| 2655 | bool force_enable_zoom_ = false; |
| 2656 | |
Hiroki Nakagawa | 9bc09f2 | 2021-04-23 09:48:55 | [diff] [blame] | 2657 | std::unique_ptr<PrerenderHostRegistry> prerender_host_registry_; |
Hiroki Nakagawa | 1cb1455 | 2021-04-23 03:37:34 | [diff] [blame] | 2658 | |
Kevin McNee | 097680d | 2023-04-05 22:14:51 | [diff] [blame] | 2659 | // Used to ignore multiple back navigation hints in rapid succession. For |
| 2660 | // example, we may get multiple hints due to imprecise mouse movement while |
| 2661 | // the user is trying to move the mouse to the back button. |
| 2662 | base::TimeTicks last_back_navigation_hint_time_ = base::TimeTicks::Min(); |
| 2663 | |
Alexander Cooper | 987d046cc | 2021-04-14 00:07:21 | [diff] [blame] | 2664 | viz::FrameSinkId xr_render_target_; |
| 2665 | |
Elad Alon | f156eb6 | 2021-05-17 22:02:37 | [diff] [blame] | 2666 | // Allows the app in the current WebContents to opt-in to exposing |
| 2667 | // information to apps that capture it. |
| 2668 | blink::mojom::CaptureHandleConfig capture_handle_config_; |
| 2669 | |
Bo Liu | b5e79d9 | 2021-06-12 01:40:41 | [diff] [blame] | 2670 | // Background color of the page set by the embedder to be passed to all |
| 2671 | // renderers attached to this WebContents, for use in the main frame. |
| 2672 | // It is used when the page has not loaded enough to know a background |
| 2673 | // color or if the page does not set a background color. |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 2674 | std::optional<SkColor> page_base_background_color_; |
Bo Liu | b5e79d9 | 2021-06-12 01:40:41 | [diff] [blame] | 2675 | |
Nicolas Ouellet-Payeur | 177a6c4 | 2023-01-25 20:25:07 | [diff] [blame] | 2676 | // Stores WebContents::CreateParams::creator_location. |
Lukasz Anforowicz | 2c1573a | 2021-09-21 18:58:18 | [diff] [blame] | 2677 | base::Location creator_location_; |
| 2678 | |
Nicolas Ouellet-Payeur | 177a6c4 | 2023-01-25 20:25:07 | [diff] [blame] | 2679 | #if BUILDFLAG(IS_ANDROID) |
| 2680 | // Stores WebContents::CreateParams::java_creator_location. |
| 2681 | base::android::ScopedJavaGlobalRef<jthrowable> java_creator_location_; |
| 2682 | #endif // BUILDFLAG(IS_ANDROID) |
| 2683 | |
Tommy Steimel | 57eafde | 2023-01-27 17:33:24 | [diff] [blame] | 2684 | // The options used for WebContents associated with a PictureInPicture window. |
| 2685 | // This value is the parameter given in |
| 2686 | // WebContents::CreateParams::picture_in_picture_options. |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 2687 | std::optional<blink::mojom::PictureInPictureWindowOptions> |
Tommy Steimel | 57eafde | 2023-01-27 17:33:24 | [diff] [blame] | 2688 | picture_in_picture_options_; |
Tommy Steimel | 991916c4 | 2022-06-24 20:59:57 | [diff] [blame] | 2689 | |
Tommy Steimel | 71f15446 | 2024-05-22 19:05:07 | [diff] [blame] | 2690 | // Only set if this WebContents represents a document picture-in-picture |
| 2691 | // window. This points to the WebContents that originally opened this |
| 2692 | // WebContents. |
| 2693 | base::WeakPtr<WebContents> picture_in_picture_opener_; |
| 2694 | |
Joe Mason | 1fc3e2e | 2021-11-02 05:25:07 | [diff] [blame] | 2695 | VisibleTimeRequestTrigger visible_time_request_trigger_; |
| 2696 | |
Andy Paicu | 5608bda8 | 2023-03-03 15:09:20 | [diff] [blame] | 2697 | // Counts the number of open scopes that disallow custom cursors in this web |
| 2698 | // contents. Custom cursors are allowed if this is 0. |
| 2699 | int disallow_custom_cursor_scope_count_ = 0; |
| 2700 | |
Bo Liu | 3afe258 | 2023-08-11 23:02:56 | [diff] [blame] | 2701 | base::WeakPtr<FileChooserImpl> active_file_chooser_; |
| 2702 | |
Arthur Sonzogni | c686e8f | 2024-01-11 08:36:37 | [diff] [blame] | 2703 | std::optional<base::Location> ownership_location_; |
Bo Liu | d4ced69 | 2023-09-18 21:17:14 | [diff] [blame] | 2704 | |
Aman Verma | df974d4d2 | 2024-09-30 18:12:49 | [diff] [blame] | 2705 | // This id is used by Viz to create RenderWidgetHostInputEventRouter per |
| 2706 | // WebContents(concept in browser) to allow grouping CompositorFrameSinks for |
| 2707 | // input event routing with InputVizard. |
Aman Verma | 7908f956 | 2024-12-13 18:45:48 | [diff] [blame] | 2708 | const base::UnguessableToken compositor_frame_sink_grouping_id_; |
Aman Verma | df974d4d2 | 2024-09-30 18:12:49 | [diff] [blame] | 2709 | |
Takashi Toyoshima | 8dfc05c | 2024-01-29 21:03:51 | [diff] [blame] | 2710 | // Indicates if the instance is hosted in a preview window. |
| 2711 | // This will be set in Init() and will be reset in WillActivatePreviewPage(). |
| 2712 | bool is_in_preview_mode_ = false; |
| 2713 | |
David Tseng | c3853d0b0 | 2024-02-15 16:35:10 | [diff] [blame] | 2714 | // Indicates accessibility had an unrecoverable error. |
Aaron Leventhal | 6ceb588 | 2024-04-17 15:19:38 | [diff] [blame] | 2715 | bool unrecoverable_accessibility_error_ = false; |
David Tseng | c3853d0b0 | 2024-02-15 16:35:10 | [diff] [blame] | 2716 | |
Xiao Ma | 29b2d1e6 | 2024-06-13 06:17:09 | [diff] [blame] | 2717 | // The network handle bound to the target network, is used to handle the |
| 2718 | // loading requests over a specific network. The network handle is set when |
| 2719 | // WebContents is created and will not change during the life cycle of |
| 2720 | // WebContents. |
Jacob Francis | 0043f24 | 2024-07-24 21:46:21 | [diff] [blame] | 2721 | net::handles::NetworkHandle target_network_ = |
| 2722 | net::handles::kInvalidNetworkHandle; |
Xiao Ma | 29b2d1e6 | 2024-06-13 06:17:09 | [diff] [blame] | 2723 | |
Ari Chivukula | 41f7bfc9 | 2024-07-17 18:16:01 | [diff] [blame] | 2724 | // Whether this contents represents a window initially opened as a new popup. |
| 2725 | bool is_popup_{false}; |
| 2726 | |
Fabio Muratori | 8ff2689 | 2025-05-06 19:07:21 | [diff] [blame] | 2727 | // The window open disposition that was originally requested |
| 2728 | // when this WebContents was created. |
| 2729 | WindowOpenDisposition original_window_open_disposition_ = |
| 2730 | WindowOpenDisposition::UNKNOWN; |
| 2731 | |
Ari Chivukula | 2d8d5e0 | 2024-11-04 20:09:57 | [diff] [blame] | 2732 | // If this window was opened as a new partitioned popin this will contain the |
| 2733 | // properties needed to setup partitioning which aligns with the opener. |
| 2734 | // See https://explainers-by-googlers.github.io/partitioned-popins/ |
| 2735 | std::optional<PartitionedPopinOpenerProperties> |
| 2736 | partitioned_popin_opener_properties_; |
| 2737 | |
Ari Chivukula | e22828e | 2024-08-17 02:44:06 | [diff] [blame] | 2738 | // If this window was opened as a new partitioned popin this will be the |
Giovanni Ortuno Urquidi | 94e37f69 | 2024-10-31 06:25:15 | [diff] [blame] | 2739 | // frame of the opener. This will only have a value if `is_popup_` is true. |
| 2740 | // If the opener frame is deleted the popin should be closed by |
Ari Chivukula | 2d8d5e0 | 2024-11-04 20:09:57 | [diff] [blame] | 2741 | // `PartitionedPopinsController`. This is not a good indicator of whether this |
| 2742 | // window is a popin as it may go away before the popin closes. |
Ari Chivukula | e22828e | 2024-08-17 02:44:06 | [diff] [blame] | 2743 | // See https://explainers-by-googlers.github.io/partitioned-popins/ |
| 2744 | base::WeakPtr<RenderFrameHostImpl> partitioned_popin_opener_; |
Ari Chivukula | 9390bf1 | 2024-08-14 18:08:01 | [diff] [blame] | 2745 | |
Ari Chivukula | ee50305 | 2024-08-30 20:33:53 | [diff] [blame] | 2746 | // Each window can have at most one open partitioned popin, and this will be a |
| 2747 | // pointer to it. If this is set `partitioned_popin_opener_` must be null as |
| 2748 | // no popin can open a popin. |
| 2749 | // See https://explainers-by-googlers.github.io/partitioned-popins/ |
Ari Chivukula | ee50305 | 2024-08-30 20:33:53 | [diff] [blame] | 2750 | base::WeakPtr<WebContents> opened_partitioned_popin_; |
| 2751 | |
Andrew Verge | 146fe63 | 2025-07-08 14:12:11 | [diff] [blame] | 2752 | // Tracks the number of same-site fenced frames in the viewport per top-level |
| 2753 | // page load and stores it in the primary main frame's PageUserData. Metrics |
| 2754 | // are logged via UMA every time the PageUserData is destroyed. |
| 2755 | std::unique_ptr<FencedFrameViewportObserver> fenced_frame_viewport_observer_; |
| 2756 | |
Aldo Culquicondor | 88fe396 | 2025-01-21 16:04:26 | [diff] [blame] | 2757 | #if BUILDFLAG(IS_ANDROID) |
| 2758 | bool supports_forward_transition_animation_ = true; |
| 2759 | #endif // !BUILDFLAG(IS_ANDROID) |
| 2760 | |
Jeremy Roman | 3bca4bf | 2019-07-11 03:41:25 | [diff] [blame] | 2761 | base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_{this}; |
| 2762 | base::WeakPtrFactory<WebContentsImpl> weak_factory_{this}; |
[email protected] | 0dd3a0ab | 2011-02-18 08:17:44 | [diff] [blame] | 2763 | }; |
| 2764 | |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 2765 | // Dangerous methods which should never be made part of the public API, so we |
| 2766 | // grant their use only to an explicit friend list (c++ attorney/client idiom). |
benwells | 5e7260d | 2017-03-20 23:36:33 | [diff] [blame] | 2767 | class CONTENT_EXPORT WebContentsImpl::FriendWrapper { |
Avi Drissman | a911482 | 2018-03-23 18:25:55 | [diff] [blame] | 2768 | public: |
| 2769 | using CreatedCallback = base::RepeatingCallback<void(WebContents*)>; |
| 2770 | |
Peter Boström | 9b03653 | 2021-10-28 23:37:28 | [diff] [blame] | 2771 | FriendWrapper(const FriendWrapper&) = delete; |
| 2772 | FriendWrapper& operator=(const FriendWrapper&) = delete; |
| 2773 | |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 2774 | private: |
Elly Fong-Jones | 564de626 | 2022-07-28 21:11:16 | [diff] [blame] | 2775 | friend base::CallbackListSubscription RegisterWebContentsCreationCallback( |
| 2776 | base::RepeatingCallback<void(WebContents*)>); |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 2777 | |
benwells | 5e7260d | 2017-03-20 23:36:33 | [diff] [blame] | 2778 | FriendWrapper(); // Not instantiable. |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 2779 | |
Elly Fong-Jones | 564de626 | 2022-07-28 21:11:16 | [diff] [blame] | 2780 | // Adds a callback called on creation of each new WebContents. |
| 2781 | static base::CallbackListSubscription AddCreatedCallbackForTesting( |
| 2782 | const CreatedCallback& callback); |
nick | f9acfbe | 2014-12-23 19:12:37 | [diff] [blame] | 2783 | }; |
| 2784 | |
[email protected] | 8ff00d7 | 2012-10-23 19:12:21 | [diff] [blame] | 2785 | } // namespace content |
| 2786 | |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 2787 | #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ |