chromium/content/browser/web_contents/web_contents_impl.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "content/browser/web_contents/web_contents_impl.h"

#include <stddef.h>

#include <cmath>
#include <memory>
#include <optional>
#include <set>
#include <string>
#include <string_view>
#include <tuple>
#include <utility>
#include <vector>

#include "base/base_switches.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/flat_set.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/metrics/user_metrics.h"
#include "base/no_destructor.h"
#include "base/observer_list.h"
#include "base/process/process.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/to_string.h"
#include "base/system/sys_info.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "base/trace_event/optional_trace_event.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "cc/input/browser_controls_offset_tags_info.h"
#include "components/attribution_reporting/features.h"
#include "components/download/public/common/download_stats.h"
#include "components/input/cursor_manager.h"
#include "components/input/render_widget_host_input_event_router.h"
#include "components/url_formatter/url_formatter.h"
#include "components/viz/common/features.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "content/browser/accessibility/browser_accessibility_state_impl.h"
#include "content/browser/attribution_reporting/attribution_host.h"
#include "content/browser/attribution_reporting/attribution_manager.h"
#include "content/browser/attribution_reporting/attribution_os_level_manager.h"
#include "content/browser/bad_message.h"
#include "content/browser/browser_context_impl.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/browser_plugin/browser_plugin_embedder.h"
#include "content/browser/browser_plugin/browser_plugin_guest.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/closewatcher/close_listener_manager.h"
#include "content/browser/compositor/surface_utils.h"
#include "content/browser/device_posture/device_posture_provider_impl.h"
#include "content/browser/devtools/protocol/page_handler.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/display_cutout/display_cutout_host_impl.h"
#include "content/browser/dom_storage/dom_storage_context_wrapper.h"
#include "content/browser/dom_storage/session_storage_namespace_impl.h"
#include "content/browser/download/mhtml_generation_manager.h"
#include "content/browser/download/save_package.h"
#include "content/browser/fenced_frame/fenced_frame.h"
#include "content/browser/find_request_manager.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/host_zoom_map_impl.h"
#include "content/browser/media/audio_stream_monitor.h"
#include "content/browser/media/media_web_contents_observer.h"
#include "content/browser/permissions/permission_controller_impl.h"
#include "content/browser/permissions/permission_util.h"
#include "content/browser/preloading/prefetch/prefetch_service.h"
#include "content/browser/preloading/preloading.h"
#include "content/browser/preloading/prerender/prerender_final_status.h"
#include "content/browser/preloading/prerender/prerender_host_registry.h"
#include "content/browser/preloading/prerender/prerender_metrics.h"
#include "content/browser/preloading/prerender/prerender_new_tab_handle.h"
#include "content/browser/renderer_host/agent_scheduling_group_host.h"
#include "content/browser/renderer_host/cross_process_frame_connector.h"
#include "content/browser/renderer_host/frame_token_message_queue.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/input/touch_emulator_impl.h"
#include "content/browser/renderer_host/media/media_stream_manager.h"
#include "content/browser/renderer_host/navigation_entry_impl.h"
#include "content/browser/renderer_host/navigation_request.h"
#include "content/browser/renderer_host/page_impl.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_frame_proxy_host.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/browser/renderer_host/render_view_host_delegate_view.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_factory.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/renderer_host/spare_render_process_host_manager.h"
#include "content/browser/renderer_host/text_input_manager.h"
#include "content/browser/renderer_host/visible_time_request_trigger.h"
#include "content/browser/screen_details/screen_change_monitor.h"
#include "content/browser/screen_orientation/screen_orientation_provider.h"
#include "content/browser/shared_storage/shared_storage_budget_charger.h"
#include "content/browser/site_instance_impl.h"
#include "content/browser/wake_lock/wake_lock_context_host.h"
#include "content/browser/web_contents/java_script_dialog_commit_deferring_condition.h"
#include "content/browser/web_contents/web_contents_view.h"
#include "content/browser/web_contents/web_contents_view_child_frame.h"
#include "content/browser/webui/web_ui_controller_factory_registry.h"
#include "content/browser/webui/web_ui_impl.h"
#include "content/common/content_switches_internal.h"
#include "content/common/features.h"
#include "content/public/browser/ax_inspect_factory.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_plugin_guest_manager.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/color_chooser.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/context_menu_params.h"
#include "content/public/browser/device_service.h"
#include "content/public/browser/disallow_activation_reason.h"
#include "content/public/browser/download_manager.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/focused_node_details.h"
#include "content/public/browser/frame_type.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/invalidate_type.h"
#include "content/public/browser/javascript_dialog_manager.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/preview_cancel_reason.h"
#include "content/public/browser/render_widget_host_iterator.h"
#include "content/public/browser/render_widget_host_observer.h"
#include "content/public/browser/restore_type.h"
#include "content/public/browser/scoped_accessibility_mode.h"
#include "content/public/browser/site_isolation_policy.h"
#include "content/public/browser/ssl_status.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents_view_delegate.h"
#include "content/public/browser/web_ui_controller.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_features.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/referrer_type_converters.h"
#include "content/public/common/url_constants.h"
#include "media/base/media_switches.h"
#include "media/base/user_input_monitor.h"
#include "net/base/url_util.h"
#include "net/http/http_util.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "partition_alloc/buildflags.h"
#include "ppapi/buildflags/buildflags.h"
#include "services/device/public/mojom/wake_lock.mojom.h"
#include "services/network/public/cpp/request_destination.h"
#include "services/network/public/cpp/web_sandbox_flags.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#include "third_party/blink/public/common/custom_handlers/protocol_handler_utils.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/common/loader/resource_type_util.h"
#include "third_party/blink/public/common/mime_util/mime_util.h"
#include "third_party/blink/public/common/page/page_zoom.h"
#include "third_party/blink/public/common/page_state/page_state.h"
#include "third_party/blink/public/common/permissions/permission_utils.h"
#include "third_party/blink/public/common/security/protocol_handler_security_level.h"
#include "third_party/blink/public/common/switches.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/common/widget/constants.h"
#include "third_party/blink/public/mojom/frame/frame.mojom.h"
#include "third_party/blink/public/mojom/frame/fullscreen.mojom.h"
#include "third_party/blink/public/mojom/image_downloader/image_downloader.mojom.h"
#include "third_party/blink/public/mojom/input/input_handler.mojom-shared.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom-shared.h"
#include "third_party/blink/public/mojom/mediastream/media_stream.mojom.h"
#include "third_party/blink/public/mojom/page/draggable_region.mojom.h"
#include "third_party/blink/public/mojom/window_features/window_features.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/accessibility/ax_tree_combiner.h"
#include "ui/accessibility/platform/browser_accessibility.h"
#include "ui/base/ime/mojom/virtual_keyboard_types.mojom.h"
#include "ui/base/pointer/pointer_device.h"
#include "ui/base/ui_base_types.h"
#include "ui/base/window_open_disposition.h"
#include "ui/color/color_provider_key.h"
#include "ui/color/color_provider_manager.h"
#include "ui/color/color_provider_utils.h"
#include "ui/compositor/compositor.h"
#include "ui/display/screen.h"
#include "ui/display/types/display_constants.h"
#include "ui/events/base_event_utils.h"
#include "ui/gfx/animation/animation.h"

#if BUILDFLAG(IS_WIN)
#include "base/threading/thread_restrictions.h"
#include "content/browser/renderer_host/dip_util.h"
#include "ui/gfx/geometry/dip_util.h"
#endif

#if BUILDFLAG(IS_ANDROID)
#include "content/browser/android/java_interfaces_impl.h"
#include "content/browser/android/nfc_host.h"
#include "content/browser/navigation_transitions/back_forward_transition_animation_manager_android.h"
#include "content/browser/web_contents/web_contents_android.h"
#include "content/browser/web_contents/web_contents_view_android.h"
#include "services/device/public/mojom/nfc.mojom.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "ui/android/view_android.h"
#include "ui/base/device_form_factor.h"
#endif  // BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
#include "content/browser/date_time_chooser/date_time_chooser.h"
#endif

#if BUILDFLAG(ENABLE_PPAPI)
#include "content/browser/media/session/pepper_playback_observer.h"
#endif

#if BUILDFLAG(ENABLE_VR)
#include "content/browser/xr/service/xr_runtime_manager_impl.h"
#endif

#if defined(USE_AURA)
#include "ui/aura/window.h"
#include "ui/wm/core/window_util.h"
#endif

#if !BUILDFLAG(IS_ANDROID)
#include "content/public/browser/document_picture_in_picture_window_controller.h"
#include "content/public/browser/picture_in_picture_window_controller.h"
#endif  // !BUILDFLAG(IS_ANDROID)

