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