namespace content {

namespace {

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class AllPointerTypes {};

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class PrimaryPointerType {};

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
//
// LINT.IfChange(CrashRepHandlingOutcome)
enum class CrashRepHandlingOutcome {};
// LINT.ThenChange(//tools/metrics/histograms/enums.xml:CrashRepHandlingOutcome)

// The window which we dobounce load info updates in.
constexpr auto kUpdateLoadStatesInterval =;

// Kill switch for crash immediately on dangling BrowserContext.
BASE_FEATURE();

// Kill switch for inner WebContents visibility updates.
BASE_FEATURE();

LifecycleState;
LifecycleStateImpl;
AttributionReportingOsRegistrar;

base::LazyInstance<base::RepeatingCallbackList<void(WebContents*)>>::
    DestructorAtExit g_created_callbacks =;

bool HasMatchingWidgetHost(FrameTree* tree, RenderWidgetHostImpl* host) {}

RenderFrameHostImpl* FindOpenerRFH(const WebContents::CreateParams& params) {}

// Returns |true| if |type| is the kind of user input that should trigger the
// user interaction observers.
bool IsUserInteractionInputType(blink::WebInputEvent::Type type) {}

// Ensures that OnDialogClosed is only called once.
class CloseDialogCallbackWrapper
    : public base::RefCountedThreadSafe<CloseDialogCallbackWrapper> {};

bool FrameCompareDepth(RenderFrameHostImpl* a, RenderFrameHostImpl* b) {}

bool AreValidRegisterProtocolHandlerArguments(
    const std::string& protocol,
    const GURL& url,
    const url::Origin& origin,
    blink::ProtocolHandlerSecurityLevel security_level) {}

void RecordMaxFrameCountUMA(size_t max_frame_count) {}

// Returns the set of all WebContentses that are reachable from |web_contents|
// by applying some combination of
// WebContents::GetFirstWebContentsInLiveOriginalOpenerChain() and
// WebContents::GetOuterWebContents(). The |web_contents| parameter will be
// included in the returned set.
base::flat_set<WebContentsImpl*> GetAllOpeningWebContents(
    WebContentsImpl* web_contents) {}

#if BUILDFLAG(IS_ANDROID)
float GetDeviceScaleAdjustment(int min_width) {
  static const float kMinFSM = 1.05f;
  static const int kWidthForMinFSM = 320;
  static const float kMaxFSM = 1.3f;
  static const int kWidthForMaxFSM = 800;

  if (min_width <= kWidthForMinFSM) {
    return kMinFSM;
  }
  if (min_width >= kWidthForMaxFSM) {
    return kMaxFSM;
  }

  // The font scale multiplier varies linearly between kMinFSM and kMaxFSM.
  float ratio = static_cast<float>(min_width - kWidthForMinFSM) /
                (kWidthForMaxFSM - kWidthForMinFSM);
  return ratio * (kMaxFSM - kMinFSM) + kMinFSM;
}
#endif

// Store a set of fullscreen WebContents and metadata for the browser context.
// Storing this information on the browser context is done for two reasons. One,
// related WebContentses must necessarily share a browser context, so this saves
// lookup time by restricting to one specific browser context. Two, separating
// by browser context is preemptive paranoia about keeping things separate.
class FullscreenUserData : public base::SupportsUserData::Data {};

const char kFullscreenUserData[] =;

FullscreenUserData* GetFullscreenUserData(BrowserContext* browser_context) {}

base::flat_set<raw_ptr<WebContentsImpl, CtnExperimental>>*
FullscreenContentsSet(BrowserContext* browser_context) {}

// Returns true if `host` has the Window Management permission granted.
bool IsWindowManagementGranted(RenderFrameHost* host) {}

// Returns true if `host` has the Automatic Fullscreen permission granted.
bool IsAutomaticFullscreenGranted(RenderFrameHost* host) {}

// Adjust the requested `rect` for opening or placing a window and return the id
// of the display where the window will be placed. The bounds may not extend
// outside a single screen's work area, and the `host` requires permission to
// specify bounds on a screen other than its current screen.
// TODO(crbug.com/40092782): These adjustments are inaccurate for window.open(),
// which specifies the inner content size, and for window.moveTo, resizeTo, etc.
// calls on newly created windows, which may pass empty sizes or positions to
// indicate uninitialized placement information in the renderer. Constraints
// enforced later should resolve most inaccuracies, but this early enforcement
// is needed to ensure bounds indicate the appropriate display.
int64_t AdjustWindowRectForDisplay(gfx::Rect* rect, RenderFrameHost* host) {}

// Adjusts the bounds to the minimum window size provided. Defaults to
// `blink::kMinimumWindowSize` but can be overridden, e.g. for borderless apps.
void AdjustWindowRectForMinimum(gfx::Rect* bounds,
                                int minimum_size = blink::kMinimumWindowSize) {}

// A ColorProviderSource used when one has not been explicitly set. This source
// only reflects theme information present in the web NativeTheme singleton.
// Keep this an implementation detail of WebContentsImpl as we should not be
// exposing a default ColorProviderSource generally.
class DefaultColorProviderSource : public ui::ColorProviderSource,
                                   public ui::NativeThemeObserver {};

size_t GetFrameTreeSize(FrameTree* frame_tree) {}

RenderWidgetHostAtPointCallback;

void RunCallback(RenderWidgetHostAtPointCallback callback,
                 base::WeakPtr<input::RenderWidgetHostViewInput> view,
                 std::optional<gfx::PointF> point) {}

}  // namespace

// This is a small helper class created while a JavaScript dialog is showing
// and destroyed when it's dismissed. Clients can register callbacks to receive
// a notification when the dialog is dismissed.
class JavaScriptDialogDismissNotifier {};

CreatedWindow::CreatedWindow() = default;
CreatedWindow::CreatedWindow(std::unique_ptr<WebContentsImpl> contents,
                             GURL target_url)
    :{}
CreatedWindow::~CreatedWindow() = default;
CreatedWindow::CreatedWindow(CreatedWindow&&) = default;
CreatedWindow& CreatedWindow::operator=(CreatedWindow&&) = default;

std::unique_ptr<WebContents> WebContents::Create(
    const WebContents::CreateParams& params) {}

std::unique_ptr<WebContentsImpl> WebContentsImpl::Create(
    const CreateParams& params) {}

std::unique_ptr<WebContents> WebContents::CreateWithSessionStorage(
    const WebContents::CreateParams& params,
    const SessionStorageNamespaceMap& session_storage_namespace_map) {}

base::CallbackListSubscription
WebContentsImpl::FriendWrapper::AddCreatedCallbackForTesting(
    const CreatedCallback& callback) {}

WebContents* WebContents::FromRenderViewHost(RenderViewHost* rvh) {}

WebContents* WebContents::FromRenderFrameHost(RenderFrameHost* rfh) {}

WebContentsImpl* WebContentsImpl::FromRenderFrameHostImpl(
    RenderFrameHostImpl* rfh) {}

WebContents* WebContents::FromFrameTreeNodeId(int frame_tree_node_id) {}

WebContentsImpl* WebContentsImpl::FromRenderWidgetHostImpl(
    RenderWidgetHostImpl* rwh) {}

bool WebContentsImpl::IsPopup() const {}

RenderFrameHostImpl* WebContentsImpl::PartitionedPopinOpener() const {}

WebContents* WebContentsImpl::OpenedPartitionedPopin() const {}

void WebContents::SetScreenOrientationDelegate(
    ScreenOrientationDelegate* delegate) {}

// WebContentsImpl::RenderWidgetHostDestructionObserver -----------------------

class WebContentsImpl::RenderWidgetHostDestructionObserver
    : public RenderWidgetHostObserver {};

// WebContentsImpl::WebContentsDestructionObserver ----------------------------

class WebContentsImpl::WebContentsDestructionObserver
    : public WebContentsObserver {};

#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
// TODO(sreejakshetty): Make |WebContentsImpl::ColorChooserHolder| per-frame
// instead of WebContents-owned.
// WebContentsImpl::ColorChooserHolder -----------------------------------------
class WebContentsImpl::ColorChooserHolder : public blink::mojom::ColorChooser {
 public:
  ColorChooserHolder(
      mojo::PendingReceiver<blink::mojom::ColorChooser> receiver,
      mojo::PendingRemote<blink::mojom::ColorChooserClient> client)
      : receiver_(this, std::move(receiver)), client_(std::move(client)) {}

  ~ColorChooserHolder() override {
    if (chooser_) {
      chooser_->End();
    }
  }

  void SetChooser(std::unique_ptr<content::ColorChooser> chooser) {
    chooser_ = std::move(chooser);
    if (chooser_) {
      receiver_.set_disconnect_handler(
          base::BindOnce([](content::ColorChooser* chooser) { chooser->End(); },
                         base::Unretained(chooser_.get())));
    }
  }

  void SetSelectedColor(SkColor color) override {
    OPTIONAL_TRACE_EVENT0(
        "content", "WebContentsImpl::ColorChooserHolder::SetSelectedColor");
    if (chooser_) {
      chooser_->SetSelectedColor(color);
    }
  }

  void DidChooseColorInColorChooser(SkColor color) {
    OPTIONAL_TRACE_EVENT0(
        "content",
        "WebContentsImpl::ColorChooserHolder::DidChooseColorInColorChooser");
    client_->DidChooseColor(color);
  }

 private:
  // Color chooser that was opened by this tab.
  std::unique_ptr<content::ColorChooser> chooser_;

  // mojo receiver.
  mojo::Receiver<blink::mojom::ColorChooser> receiver_;

  // mojo renderer client.
  mojo::Remote<blink::mojom::ColorChooserClient> client_;
};
#endif  // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)

// WebContentsImpl::WebContentsTreeNode ----------------------------------------
WebContentsImpl::WebContentsTreeNode::WebContentsTreeNode(
    WebContentsImpl* current_web_contents)
    :{}

WebContentsImpl::WebContentsTreeNode::~WebContentsTreeNode() = default;

void WebContentsImpl::WebContentsTreeNode::AttachInnerWebContents(
    std::unique_ptr<WebContents> inner_web_contents,
    RenderFrameHostImpl* render_frame_host) {}

std::unique_ptr<WebContents>
WebContentsImpl::WebContentsTreeNode::DetachInnerWebContents(
    WebContentsImpl* inner_web_contents) {}

FrameTreeNode*
WebContentsImpl::WebContentsTreeNode::OuterContentsFrameTreeNode() const {}

void WebContentsImpl::WebContentsTreeNode::OnFrameTreeNodeDestroyed(
    FrameTreeNode* node) {}

FrameTree* WebContentsImpl::WebContentsTreeNode::focused_frame_tree() {}

void WebContentsImpl::WebContentsTreeNode::SetFocusedFrameTree(
    FrameTree* frame_tree) {}

WebContentsImpl*
WebContentsImpl::WebContentsTreeNode::GetInnerWebContentsInFrame(
    const FrameTreeNode* frame) {}

std::vector<WebContentsImpl*>
WebContentsImpl::WebContentsTreeNode::GetInnerWebContents() const {}

// WebContentsObserverList -----------------------------------------------------
WebContentsImpl::WebContentsObserverList::WebContentsObserverList() = default;
WebContentsImpl::WebContentsObserverList::~WebContentsObserverList() = default;

void WebContentsImpl::WebContentsObserverList::AddObserver(
    WebContentsObserver* observer) {}

void WebContentsImpl::WebContentsObserverList::RemoveObserver(
    WebContentsObserver* observer) {}

// WebContentsImpl -------------------------------------------------------------

namespace {

// A helper for ensuring that WebContents are closed (or otherwise destroyed)
// *before* their BrowserContext is destroyed.
class WebContentsOfBrowserContext : public base::SupportsUserData::Data {};

}  // namespace

WebContentsImpl::WebContentsImpl(BrowserContext* browser_context)
    :{}

WebContentsImpl::~WebContentsImpl() {}

std::unique_ptr<WebContentsImpl> WebContentsImpl::CreateWithOpener(
    const WebContents::CreateParams& params,
    RenderFrameHostImpl* opener_rfh) {}

// static
std::vector<WebContentsImpl*> WebContentsImpl::GetAllWebContents() {}

// static
WebContentsImpl* WebContentsImpl::FromFrameTreeNode(
    const FrameTreeNode* frame_tree_node) {}

// static
WebContents* WebContentsImpl::FromRenderFrameHostID(
    GlobalRenderFrameHostId render_frame_host_id) {}

// static
WebContents* WebContentsImpl::FromRenderFrameHostID(int render_process_host_id,
                                                    int render_frame_host_id) {}

// static
WebContentsImpl* WebContentsImpl::FromOuterFrameTreeNode(
    const FrameTreeNode* frame_tree_node) {}

bool WebContentsImpl::OnMessageReceived(RenderFrameHostImpl* render_frame_host,
                                        const IPC::Message& message) {}

std::string WebContentsImpl::GetTitleForMediaControls() {}

// Returns the NavigationController for the primary FrameTree, i.e. the one
// whose URL is shown in the omnibox. With MPArch we can have multiple
// FrameTrees in one WebContents and each has its own NavigationController.
// TODO(crbug.com/40165692): Make sure callers are aware of this.
NavigationControllerImpl& WebContentsImpl::GetController() {}

BrowserContext* WebContentsImpl::GetBrowserContext() {}

base::WeakPtr<WebContents> WebContentsImpl::GetWeakPtr() {}

const GURL& WebContentsImpl::GetURL() {}

const GURL& WebContentsImpl::GetVisibleURL() {}

const GURL& WebContentsImpl::GetLastCommittedURL() {}

WebContentsDelegate* WebContentsImpl::GetDelegate() {}

void WebContentsImpl::SetDelegate(WebContentsDelegate* delegate) {}

const RenderFrameHostImpl* WebContentsImpl::GetPrimaryMainFrame() const {}

RenderFrameHostImpl* WebContentsImpl::GetPrimaryMainFrame() {}

PageImpl& WebContentsImpl::GetPrimaryPage() {}

RenderFrameHostImpl* WebContentsImpl::GetFocusedFrame() {}

bool WebContentsImpl::IsPrerenderedFrame(int frame_tree_node_id) {}

RenderFrameHostImpl* WebContentsImpl::UnsafeFindFrameByFrameTreeNodeId(
    int frame_tree_node_id) {}

void WebContentsImpl::ForEachRenderFrameHostWithAction(
    base::FunctionRef<FrameIterationAction(RenderFrameHost*)> on_frame) {}

void WebContentsImpl::ForEachRenderFrameHost(
    base::FunctionRef<void(RenderFrameHost*)> on_frame) {}

void WebContentsImpl::ForEachRenderFrameHostWithAction(
    base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame) {}

void WebContentsImpl::ForEachRenderFrameHost(
    base::FunctionRef<void(RenderFrameHostImpl*)> on_frame) {}

void WebContentsImpl::ForEachRenderFrameHostIncludingSpeculativeWithAction(
    base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame) {}

void WebContentsImpl::ForEachRenderFrameHostIncludingSpeculative(
    base::FunctionRef<void(RenderFrameHostImpl*)> on_frame) {}

void WebContentsImpl::ForEachRenderFrameHostImpl(
    base::FunctionRef<FrameIterationAction(RenderFrameHostImpl*)> on_frame,
    bool include_speculative) {}

void WebContentsImpl::ForEachFrameTree(
    FrameTreeIterationCallback on_frame_tree) {}

std::vector<FrameTree*> WebContentsImpl::GetOutermostFrameTrees() {}

std::vector<RenderFrameHostImpl*> WebContentsImpl::GetOutermostMainFrames() {}

void WebContentsImpl::ExecutePageBroadcastMethod(
    PageBroadcastMethodCallback callback) {}

void WebContentsImpl::ExecutePageBroadcastMethodForAllPages(
    PageBroadcastMethodCallback callback) {}

RenderViewHostImpl* WebContentsImpl::GetRenderViewHost() {}

void WebContentsImpl::CancelActiveAndPendingDialogs() {}

void WebContentsImpl::ClosePage() {}

RenderWidgetHostView* WebContentsImpl::GetRenderWidgetHostView() {}

RenderWidgetHostView* WebContentsImpl::GetTopLevelRenderWidgetHostView() {}

WebContentsView* WebContentsImpl::GetView() const {}

void WebContentsImpl::OnScreensChange(bool is_multi_screen_changed) {}

void WebContentsImpl::OnScreenOrientationChange() {}

std::optional<SkColor> WebContentsImpl::GetThemeColor() {}

std::optional<SkColor> WebContentsImpl::GetBackgroundColor() {}

void WebContentsImpl::SetPageBaseBackgroundColor(std::optional<SkColor> color) {}

void WebContentsImpl::SetColorProviderSource(ui::ColorProviderSource* source) {}

ui::ColorProviderKey::ColorMode WebContentsImpl::GetColorMode() const {}

void WebContentsImpl::SetAccessibilityMode(ui::AXMode mode) {}

void WebContentsImpl::DidCapturedSurfaceControl() {}

void WebContentsImpl::ResetAccessibility() {}

void WebContentsImpl::AddAccessibilityModeForTesting(ui::AXMode mode) {}

// Helper class used by WebContentsImpl::RequestAXTreeSnapshot.
// Handles the callbacks from parallel snapshot requests to each frame,
// and feeds the results to an AXTreeCombiner, which converts them into a
// single combined accessibility tree.
class AXTreeSnapshotCombiner : public base::RefCounted<AXTreeSnapshotCombiner> {};

void WebContentsImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback,
                                            ui::AXMode ax_mode,
                                            size_t max_nodes,
                                            base::TimeDelta timeout,
                                            AXTreeSnapshotPolicy policy) {}

void WebContentsImpl::NotifyViewportFitChanged(
    blink::mojom::ViewportFit value) {}

FindRequestManager* WebContentsImpl::GetFindRequestManagerForTesting() {}

void WebContentsImpl::UpdateZoom() {}

void WebContentsImpl::UpdateZoomIfNecessary(const std::string& scheme,
                                            const std::string& host) {}

std::vector<WebContentsImpl*> WebContentsImpl::GetWebContentsAndAllInner() {}

void WebContentsImpl::OnManifestUrlChanged(PageImpl& page) {}

WebUI* WebContentsImpl::GetWebUI() {}

void WebContentsImpl::SetAlwaysSendSubresourceNotifications() {}

bool WebContentsImpl::GetSendSubresourceNotification() {}

void WebContentsImpl::SetUserAgentOverride(
    const blink::UserAgentOverride& ua_override,
    bool override_in_new_tabs) {}

void WebContentsImpl::SetRendererInitiatedUserAgentOverrideOption(
    NavigationController::UserAgentOverrideOption option) {}

const blink::UserAgentOverride& WebContentsImpl::GetUserAgentOverride() {}

bool WebContentsImpl::ShouldOverrideUserAgentForRendererInitiatedNavigation() {}

bool WebContentsImpl::IsWebContentsOnlyAccessibilityModeForTesting() {}

bool WebContentsImpl::IsFullAccessibilityModeForTesting() {}

#if BUILDFLAG(IS_ANDROID)

void WebContentsImpl::SetDisplayCutoutSafeArea(gfx::Insets insets) {
  OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::SetDisplayCutoutSafeArea");
  if (safe_area_insets_host_) {
    safe_area_insets_host_->SetDisplayCutoutSafeArea(insets);
  }
}

#endif

const std::u16string& WebContentsImpl::GetTitle() {}

const std::optional<std::u16string>& WebContentsImpl::GetAppTitle() {}

SiteInstanceImpl* WebContentsImpl::GetSiteInstance() {}

bool WebContentsImpl::IsLoading() {}

double WebContentsImpl::GetLoadProgress() {}

bool WebContentsImpl::ShouldShowLoadingUI() {}

bool WebContentsImpl::IsDocumentOnLoadCompletedInPrimaryMainFrame() {}

bool WebContentsImpl::IsWaitingForResponse() {}

bool WebContentsImpl::HasUncommittedNavigationInPrimaryMainFrame() {}

const net::LoadStateWithParam& WebContentsImpl::GetLoadState() {}

const std::u16string& WebContentsImpl::GetLoadStateHost() {}

uint64_t WebContentsImpl::GetUploadSize() {}

uint64_t WebContentsImpl::GetUploadPosition() {}

const std::string& WebContentsImpl::GetEncoding() {}

bool WebContentsImpl::WasDiscarded() {}

void WebContentsImpl::SetWasDiscarded(bool was_discarded) {}

base::ScopedClosureRunner WebContentsImpl::IncrementCapturerCount(
    const gfx::Size& capture_size,
    bool stay_hidden,
    bool stay_awake,
    bool is_activity) {}

const blink::mojom::CaptureHandleConfig&
WebContentsImpl::GetCaptureHandleConfig() {}

bool WebContentsImpl::IsBeingCaptured() {}

bool WebContentsImpl::IsBeingVisiblyCaptured() {}

bool WebContentsImpl::IsAudioMuted() {}

void WebContentsImpl::SetAudioMuted(bool mute) {}

bool WebContentsImpl::IsCurrentlyAudible() {}

bool WebContentsImpl::IsConnectedToBluetoothDevice() {}

bool WebContentsImpl::IsScanningForBluetoothDevices() {}

bool WebContentsImpl::IsConnectedToSerialPort() {}

bool WebContentsImpl::IsConnectedToHidDevice() {}

bool WebContentsImpl::IsConnectedToUsbDevice() {}

bool WebContentsImpl::HasFileSystemAccessHandles() {}

bool WebContentsImpl::HasPictureInPictureVideo() {}

bool WebContentsImpl::HasPictureInPictureDocument() {}

void WebContentsImpl::SetHasPictureInPictureCommon(
    bool has_picture_in_picture) {}

void WebContentsImpl::DisallowCustomCursorScopeExpired() {}

void WebContentsImpl::SetHasPictureInPictureVideo(
    bool has_picture_in_picture_video) {}

void WebContentsImpl::SetHasPictureInPictureDocument(
    bool has_picture_in_picture_document) {}

bool WebContentsImpl::IsCrashed() {}

void WebContentsImpl::SetPrimaryMainFrameProcessStatus(
    base::TerminationStatus status,
    int error_code) {}

base::TerminationStatus WebContentsImpl::GetCrashedStatus() {}

int WebContentsImpl::GetCrashedErrorCode() {}

bool WebContentsImpl::IsBeingDestroyed() {}

void WebContentsImpl::NotifyNavigationStateChanged(
    InvalidateTypes changed_flags) {}

void WebContentsImpl::OnVerticalScrollDirectionChanged(
    viz::VerticalScrollDirection scroll_direction) {}

int WebContentsImpl::GetVirtualKeyboardResizeHeight() {}

bool WebContentsImpl::ShouldDoLearning() {}

void WebContentsImpl::OnAudioStateChanged() {}

base::TimeTicks WebContentsImpl::GetLastActiveTimeTicks() {}

base::Time WebContentsImpl::GetLastActiveTime() {}

void WebContentsImpl::WasShown() {}

void WebContentsImpl::WasHidden() {}

bool WebContentsImpl::HasRecentInteraction() {}

WebContents::ScopedIgnoreInputEvents WebContentsImpl::IgnoreInputEvents(
    std::optional<WebInputEventAuditCallback> audit_callback) {}

bool WebContentsImpl::HasActiveEffectivelyFullscreenVideo() {}

void WebContentsImpl::WriteIntoTrace(perfetto::TracedValue context) {}

const base::Location& WebContentsImpl::GetCreatorLocation() {}

const std::optional<blink::mojom::PictureInPictureWindowOptions>&
WebContentsImpl::GetPictureInPictureOptions() const {}

#if BUILDFLAG(IS_ANDROID)
void WebContentsImpl::SetPrimaryMainFrameImportance(
    ChildProcessImportance importance) {
  OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::SetMainFrameImportance",
                        "importance", static_cast<int>(importance));
  GetPrimaryMainFrame()->GetRenderWidgetHost()->SetImportance(importance);
}
#endif

void WebContentsImpl::WasOccluded() {}

Visibility WebContentsImpl::GetVisibility() {}

bool WebContentsImpl::NeedToFireBeforeUnloadOrUnloadEvents() {}

void WebContentsImpl::DispatchBeforeUnload(bool auto_cancel) {}

bool WebContentsImpl::IsInnerWebContentsForGuest() {}

void WebContentsImpl::AttachInnerWebContents(
    std::unique_ptr<WebContents> inner_web_contents,
    RenderFrameHost* render_frame_host,
    mojo::PendingAssociatedRemote<blink::mojom::RemoteFrame> remote_frame,
    mojo::PendingAssociatedReceiver<blink::mojom::RemoteFrameHost>
        remote_frame_host_receiver,
    bool is_full_page) {}

void WebContentsImpl::RecursivelyRegisterRenderWidgetHostViews() {}

void WebContentsImpl::RecursivelyUnregisterRenderWidgetHostViews() {}

void WebContentsImpl::ReattachToOuterWebContentsFrame() {}

void WebContentsImpl::DidActivatePreviewedPage(
    base::TimeTicks activation_time) {}

void WebContentsImpl::DidChangeVisibleSecurityState() {}

const blink::web_pref::WebPreferences WebContentsImpl::ComputeWebPreferences() {}

void WebContentsImpl::SetSlowWebPreferences(
    const base::CommandLine& command_line,
    blink::web_pref::WebPreferences* prefs) {}

void WebContentsImpl::OnWebPreferencesChanged() {}

void WebContentsImpl::NotifyPreferencesChanged() {}

void WebContentsImpl::SyncRendererPrefs() {}

void WebContentsImpl::OnCookiesAccessed(NavigationHandle* navigation,
                                        const CookieAccessDetails& details) {}

void WebContentsImpl::OnCookiesAccessed(RenderFrameHostImpl* rfh,
                                        const CookieAccessDetails& details) {}

void WebContentsImpl::OnTrustTokensAccessed(
    NavigationHandle* navigation,
    const TrustTokenAccessDetails& details) {}

void WebContentsImpl::OnTrustTokensAccessed(
    RenderFrameHostImpl* rfh,
    const TrustTokenAccessDetails& details) {}

void WebContentsImpl::OnSharedDictionaryAccessed(
    NavigationHandle* navigation,
    const network::mojom::SharedDictionaryAccessDetails& details) {}

void WebContentsImpl::OnSharedDictionaryAccessed(
    RenderFrameHostImpl* rfh,
    const network::mojom::SharedDictionaryAccessDetails& details) {}

void WebContentsImpl::NotifyStorageAccessed(
    RenderFrameHostImpl* rfh,
    blink::mojom::StorageTypeAccessed storage_type,
    bool blocked) {}

void WebContentsImpl::OnVibrate(RenderFrameHostImpl* rfh) {}

std::optional<blink::ParsedPermissionsPolicy>
WebContentsImpl::GetPermissionsPolicyForIsolatedWebApp(
    RenderFrameHostImpl* source) {}

void WebContentsImpl::Stop() {}

void WebContentsImpl::SetPageFrozen(bool frozen) {}

std::unique_ptr<WebContents> WebContentsImpl::Clone() {}

void WebContentsImpl::Init(const WebContents::CreateParams& params,
                           blink::FramePolicy primary_main_frame_policy) {}

void WebContentsImpl::OnWebContentsDestroyed(WebContentsImpl* web_contents) {}

void WebContentsImpl::OnRenderWidgetHostDestroyed(
    RenderWidgetHost* render_widget_host) {}

void WebContentsImpl::AddWebContentsDestructionObserver(
    WebContentsImpl* web_contents) {}

void WebContentsImpl::RemoveWebContentsDestructionObserver(
    WebContentsImpl* web_contents) {}

void WebContentsImpl::AddRenderWidgetHostDestructionObserver(
    RenderWidgetHost* render_widget_host) {}

void WebContentsImpl::RemoveRenderWidgetHostDestructionObserver(
    RenderWidgetHost* render_widget_host) {}

void WebContentsImpl::AddObserver(WebContentsObserver* observer) {}

void WebContentsImpl::RemoveObserver(WebContentsObserver* observer) {}

std::set<RenderWidgetHostViewBase*>
WebContentsImpl::GetRenderWidgetHostViewsInWebContentsTree() {}

void WebContentsImpl::Activate() {}

void WebContentsImpl::SetTopControlsShownRatio(
    RenderWidgetHostImpl* render_widget_host,
    float ratio) {}

void WebContentsImpl::SetTopControlsGestureScrollInProgress(bool in_progress) {}

void WebContentsImpl::RenderWidgetCreated(
    RenderWidgetHostImpl* render_widget_host) {}

void WebContentsImpl::RenderWidgetDeleted(
    RenderWidgetHostImpl* render_widget_host) {}

void WebContentsImpl::RenderWidgetWasResized(
    RenderWidgetHostImpl* render_widget_host,
    bool width_changed) {}

KeyboardEventProcessingResult WebContentsImpl::PreHandleKeyboardEvent(
    const input::NativeWebKeyboardEvent& event) {}

bool WebContentsImpl::HandleMouseEvent(const blink::WebMouseEvent& event) {}

bool WebContentsImpl::HandleKeyboardEvent(
    const input::NativeWebKeyboardEvent& event) {}

bool WebContentsImpl::HandleWheelEvent(const blink::WebMouseWheelEvent& event) {}

bool WebContentsImpl::PreHandleGestureEvent(
    const blink::WebGestureEvent& event) {}

input::RenderWidgetHostInputEventRouter*
WebContentsImpl::GetInputEventRouter() {}

void WebContentsImpl::GetRenderWidgetHostAtPointAsynchronously(
    RenderWidgetHostViewBase* root_view,
    const gfx::PointF& point,
    base::OnceCallback<void(base::WeakPtr<RenderWidgetHostViewBase>,
                            std::optional<gfx::PointF>)> callback) {}

std::vector<RenderWidgetHostView*>
WebContentsImpl::GetRenderWidgetHostViewsForTests() {}

RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost(
    RenderWidgetHostImpl* receiving_widget) {}

RenderWidgetHostImpl* WebContentsImpl::GetRenderWidgetHostWithPageFocus() {}

bool WebContentsImpl::CanEnterFullscreenMode(
    RenderFrameHostImpl* requesting_frame) {}

void WebContentsImpl::EnterFullscreenMode(
    RenderFrameHostImpl* requesting_frame,
    const blink::mojom::FullscreenOptions& options) {}

void WebContentsImpl::ExitFullscreenMode(bool will_cause_resize) {}

void WebContentsImpl::FullscreenStateChanged(
    RenderFrameHostImpl* rfh,
    bool is_fullscreen,
    blink::mojom::FullscreenOptionsPtr options) {}

bool WebContentsImpl::CanUseWindowingControls(
    RenderFrameHostImpl* requesting_frame) {}

void WebContentsImpl::Maximize() {}

void WebContentsImpl::Minimize() {}

void WebContentsImpl::Restore() {}

// TODO(laurila, crbug.com/1466855): Map into new `ui::DisplayState` enum
// instead of `ui::WindowShowState`.
ui::WindowShowState WebContentsImpl::GetWindowShowState() {}

blink::mojom::DevicePostureProvider*
WebContentsImpl::GetDevicePostureProvider() {}

bool WebContentsImpl::GetResizable() {}

void WebContentsImpl::FullscreenFrameSetUpdated() {}

PageVisibilityState WebContentsImpl::CalculatePageVisibilityState(
    Visibility visibility) const {}

PageVisibilityState WebContentsImpl::GetPageVisibilityState() const {}

void WebContentsImpl::UpdateVisibilityAndNotifyPageAndView(
    Visibility new_visibility,
    bool is_activity) {}

#if BUILDFLAG(IS_ANDROID)
void WebContentsImpl::UpdateUserGestureCarryoverInfo() {
  OPTIONAL_TRACE_EVENT0("content",
                        "WebContentsImpl::UpdateUserGestureCarryoverInfo");
  if (delegate_) {
    delegate_->UpdateUserGestureCarryoverInfo(this);
  }
}
#endif

bool WebContentsImpl::IsFullscreen() {}

bool WebContentsImpl::ShouldShowStaleContentOnEviction() {}

blink::mojom::DisplayMode WebContentsImpl::GetDisplayMode() const {}

void WebContentsImpl::RequestToLockPointer(
    RenderWidgetHostImpl* render_widget_host,
    bool user_gesture,
    bool last_unlocked_by_target,
    bool privileged) {}

void WebContentsImpl::LostPointerLock(
    RenderWidgetHostImpl* render_widget_host) {}

bool WebContentsImpl::HasPointerLock(RenderWidgetHostImpl* render_widget_host) {}

RenderWidgetHostImpl* WebContentsImpl::GetPointerLockWidget() {}

bool WebContentsImpl::RequestKeyboardLock(
    RenderWidgetHostImpl* render_widget_host,
    bool esc_key_locked) {}

void WebContentsImpl::CancelKeyboardLock(
    RenderWidgetHostImpl* render_widget_host) {}

RenderWidgetHostImpl* WebContentsImpl::GetKeyboardLockWidget() {}

bool WebContentsImpl::OnRenderFrameProxyVisibilityChanged(
    RenderFrameProxyHost* render_frame_proxy_host,
    blink::mojom::FrameVisibility visibility) {}

FrameTree* WebContentsImpl::CreateNewWindow(
    RenderFrameHostImpl* opener,
    const mojom::CreateNewWindowParams& params,
    bool is_new_browsing_instance,
    bool has_user_gesture,
    SessionStorageNamespace* session_storage_namespace) {}

RenderWidgetHostImpl* WebContentsImpl::CreateNewPopupWidget(
    base::SafeRef<SiteInstanceGroup> site_instance_group,
    int32_t route_id,
    mojo::PendingAssociatedReceiver<blink::mojom::PopupWidgetHost>
        blink_popup_widget_host,
    mojo::PendingAssociatedReceiver<blink::mojom::WidgetHost> blink_widget_host,
    mojo::PendingAssociatedRemote<blink::mojom::Widget> blink_widget) {}

int64_t WebContentsImpl::AdjustWindowRect(gfx::Rect* bounds,
                                          RenderFrameHostImpl* opener) {}

void WebContentsImpl::ShowCreatedWindow(
    RenderFrameHostImpl* opener,
    int main_frame_widget_route_id,
    WindowOpenDisposition disposition,
    const blink::mojom::WindowFeatures& window_features,
    bool user_gesture) {}

void WebContentsImpl::ShowCreatedWidget(int process_id,
                                        int widget_route_id,
                                        const gfx::Rect& initial_rect,
                                        const gfx::Rect& initial_anchor_rect) {}

std::optional<CreatedWindow> WebContentsImpl::GetCreatedWindow(
    int process_id,
    int main_frame_widget_route_id) {}

RenderWidgetHostView* WebContentsImpl::GetCreatedWidget(int process_id,
                                                        int route_id) {}

void WebContentsImpl::CreateMediaPlayerHostForRenderFrameHost(
    RenderFrameHostImpl* frame_host,
    mojo::PendingAssociatedReceiver<media::mojom::MediaPlayerHost> receiver) {}

void WebContentsImpl::RequestMediaAccessPermission(
    const MediaStreamRequest& request,
    MediaResponseCallback callback) {}

bool WebContentsImpl::CheckMediaAccessPermission(
    RenderFrameHostImpl* render_frame_host,
    const url::Origin& security_origin,
    blink::mojom::MediaStreamType type) {}

void WebContentsImpl::SetCaptureHandleConfig(
    blink::mojom::CaptureHandleConfigPtr config) {}

bool WebContentsImpl::IsJavaScriptDialogShowing() const {}

bool WebContentsImpl::ShouldIgnoreUnresponsiveRenderer() {}

ui::AXMode WebContentsImpl::GetAccessibilityMode() {}

void WebContentsImpl::AXTreeIDForMainFrameHasChanged() {}

void WebContentsImpl::ProcessAccessibilityUpdatesAndEvents(
    ui::AXUpdatesAndEvents& details) {}

void WebContentsImpl::AccessibilityLocationChangesReceived(
    const std::vector<ui::AXLocationChanges>& details) {}

ui::AXNode* WebContentsImpl::GetAccessibilityRootNode() {}

std::string WebContentsImpl::DumpAccessibilityTree(
    bool internal,
    std::vector<ui::AXPropertyFilter> property_filters) {}

std::string WebContentsImpl::DumpAccessibilityTree(
    ui::AXApiType::Type api_type,
    std::vector<ui::AXPropertyFilter> property_filters) {}

void WebContentsImpl::RecordAccessibilityEvents(
    bool start_recording,
    std::optional<ui::AXEventCallback> callback) {}
void WebContentsImpl::RecordAccessibilityEvents(
    ui::AXApiType::Type api_type,
    bool start_recording,
    std::optional<ui::AXEventCallback> callback) {}

void WebContentsImpl::UnrecoverableAccessibilityError() {}

device::mojom::GeolocationContext* WebContentsImpl::GetGeolocationContext() {}

device::mojom::WakeLockContext* WebContentsImpl::GetWakeLockContext() {}

#if BUILDFLAG(IS_ANDROID)
void WebContentsImpl::GetNFC(
    RenderFrameHost* render_frame_host,
    mojo::PendingReceiver<device::mojom::NFC> receiver) {
  if (!nfc_host_) {
    nfc_host_ = std::make_unique<NFCHost>(this);
  }
  nfc_host_->GetNFC(render_frame_host, std::move(receiver));
}
#endif

void WebContentsImpl::SendScreenRects() {}

void WebContentsImpl::SendActiveState(bool active) {}

TextInputManager* WebContentsImpl::GetTextInputManager() {}

bool WebContentsImpl::IsWidgetForPrimaryMainFrame(
    RenderWidgetHostImpl* render_widget_host) {}

ui::BrowserAccessibilityManager*
WebContentsImpl::GetRootBrowserAccessibilityManager() {}

ui::BrowserAccessibilityManager*
WebContentsImpl::GetOrCreateRootBrowserAccessibilityManager() {}

void WebContentsImpl::ExecuteEditCommand(
    const std::string& command,
    const std::optional<std::u16string>& value) {}

void WebContentsImpl::MoveRangeSelectionExtent(const gfx::Point& extent) {}

void WebContentsImpl::SelectRange(const gfx::Point& base,
                                  const gfx::Point& extent) {}

void WebContentsImpl::SelectAroundCaret(
    blink::mojom::SelectionGranularity granularity,
    bool should_show_handle,
    bool should_show_context_menu) {}

void WebContentsImpl::MoveCaret(const gfx::Point& extent) {}

void WebContentsImpl::AdjustSelectionByCharacterOffset(
    int start_adjust,
    int end_adjust,
    bool show_selection_menu) {}

void WebContentsImpl::ResizeDueToAutoResize(
    RenderWidgetHostImpl* render_widget_host,
    const gfx::Size& new_size) {}

WebContents* WebContentsImpl::OpenURL(
    const OpenURLParams& params,
    base::OnceCallback<void(content::NavigationHandle&)>
        navigation_handle_callback) {}

void WebContentsImpl::SetHistoryOffsetAndLengthForView(
    RenderViewHost* render_view_host,
    int history_offset,
    int history_length) {}

void WebContentsImpl::ReloadFocusedFrame() {}

void WebContentsImpl::Undo() {}

void WebContentsImpl::Redo() {}

void WebContentsImpl::Cut() {}

void WebContentsImpl::Copy() {}

void WebContentsImpl::CopyToFindPboard() {}

void WebContentsImpl::CenterSelection() {}

void WebContentsImpl::Paste() {}

void WebContentsImpl::PasteAndMatchStyle() {}

void WebContentsImpl::Delete() {}

void WebContentsImpl::SelectAll() {}

void WebContentsImpl::CollapseSelection() {}

void WebContentsImpl::ScrollToTopOfDocument() {}

void WebContentsImpl::ScrollToBottomOfDocument() {}

void WebContentsImpl::Replace(const std::u16string& word) {}

void WebContentsImpl::ReplaceMisspelling(const std::u16string& word) {}

void WebContentsImpl::NotifyContextMenuClosed(const GURL& link_followed) {}

void WebContentsImpl::ExecuteCustomContextMenuCommand(
    int action,
    const GURL& link_followed) {}

gfx::NativeView WebContentsImpl::GetNativeView() {}

gfx::NativeView WebContentsImpl::GetContentNativeView() {}

gfx::NativeWindow WebContentsImpl::GetTopLevelNativeWindow() {}

gfx::Rect WebContentsImpl::GetViewBounds() {}

gfx::Rect WebContentsImpl::GetContainerBounds() {}

DropData* WebContentsImpl::GetDropData() {}

void WebContentsImpl::Focus() {}

void WebContentsImpl::SetInitialFocus() {}

void WebContentsImpl::StoreFocus() {}

void WebContentsImpl::RestoreFocus() {}

void WebContentsImpl::FocusThroughTabTraversal(bool reverse) {}

bool WebContentsImpl::IsSavable() {}

void WebContentsImpl::OnSavePage() {}

// Used in automated testing to bypass prompting the user for file names.
// Instead, the names and paths are hard coded rather than running them through
// file name sanitation and extension / mime checking.
bool WebContentsImpl::SavePage(const base::FilePath& main_file,
                               const base::FilePath& dir_path,
                               SavePageType save_type) {}

void WebContentsImpl::SaveFrame(const GURL& url,
                                const Referrer& referrer,
                                RenderFrameHost* rfh) {}

void WebContentsImpl::SaveFrameWithHeaders(
    const GURL& url,
    const Referrer& referrer,
    const std::string& headers,
    const std::u16string& suggested_filename,
    RenderFrameHost* rfh,
    bool is_subresource) {}

void WebContentsImpl::GenerateMHTML(
    const MHTMLGenerationParams& params,
    base::OnceCallback<void(int64_t)> callback) {}

void WebContentsImpl::GenerateMHTMLWithResult(
    const MHTMLGenerationParams& params,
    MHTMLGenerationResult::GenerateMHTMLCallback callback) {}

const std::string& WebContentsImpl::GetContentsMimeType() {}

blink::RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() {}

void WebContentsImpl::DragSourceEndedAt(float client_x,
                                        float client_y,
                                        float screen_x,
                                        float screen_y,
                                        ui::mojom::DragOperation operation,
                                        RenderWidgetHost* source_rwh) {}

void WebContentsImpl::LoadStateChanged(network::mojom::LoadInfoPtr load_info) {}

void WebContentsImpl::SetVisibilityAndNotifyObservers(Visibility visibility) {}

void WebContentsImpl::NotifyWebContentsFocused(
    RenderWidgetHost* render_widget_host) {}

void WebContentsImpl::NotifyWebContentsLostFocus(
    RenderWidgetHost* render_widget_host) {}

void WebContentsImpl::SystemDragEnded(RenderWidgetHost* source_rwh) {}

void WebContentsImpl::SetClosedByUserGesture(bool value) {}

bool WebContentsImpl::GetClosedByUserGesture() {}

int WebContentsImpl::GetMinimumZoomPercent() {}

int WebContentsImpl::GetMaximumZoomPercent() {}

void WebContentsImpl::SetPageScale(float scale_factor) {}

gfx::Size WebContentsImpl::GetPreferredSize() {}

bool WebContentsImpl::GotResponseToPointerLockRequest(
    blink::mojom::PointerLockResult result) {}

void WebContentsImpl::GotPointerLockPermissionResponse(bool allowed) {}

void WebContentsImpl::DropPointerLockForTesting() {}

bool WebContentsImpl::GotResponseToKeyboardLockRequest(bool allowed) {}

bool WebContentsImpl::HasOpener() {}

RenderFrameHostImpl* WebContentsImpl::GetOpener() {}

bool WebContentsImpl::HasLiveOriginalOpenerChain() {}

WebContents* WebContentsImpl::GetFirstWebContentsInLiveOriginalOpenerChain() {}

#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
void WebContentsImpl::DidChooseColorInColorChooser(SkColor color) {
  OPTIONAL_TRACE_EVENT1("content",
                        "WebContentsImpl::DidChooseColorInColorChooser",
                        "color", color);
  if (color_chooser_holder_) {
    color_chooser_holder_->DidChooseColorInColorChooser(color);
  }
}

void WebContentsImpl::DidEndColorChooser() {
  OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::DidEndColorChooser");
  color_chooser_holder_.reset();
}
#endif

int WebContentsImpl::DownloadImageFromAxNode(const ui::AXTreeID tree_id,
                                             const ui::AXNodeID node_id,
                                             const gfx::Size& preferred_size,
                                             uint32_t max_bitmap_size,
                                             bool bypass_cache,
                                             ImageDownloadCallback callback) {}
int WebContentsImpl::DownloadImage(
    const GURL& url,
    bool is_favicon,
    const gfx::Size& preferred_size,
    uint32_t max_bitmap_size,
    bool bypass_cache,
    WebContents::ImageDownloadCallback callback) {}

int WebContentsImpl::DownloadImageInFrame(
    const GlobalRenderFrameHostId& initiator_frame_routing_id,
    const GURL& url,
    bool is_favicon,
    const gfx::Size& preferred_size,
    uint32_t max_bitmap_size,
    bool bypass_cache,
    WebContents::ImageDownloadCallback callback) {}

void WebContentsImpl::Find(int request_id,
                           const std::u16string& search_text,
                           blink::mojom::FindOptionsPtr options,
                           bool skip_delay) {}

void WebContentsImpl::StopFinding(StopFindAction action) {}

bool WebContentsImpl::WasEverAudible() {}

void WebContentsImpl::ExitFullscreen(bool will_cause_resize) {}

base::ScopedClosureRunner WebContentsImpl::ForSecurityDropFullscreen(
    int64_t display_id) {}

void WebContentsImpl::ResumeLoadingCreatedWebContents() {}

bool WebContentsImpl::FocusLocationBarByDefault() {}

void WebContentsImpl::DidStartNavigation(NavigationHandle* navigation_handle) {}

void WebContentsImpl::DidRedirectNavigation(
    NavigationHandle* navigation_handle) {}

void WebContentsImpl::ReadyToCommitNavigation(
    NavigationHandle* navigation_handle) {}

void WebContentsImpl::DidFinishNavigation(NavigationHandle* navigation_handle) {}

void WebContentsImpl::DidCancelNavigationBeforeStart(
    NavigationHandle* navigation_handle) {}

void WebContentsImpl::DidFailLoadWithError(
    RenderFrameHostImpl* render_frame_host,
    const GURL& url,
    int error_code) {}

void WebContentsImpl::DraggableRegionsChanged(
    const std::vector<blink::mojom::DraggableRegionPtr>& regions) {}

void WebContentsImpl::NotifyChangedNavigationState(
    InvalidateTypes changed_flags) {}

bool WebContentsImpl::ShouldAllowRendererInitiatedCrossProcessNavigation(
    bool is_outermost_main_frame_navigation) {}

bool WebContentsImpl::ShouldPreserveAbortedURLs() {}

void WebContentsImpl::NotifyNavigationStateChangedFromController(
    InvalidateTypes changed_flags) {}

input::TouchEmulator* WebContentsImpl::GetTouchEmulator(
    bool create_if_necessary) {}

void WebContentsImpl::DidNavigateMainFramePreCommit(
    NavigationHandle* navigation_handle,
    bool navigation_is_within_page) {}

void WebContentsImpl::DidNavigateMainFramePostCommit(
    RenderFrameHostImpl* render_frame_host,
    const LoadCommittedDetails& details) {}

void WebContentsImpl::DidNavigateAnyFramePostCommit(
    RenderFrameHostImpl* render_frame_host,
    const LoadCommittedDetails& details) {}

void WebContentsImpl::DidUpdateNavigationHandleTiming(
    NavigationHandle* navigation_handle) {}

bool WebContentsImpl::CanOverscrollContent() const {}

void WebContentsImpl::OnThemeColorChanged(PageImpl& page) {}

void WebContentsImpl::OnBackgroundColorChanged(PageImpl& page) {}

void WebContentsImpl::DidInferColorScheme(PageImpl& page) {}

void WebContentsImpl::OnVirtualKeyboardModeChanged(PageImpl& page) {}

void WebContentsImpl::DidLoadResourceFromMemoryCache(
    RenderFrameHostImpl* source,
    const GURL& url,
    const std::string& http_method,
    const std::string& mime_type,
    network::mojom::RequestDestination request_destination,
    bool include_credentials) {}

void WebContentsImpl::PrimaryMainDocumentElementAvailable() {}

void WebContentsImpl::PassiveInsecureContentFound(const GURL& resource_url) {}

bool WebContentsImpl::ShouldAllowRunningInsecureContent(
    bool allowed_per_prefs,
    const url::Origin& origin,
    const GURL& resource_url) {}

void WebContentsImpl::ViewSource(RenderFrameHostImpl* frame) {}

void WebContentsImpl::ResourceLoadComplete(
    RenderFrameHostImpl* render_frame_host,
    const GlobalRequestID& request_id,
    blink::mojom::ResourceLoadInfoPtr resource_load_info) {}

const blink::web_pref::WebPreferences&
WebContentsImpl::GetOrCreateWebPreferences() {}

void WebContentsImpl::SetWebPreferences(
    const blink::web_pref::WebPreferences& prefs) {}

void WebContentsImpl::RecomputeWebPreferencesSlow() {}

std::optional<SkColor> WebContentsImpl::GetBaseBackgroundColor() {}

blink::ColorProviderColorMaps WebContentsImpl::GetColorProviderColorMaps()
    const {}

void WebContentsImpl::PrintCrossProcessSubframe(
    const gfx::Rect& rect,
    int document_cookie,
    RenderFrameHostImpl* subframe_host) {}

void WebContentsImpl::CapturePaintPreviewOfCrossProcessSubframe(
    const gfx::Rect& rect,
    const base::UnguessableToken& guid,
    RenderFrameHostImpl* render_frame_host) {}

#if BUILDFLAG(IS_ANDROID)
base::android::ScopedJavaLocalRef<jobject>
WebContentsImpl::GetJavaRenderFrameHostDelegate() {
  return GetJavaWebContents();
}
#endif

void WebContentsImpl::DOMContentLoaded(RenderFrameHostImpl* render_frame_host) {}

void WebContentsImpl::OnDidFinishLoad(RenderFrameHostImpl* render_frame_host,
                                      const GURL& url) {}

bool WebContentsImpl::IsAllowedToGoToEntryAtOffset(int32_t offset) {}

void WebContentsImpl::OnPageScaleFactorChanged(PageImpl& source) {}

void WebContentsImpl::EnumerateDirectory(
    base::WeakPtr<FileChooserImpl> file_chooser,
    RenderFrameHost* render_frame_host,
    scoped_refptr<FileChooserImpl::FileSelectListenerImpl> listener,
    const base::FilePath& directory_path) {}

void WebContentsImpl::RegisterProtocolHandler(RenderFrameHostImpl* source,
                                              const std::string& protocol,
                                              const GURL& url,
                                              bool user_gesture) {}

void WebContentsImpl::UnregisterProtocolHandler(RenderFrameHostImpl* source,
                                                const std::string& protocol,
                                                const GURL& url,
                                                bool user_gesture) {}

void WebContentsImpl::DomOperationResponse(RenderFrameHost* render_frame_host,
                                           const std::string& json_string) {}

void WebContentsImpl::SavableResourceLinksResponse(
    RenderFrameHostImpl* source,
    const std::vector<GURL>& resources_list,
    blink::mojom::ReferrerPtr referrer,
    const std::vector<blink::mojom::SavableSubframePtr>& subframes) {}

void WebContentsImpl::SavableResourceLinksError(RenderFrameHostImpl* source) {}

void WebContentsImpl::OnServiceWorkerAccessed(
    RenderFrameHost* render_frame_host,
    const GURL& scope,
    AllowServiceWorkerResult allowed) {}

void WebContentsImpl::OnServiceWorkerAccessed(
    NavigationHandle* navigation,
    const GURL& scope,
    AllowServiceWorkerResult allowed) {}

void WebContentsImpl::OnColorChooserFactoryReceiver(
    mojo::PendingReceiver<blink::mojom::ColorChooserFactory> receiver) {}

#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)
void WebContentsImpl::OpenColorChooser(
    mojo::PendingReceiver<blink::mojom::ColorChooser> chooser_receiver,
    mojo::PendingRemote<blink::mojom::ColorChooserClient> client,
    SkColor color,
    std::vector<blink::mojom::ColorSuggestionPtr> suggestions) {
  OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::OpenColorChooser");
  // Create `color_chooser_holder_` before calling OpenColorChooser since
  // OpenColorChooser may callback with results.
  color_chooser_holder_.reset();
  color_chooser_holder_ = std::make_unique<ColorChooserHolder>(
      std::move(chooser_receiver), std::move(client));

  auto new_color_chooser =
      delegate_ ? delegate_->OpenColorChooser(this, color, suggestions)
                : nullptr;
  if (color_chooser_holder_ && new_color_chooser) {
    color_chooser_holder_->SetChooser(std::move(new_color_chooser));
  } else if (new_color_chooser) {
    // OpenColorChooser synchronously called back to DidEndColorChooser.
    DCHECK(!color_chooser_holder_);
    new_color_chooser->End();
  } else if (color_chooser_holder_) {
    DCHECK(!new_color_chooser);
    color_chooser_holder_.reset();
  }
}
#endif  // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_IOS)

#if BUILDFLAG(ENABLE_PPAPI)
void WebContentsImpl::OnPepperInstanceCreated(RenderFrameHostImpl* source,
                                              int32_t pp_instance) {
  OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::OnPepperInstanceCreated",
                        "render_frame_host", source);
  observers_.NotifyObservers(&WebContentsObserver::PepperInstanceCreated);
  pepper_playback_observer_->PepperInstanceCreated(source, pp_instance);
}

void WebContentsImpl::OnPepperInstanceDeleted(RenderFrameHostImpl* source,
                                              int32_t pp_instance) {
  OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::OnPepperInstanceDeleted",
                        "render_frame_host", source);
  observers_.NotifyObservers(&WebContentsObserver::PepperInstanceDeleted);
  pepper_playback_observer_->PepperInstanceDeleted(source, pp_instance);
}

void WebContentsImpl::OnPepperPluginHung(RenderFrameHostImpl* source,
                                         int plugin_child_id,
                                         const base::FilePath& path,
                                         bool is_hung) {
  OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::OnPepperPluginHung",
                        "render_frame_host", source);
  observers_.NotifyObservers(&WebContentsObserver::PluginHungStatusChanged,
                             plugin_child_id, path, is_hung);
}

void WebContentsImpl::OnPepperStartsPlayback(RenderFrameHostImpl* source,
                                             int32_t pp_instance) {
  OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::OnPepperStartsPlayback",
                        "render_frame_host", source);
  pepper_playback_observer_->PepperStartsPlayback(source, pp_instance);
}

void WebContentsImpl::OnPepperStopsPlayback(RenderFrameHostImpl* source,
                                            int32_t pp_instance) {
  OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::OnPepperStopsPlayback",
                        "render_frame_host", source);
  pepper_playback_observer_->PepperStopsPlayback(source, pp_instance);
}

void WebContentsImpl::OnPepperPluginCrashed(RenderFrameHostImpl* source,
                                            const base::FilePath& plugin_path,
                                            base::ProcessId plugin_pid) {
  OPTIONAL_TRACE_EVENT1("content", "WebContentsImpl::OnPepperPluginCrashed",
                        "render_frame_host", source);
  // TODO(nick): Eliminate the |plugin_pid| parameter, which can't be trusted,
  // and is only used by WebTestControlHost.
  observers_.NotifyObservers(&WebContentsObserver::PluginCrashed, plugin_path,
                             plugin_pid);
}

#endif  // BUILDFLAG(ENABLE_PPAPI)

void WebContentsImpl::UpdateFaviconURL(
    RenderFrameHostImpl* source,
    const std::vector<blink::mojom::FaviconURLPtr>& candidates) {}

void WebContentsImpl::SetIsOverlayContent(bool is_overlay_content) {}

void WebContentsImpl::OnFirstVisuallyNonEmptyPaint(PageImpl& page) {}

bool WebContentsImpl::IsGuest() {}

void WebContentsImpl::NotifyBeforeFormRepostWarningShow() {}

void WebContentsImpl::ActivateAndShowRepostFormWarningDialog() {}

bool WebContentsImpl::HasAccessedInitialDocument() {}

void WebContentsImpl::UpdateTitleForEntry(NavigationEntry* entry,
                                          const std::u16string& title) {}

bool WebContentsImpl::UpdateTitleForEntryImpl(NavigationEntryImpl* entry,
                                              const std::u16string& title) {}

void WebContentsImpl::NotifyTitleUpdateForEntry(NavigationEntryImpl* entry) {}

NavigationEntry* WebContentsImpl::GetNavigationEntryForTitle() {}

void WebContentsImpl::SendChangeLoadProgress() {}

void WebContentsImpl::ResetLoadProgressState() {}

// Notifies the RenderWidgetHost instance about the fact that the page is
// loading, or done loading.
void WebContentsImpl::LoadingStateChanged(LoadingState new_state) {}

void WebContentsImpl::NotifyViewSwapped(RenderViewHost* old_view,
                                        RenderViewHost* new_view) {}

void WebContentsImpl::NotifyFrameSwapped(RenderFrameHostImpl* old_frame,
                                         RenderFrameHostImpl* new_frame) {}

void WebContentsImpl::NotifyNavigationEntryCommitted(
    const LoadCommittedDetails& load_details) {}

void WebContentsImpl::NotifyNavigationEntryChanged(
    const EntryChangedDetails& change_details) {}

void WebContentsImpl::NotifyNavigationListPruned(
    const PrunedDetails& pruned_details) {}

void WebContentsImpl::NotifyNavigationEntriesDeleted() {}

void WebContentsImpl::OnDidBlockNavigation(
    const GURL& blocked_url,
    const GURL& initiator_url,
    blink::mojom::NavigationBlockedReason reason) {}

void WebContentsImpl::RenderFrameCreated(
    RenderFrameHostImpl* render_frame_host) {}

void WebContentsImpl::RenderFrameDeleted(
    RenderFrameHostImpl* render_frame_host) {}

void WebContentsImpl::ShowContextMenu(
    RenderFrameHost& render_frame_host,
    mojo::PendingAssociatedRemote<blink::mojom::ContextMenuClient>
        context_menu_client,
    const ContextMenuParams& params) {}

namespace {
// Normalizes the line endings: \r\n -> \n, lone \r -> \n.
std::u16string NormalizeLineBreaks(const std::u16string& source) {}
}  // namespace

void WebContentsImpl::RunJavaScriptDialog(
    RenderFrameHostImpl* render_frame_host,
    const std::u16string& message,
    const std::u16string& default_prompt,
    JavaScriptDialogType dialog_type,
    bool disable_third_party_subframe_suppresion,
    JavaScriptDialogCallback response_callback) {}

void WebContentsImpl::NotifyOnJavaScriptDialogDismiss(
    base::OnceClosure callback) {}

void WebContentsImpl::RunBeforeUnloadConfirm(
    RenderFrameHostImpl* render_frame_host,
    bool is_reload,
    JavaScriptDialogCallback response_callback) {}

void WebContentsImpl::RunFileChooser(
    base::WeakPtr<FileChooserImpl> file_chooser,
    RenderFrameHost* render_frame_host,
    scoped_refptr<FileChooserImpl::FileSelectListenerImpl> listener,
    const blink::mojom::FileChooserParams& params) {}

double WebContentsImpl::GetPendingPageZoomLevel() {}

bool WebContentsImpl::IsPictureInPictureAllowedForFullscreenVideo() const {}

bool WebContentsImpl::IsFocusedElementEditable() {}

bool WebContentsImpl::IsShowingContextMenu() {}

void WebContentsImpl::SetShowingContextMenu(bool showing) {}

void WebContentsImpl::ClearFocusedElement() {}

bool WebContentsImpl::IsNeverComposited() {}

RenderViewHostDelegateView* WebContentsImpl::GetDelegateView() {}

const blink::RendererPreferences& WebContentsImpl::GetRendererPrefs() const {}

RenderFrameHostImpl* WebContentsImpl::GetOuterWebContentsFrame() {}

WebContentsImpl* WebContentsImpl::GetOuterWebContents() {}

std::vector<WebContents*> WebContentsImpl::GetInnerWebContents() {}

WebContentsImpl* WebContentsImpl::GetResponsibleWebContents() {}

WebContentsImpl* WebContentsImpl::GetFocusedWebContents() {}

FrameTree* WebContentsImpl::GetFocusedFrameTree() {}

void WebContentsImpl::SetFocusToLocationBar() {}

bool WebContentsImpl::ContainsOrIsFocusedWebContents() {}

void WebContentsImpl::RemoveBrowserPluginEmbedder() {}

WebContentsImpl* WebContentsImpl::GetOutermostWebContents() {}

void WebContentsImpl::InnerWebContentsCreated(WebContents* inner_web_contents) {}

void WebContentsImpl::InnerWebContentsAttached(
    WebContents* inner_web_contents) {}

void WebContentsImpl::InnerWebContentsDetached(
    WebContents* inner_web_contents) {}

void WebContentsImpl::RenderViewReady(RenderViewHost* rvh) {}

void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh,
                                           base::TerminationStatus status,
                                           int error_code) {}

void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) {}

void WebContentsImpl::ClearTargetURL() {}

void WebContentsImpl::Close() {}

void WebContentsImpl::SetWindowRect(const gfx::Rect& new_bounds) {}

void WebContentsImpl::UpdateWindowPreferredSize(const gfx::Size& pref_size) {}

std::vector<RenderFrameHostImpl*>
WebContentsImpl::GetActiveTopLevelDocumentsInGroup(
    RenderFrameHostImpl* render_frame_host,
    GroupType group_type) {}

std::vector<RenderFrameHostImpl*>
WebContentsImpl::GetActiveTopLevelDocumentsInBrowsingContextGroup(
    RenderFrameHostImpl* render_frame_host) {}

std::vector<RenderFrameHostImpl*>
WebContentsImpl::GetActiveTopLevelDocumentsInCoopRelatedGroup(
    RenderFrameHostImpl* render_frame_host) {}

PrerenderHostRegistry* WebContentsImpl::GetPrerenderHostRegistry() {}

void WebContentsImpl::DidStartLoading(FrameTreeNode* frame_tree_node) {}

void WebContentsImpl::DidStopLoading() {}

void WebContentsImpl::DidChangeLoadProgressForPrimaryMainFrame() {}

bool WebContentsImpl::IsHidden() {}

std::vector<std::unique_ptr<NavigationThrottle>>
WebContentsImpl::CreateThrottlesForNavigation(
    NavigationHandle* navigation_handle) {}

std::vector<std::unique_ptr<CommitDeferringCondition>>
WebContentsImpl::CreateDeferringConditionsForNavigationCommit(
    NavigationHandle& navigation_handle,
    CommitDeferringCondition::NavigationType type) {}

std::unique_ptr<NavigationUIData> WebContentsImpl::GetNavigationUIData(
    NavigationHandle* navigation_handle) {}

void WebContentsImpl::RegisterExistingOriginAsHavingDefaultIsolation(
    const url::Origin& origin,
    NavigationRequest* navigation_request_to_exclude) {}

bool WebContentsImpl::MaybeCopyContentAreaAsBitmap(
    base::OnceCallback<void(const SkBitmap&)> callback) {}

void WebContentsImpl::DidChangeName(RenderFrameHostImpl* render_frame_host,
                                    const std::string& name) {}

void WebContentsImpl::DidReceiveUserActivation(
    RenderFrameHostImpl* render_frame_host) {}

void WebContentsImpl::WebAuthnAssertionRequestSucceeded(
    RenderFrameHostImpl* render_frame_host) {}

void WebContentsImpl::BindDisplayCutoutHost(
    RenderFrameHostImpl* render_frame_host,
    mojo::PendingAssociatedReceiver<blink::mojom::DisplayCutoutHost> receiver) {}

void WebContentsImpl::DidChangeDisplayState(
    RenderFrameHostImpl* render_frame_host,
    bool is_display_none) {}

void WebContentsImpl::FrameSizeChanged(RenderFrameHostImpl* render_frame_host,
                                       const gfx::Size& frame_size) {}

void WebContentsImpl::DocumentOnLoadCompleted(
    RenderFrameHostImpl* render_frame_host) {}

void WebContentsImpl::UpdateTitle(RenderFrameHostImpl* render_frame_host,
                                  const std::u16string& title,
                                  base::i18n::TextDirection title_direction) {}

void WebContentsImpl::UpdateAppTitle(RenderFrameHostImpl* render_frame_host,
                                     const std::u16string& app_title) {}

void WebContentsImpl::UpdateTargetURL(RenderFrameHostImpl* render_frame_host,
                                      const GURL& url) {}

bool WebContentsImpl::ShouldRouteMessageEvent(
    RenderFrameHostImpl* target_rfh) const {}

void WebContentsImpl::EnsureOpenerProxiesExist(
    RenderFrameHostImpl* source_rfh) {}

void WebContentsImpl::SetAsFocusedWebContentsIfNecessary() {}

void WebContentsImpl::SetFocusedFrameTree(FrameTree* frame_tree_to_focus) {}

void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
                                      SiteInstanceGroup* source) {}

FrameTree* WebContentsImpl::GetOwnedPictureInPictureFrameTree() {}

FrameTree* WebContentsImpl::GetPictureInPictureOpenerFrameTree() {}

void WebContentsImpl::DidCallFocus() {}

void WebContentsImpl::OnAdvanceFocus(RenderFrameHostImpl* source_rfh) {}

void WebContentsImpl::OnFocusedElementChangedInFrame(
    RenderFrameHostImpl* frame,
    const gfx::Rect& bounds_in_root_view,
    blink::mojom::FocusType focus_type) {}

bool WebContentsImpl::DidAddMessageToConsole(
    RenderFrameHostImpl* source_frame,
    blink::mojom::ConsoleMessageLevel log_level,
    const std::u16string& message,
    int32_t line_no,
    const std::u16string& source_id,
    const std::optional<std::u16string>& untrusted_stack_trace) {}

void WebContentsImpl::DidReceiveInputEvent(
    RenderWidgetHostImpl* render_widget_host,
    const blink::WebInputEvent& event) {}

bool WebContentsImpl::ShouldIgnoreWebInputEvents(
    const blink::WebInputEvent& event) {}

bool WebContentsImpl::ShouldIgnoreInputEvents() {}

void WebContentsImpl::FocusOwningWebContents(
    RenderWidgetHostImpl* render_widget_host) {}

void WebContentsImpl::OnIgnoredUIEvent() {}

void WebContentsImpl::RendererUnresponsive(
    RenderWidgetHostImpl* render_widget_host,
    base::RepeatingClosure hang_monitor_restarter) {}

void WebContentsImpl::RendererResponsive(
    RenderWidgetHostImpl* render_widget_host) {}

void WebContentsImpl::BeforeUnloadFiredFromRenderManager(
    bool proceed,
    bool* proceed_to_fire_unload) {}

void WebContentsImpl::CancelModalDialogsForRenderManager() {}

void WebContentsImpl::NotifySwappedFromRenderManager(
    RenderFrameHostImpl* old_frame,
    RenderFrameHostImpl* new_frame) {}

void WebContentsImpl::NotifySwappedFromRenderManagerWithoutFallbackContent(
    RenderFrameHostImpl* new_frame) {}

void WebContentsImpl::NotifyMainFrameSwappedFromRenderManager(
    RenderFrameHostImpl* old_frame,
    RenderFrameHostImpl* new_frame) {}

void WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(
    RenderViewHost* render_view_host) {}

void WebContentsImpl::ReattachOuterDelegateIfNeeded() {}

bool WebContentsImpl::CreateRenderViewForRenderManager(
    RenderViewHost* render_view_host,
    const std::optional<blink::FrameToken>& opener_frame_token,
    RenderFrameProxyHost* proxy_host) {}

#if BUILDFLAG(IS_ANDROID)

base::android::ScopedJavaLocalRef<jobject>
WebContentsImpl::GetJavaWebContents() {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  return GetWebContentsAndroid()->GetJavaObject();
}

base::android::ScopedJavaLocalRef<jthrowable>
WebContentsImpl::GetJavaCreatorLocation() {
  return base::android::ScopedJavaLocalRef<jthrowable>(java_creator_location_);
}

WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() {
  if (!web_contents_android_) {
    web_contents_android_ = std::make_unique<WebContentsAndroid>(this);
  }
  return web_contents_android_.get();
}

void WebContentsImpl::ClearWebContentsAndroid() {
  DCHECK_CURRENTLY_ON(BrowserThread::UI);
  web_contents_android_.reset();
}

void WebContentsImpl::ActivateNearestFindResult(float x, float y) {
  OPTIONAL_TRACE_EVENT0("content",
                        "WebContentsImpl::ActivateNearestFindResult");
  GetOrCreateFindRequestManager()->ActivateNearestFindResult(x, y);
}

void WebContentsImpl::RequestFindMatchRects(int current_version) {
  OPTIONAL_TRACE_EVENT0("content", "WebContentsImpl::RequestFindMatchRects");
  GetOrCreateFindRequestManager()->RequestFindMatchRects(current_version);
}

service_manager::InterfaceProvider* WebContentsImpl::GetJavaInterfaces() {
  if (!java_interfaces_) {
    mojo::PendingRemote<service_manager::mojom::InterfaceProvider> provider;
    BindInterfaceRegistryForWebContents(
        provider.InitWithNewPipeAndPassReceiver(), this);
    java_interfaces_ = std::make_unique<service_manager::InterfaceProvider>(
        base::SingleThreadTaskRunner::GetCurrentDefault());
    java_interfaces_->Bind(std::move(provider));
  }
  return java_interfaces_.get();
}

#endif

bool WebContentsImpl::CompletedFirstVisuallyNonEmptyPaint() {}

void WebContentsImpl::OnDidDownloadImage(
    base::WeakPtr<RenderFrameHostImpl> rfh,
    ImageDownloadCallback callback,
    int id,
    const GURL& image_url,
    int32_t http_status_code,
    const std::vector<SkBitmap>& images,
    const std::vector<gfx::Size>& original_image_sizes) {}

int WebContentsImpl::GetNextDownloadId() {}

void WebContentsImpl::OnDialogClosed(int render_process_id,
                                     int render_frame_id,
                                     JavaScriptDialogCallback response_callback,
                                     base::ScopedClosureRunner fullscreen_block,
                                     bool dialog_was_suppressed,
                                     bool success,
                                     const std::u16string& user_input) {}

RenderFrameHostManager* WebContentsImpl::GetRenderManager() {}

BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() const {}

void WebContentsImpl::SetBrowserPluginGuest(
    std::unique_ptr<BrowserPluginGuest> guest) {}

base::UnguessableToken WebContentsImpl::GetAudioGroupId() {}

const std::vector<blink::mojom::FaviconURLPtr>&
WebContentsImpl::GetFaviconURLs() {}

// The Mac implementation  of the next two methods is in
// web_contents_impl_mac.mm
#if !BUILDFLAG(IS_MAC)

void WebContentsImpl::Resize(const gfx::Rect& new_bounds) {}

gfx::Size WebContentsImpl::GetSize() {}

#endif  // !BUILDFLAG(IS_MAC)

gfx::Rect WebContentsImpl::GetWindowsControlsOverlayRect() const {}

void WebContentsImpl::UpdateWindowControlsOverlay(
    const gfx::Rect& bounding_rect) {}

BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const {}

void WebContentsImpl::CreateBrowserPluginEmbedderIfNecessary() {}

gfx::Size WebContentsImpl::GetSizeForMainFrame() {}

void WebContentsImpl::OnFrameTreeNodeDestroyed(FrameTreeNode* node) {}

void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) {}

FindRequestManager* WebContentsImpl::GetFindRequestManager() {}

FindRequestManager* WebContentsImpl::GetOrCreateFindRequestManager() {}

void WebContentsImpl::NotifyFindReply(int request_id,
                                      int number_of_matches,
                                      const gfx::Rect& selection_rect,
                                      int active_match_ordinal,
                                      bool final_update) {}

void WebContentsImpl::IncrementBluetoothConnectedDeviceCount() {}

void WebContentsImpl::DecrementBluetoothConnectedDeviceCount() {}

void WebContentsImpl::OnIsConnectedToBluetoothDeviceChanged(
    bool is_connected_to_bluetooth_device) {}

void WebContentsImpl::IncrementBluetoothScanningSessionsCount() {}

void WebContentsImpl::DecrementBluetoothScanningSessionsCount() {}

void WebContentsImpl::IncrementSerialActiveFrameCount() {}

void WebContentsImpl::DecrementSerialActiveFrameCount() {}

void WebContentsImpl::IncrementHidActiveFrameCount() {}

void WebContentsImpl::DecrementHidActiveFrameCount() {}

void WebContentsImpl::OnIsConnectedToUsbDeviceChanged(
    bool is_connected_to_usb_device) {}

void WebContentsImpl::IncrementUsbActiveFrameCount() {}

void WebContentsImpl::DecrementUsbActiveFrameCount() {}

void WebContentsImpl::IncrementFileSystemAccessHandleCount() {}

void WebContentsImpl::DecrementFileSystemAccessHandleCount() {}

void WebContentsImpl::SetHasPersistentVideo(bool has_persistent_video) {}

void WebContentsImpl::SetSpatialNavigationDisabled(bool disabled) {}

void WebContentsImpl::SetStylusHandwritingEnabled(bool enabled) {}

PictureInPictureResult WebContentsImpl::EnterPictureInPicture() {}

void WebContentsImpl::ExitPictureInPicture() {}

void WebContentsImpl::OnXrHasRenderTarget(
    const viz::FrameSinkId& frame_sink_id) {}

WebContentsImpl::CaptureTarget WebContentsImpl::GetCaptureTarget() {}

#if BUILDFLAG(IS_ANDROID)
void WebContentsImpl::NotifyFindMatchRectsReply(
    int version,
    const std::vector<gfx::RectF>& rects,
    const gfx::RectF& active_rect) {
  OPTIONAL_TRACE_EVENT0("content",
                        "WebContentsImpl::NotifyFindMatchRectsReply");
  if (delegate_) {
    delegate_->FindMatchRectsReply(this, version, rects, active_rect);
  }
}
#endif

void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) {}

bool WebContentsImpl::SetDeviceEmulationSize(const gfx::Size& new_size) {}

void WebContentsImpl::ClearDeviceEmulationSize() {}

ForwardingAudioStreamFactory* WebContentsImpl::GetAudioStreamFactory() {}

void WebContentsImpl::MediaStartedPlaying(
    const WebContentsObserver::MediaPlayerInfo& media_info,
    const MediaPlayerId& id) {}

void WebContentsImpl::MediaStoppedPlaying(
    const WebContentsObserver::MediaPlayerInfo& media_info,
    const MediaPlayerId& id,
    WebContentsObserver::MediaStoppedReason reason) {}

void WebContentsImpl::MediaResized(const gfx::Size& size,
                                   const MediaPlayerId& id) {}

void WebContentsImpl::MediaEffectivelyFullscreenChanged(bool is_fullscreen) {}

void WebContentsImpl::MediaDestroyed(const MediaPlayerId& id) {}

void WebContentsImpl::MediaSessionCreated(MediaSession* media_session) {}

int WebContentsImpl::GetCurrentlyPlayingVideoCount() {}

std::optional<gfx::Size> WebContentsImpl::GetFullscreenVideoSize() {}

void WebContentsImpl::AudioContextPlaybackStarted(RenderFrameHostImpl* host,
                                                  int context_id) {}

void WebContentsImpl::AudioContextPlaybackStopped(RenderFrameHostImpl* host,
                                                  int context_id) {}

void WebContentsImpl::OnFrameAudioStateChanged(RenderFrameHostImpl* host,
                                               bool is_audible) {}

void WebContentsImpl::OnFrameVisibilityChanged(
    RenderFrameHostImpl* host,
    blink::mojom::FrameVisibility visibility) {}

void WebContentsImpl::OnFrameIsCapturingMediaStreamChanged(
    RenderFrameHostImpl* host,
    bool is_capturing_media_stream) {}

// Cf. `GetProspectiveOuterDocument` which applies to the same situation, but is
// for ascending.
std::vector<FrameTreeNode*> WebContentsImpl::GetUnattachedOwnedNodes(
    RenderFrameHostImpl* owner) {}

void WebContentsImpl::IsClipboardPasteAllowedByPolicy(
    const ClipboardEndpoint& source,
    const ClipboardEndpoint& destination,
    const ClipboardMetadata& metadata,
    ClipboardPasteData clipboard_paste_data,
    IsClipboardPasteAllowedCallback callback) {}

void WebContentsImpl::OnTextCopiedToClipboard(
    RenderFrameHostImpl* render_frame_host,
    const std::u16string& copied_text) {}

void WebContentsImpl::IsClipboardPasteAllowedWrapperCallback(
    IsClipboardPasteAllowedCallback callback,
    std::optional<ClipboardPasteData> clipboard_paste_data) {}

void WebContentsImpl::BindScreenOrientation(
    RenderFrameHost* rfh,
    mojo::PendingAssociatedReceiver<device::mojom::ScreenOrientation>
        receiver) {}

bool WebContentsImpl::IsTransientActivationRequiredForHtmlFullscreen() {}

bool WebContentsImpl::IsBackForwardCacheSupported() {}

FrameTree* WebContentsImpl::LoadingTree() {}

void WebContentsImpl::DidChangeScreenOrientation() {}

void WebContentsImpl::UpdateWebContentsVisibility(Visibility visibility) {}

void WebContentsImpl::UpdateOverridingUserAgent() {}

void WebContentsImpl::SetJavaScriptDialogManagerForTesting(
    JavaScriptDialogManager* dialog_manager) {}

void WebContentsImpl::ShowInsecureLocalhostWarningIfNeeded(PageImpl& page) {}

bool WebContentsImpl::IsShowingContextMenuOnPage() const {}

download::DownloadUrlParameters::RequestHeadersType
WebContentsImpl::ParseDownloadHeaders(const std::string& headers) {}

void WebContentsImpl::SetOpenerForNewContents(FrameTreeNode* opener,
                                              bool opener_suppressed) {}

void WebContentsImpl::MediaMutedStatusChanged(const MediaPlayerId& id,
                                              bool muted) {}

void WebContentsImpl::SetVisibilityForChildViews(bool visible) {}

void WebContentsImpl::OnNativeThemeUpdated(ui::NativeTheme* observed_theme) {}

void WebContentsImpl::OnCaptionStyleUpdated() {}

void WebContentsImpl::OnColorProviderChanged() {}

const ui::ColorProvider& WebContentsImpl::GetColorProvider() const {}

blink::mojom::FrameWidgetInputHandler*
WebContentsImpl::GetFocusedFrameWidgetInputHandler() {}

ukm::SourceId WebContentsImpl::GetCurrentPageUkmSourceId() {}

void WebContentsImpl::ForEachRenderViewHost(
    ForEachRenderViewHostTypes view_mask,
    RenderViewHostIterationCallback on_render_view_host) {}

void WebContentsImpl::NotifyPageBecamePrimary(PageImpl& page) {}

bool WebContentsImpl::IsPageInPreviewMode() const {}

void WebContentsImpl::CancelPreviewByMojoBinderPolicy(
    const std::string& interface_name) {}

void WebContentsImpl::OnCanResizeFromWebAPIChanged() {}

int WebContentsImpl::GetOuterDelegateFrameTreeNodeId() {}

// Cf. `GetUnattachedOwnedNodes` which applies to the same situation, but is for
// descending.
RenderFrameHostImpl* WebContentsImpl::GetProspectiveOuterDocument() {}

void WebContentsImpl::RenderFrameHostStateChanged(
    RenderFrameHost* render_frame_host,
    LifecycleState old_state,
    LifecycleState new_state) {}

void WebContentsImpl::DecrementCapturerCount(bool stay_hidden,
                                             bool stay_awake,
                                             bool is_activity) {}

void WebContentsImpl::NotifyPrimaryMainFrameProcessIsAlive() {}

void WebContentsImpl::UpdateBrowserControlsState(
    cc::BrowserControlsState constraints,
    cc::BrowserControlsState current,
    bool animate,
    const std::optional<cc::BrowserControlsOffsetTagsInfo>& offset_tags_info) {}

void WebContentsImpl::SetV8CompileHints(base::ReadOnlySharedMemoryRegion data) {}

void WebContentsImpl::SetTabSwitchStartTime(base::TimeTicks start_time,
                                            bool destination_is_loaded) {}

bool WebContentsImpl::IsInPreviewMode() const {}

void WebContentsImpl::WillActivatePreviewPage() {}

void WebContentsImpl::ActivatePreviewPage() {}

VisibleTimeRequestTrigger& WebContentsImpl::GetVisibleTimeRequestTrigger() {}

gfx::mojom::DelegatedInkPointRenderer* WebContentsImpl::GetDelegatedInkRenderer(
    ui::Compositor* compositor) {}

void WebContentsImpl::OnInputIgnored(const blink::WebInputEvent& event) {}

void WebContentsImpl::StartPrefetch(
    const GURL& prefetch_url,
    bool use_prefetch_proxy,
    const blink::mojom::Referrer& referrer,
    const std::optional<url::Origin>& referring_origin,
    base::WeakPtr<PreloadingAttempt> attempt) {}

std::unique_ptr<PrerenderHandle> WebContentsImpl::StartPrerendering(
    const GURL& prerendering_url,
    PreloadingTriggerType trigger_type,
    const std::string& embedder_histogram_suffix,
    ui::PageTransition page_transition,
    bool should_warm_up_compositor,
    PreloadingHoldbackStatus holdback_status_override,
    PreloadingAttempt* preloading_attempt,
    base::RepeatingCallback<bool(const GURL&,
                                 const std::optional<UrlMatchType>&)>
        url_match_predicate,
    base::RepeatingCallback<void(NavigationHandle&)>
        prerender_navigation_handle_callback) {}

void WebContentsImpl::CancelAllPrerendering() {}

void WebContentsImpl::BackNavigationLikely(PreloadingPredictor predictor,
                                           WindowOpenDisposition disposition) {}

void WebContentsImpl::SetOwnerLocationForDebug(
    std::optional<base::Location> owner_location) {}

void WebContentsImpl::AboutToBeDiscarded(WebContents* new_contents) {}

base::ScopedClosureRunner WebContentsImpl::CreateDisallowCustomCursorScope(
    int max_dimension_dips) {}

bool WebContentsImpl::CancelPrerendering(FrameTreeNode* frame_tree_node,
                                         PrerenderFinalStatus final_status) {}

ui::mojom::VirtualKeyboardMode WebContentsImpl::GetVirtualKeyboardMode() const {}

// static
std::pair<int, int> WebContentsImpl::GetAvailablePointerAndHoverTypes() {}

void WebContentsImpl::SetOverscrollNavigationEnabled(bool enabled) {}

network::mojom::AttributionSupport WebContentsImpl::GetAttributionSupport() {}

void WebContentsImpl::UpdateAttributionSupportRenderer() {}

BackForwardTransitionAnimationManager*
WebContentsImpl::GetBackForwardTransitionAnimationManager() {}

#if BUILDFLAG(IS_ANDROID)
void WebContentsImpl::SetLongPressLinkSelectText(bool enabled) {
  if (long_press_link_select_text_ == enabled) {
    return;
  }
  long_press_link_select_text_ = enabled;
  NotifyPreferencesChanged();
}
#endif

net::handles::NetworkHandle WebContentsImpl::GetTargetNetwork() {}

// static
void WebContentsImpl::UpdateAttributionSupportAllRenderers() {}

void WebContentsImpl::GetMediaCaptureRawDeviceIdsOpened(
    blink::mojom::MediaStreamType type,
    base::OnceCallback<void(std::vector<std::string>)> callback) {}

void WebContentsImpl::WarmUpAndroidSpareRenderer() {}

void WebContentsImpl::SetPartitionedPopinOpenerOnNewWindowIfNeeded(
    WebContentsImpl* new_window,
    const mojom::CreateNewWindowParams& params,
    RenderFrameHostImpl* opener) {}

}  // namespace content