chromium/components/guest_view/browser/guest_view_base.cc

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

#include "components/guest_view/browser/guest_view_base.h"

#include <memory>
#include <optional>
#include <utility>

#include "base/functional/bind.h"
#include "base/lazy_instance.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "components/guest_view/browser/guest_view_event.h"
#include "components/guest_view/browser/guest_view_manager.h"
#include "components/guest_view/common/guest_view_constants.h"
#include "components/zoom/zoom_controller.h"
#include "content/public/browser/file_select_listener.h"
#include "content/public/browser/isolated_web_apps_policy.h"
#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/permission_result.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/render_widget_host_view.h"
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "third_party/blink/public/common/input/web_gesture_event.h"
#include "third_party/blink/public/common/page/page_zoom.h"

WebContents;

namespace guest_view {

namespace {

void DestroyGuestIfUnattached(GuestViewBase* guest) {}

}  // namespace

SetSizeParams::SetSizeParams() = default;
SetSizeParams::~SetSizeParams() = default;

// This observer ensures that unattached guests don't outlive their owner
// WebContents. It also tracks when the embedder's fullscreen is toggled so the
// guest can change itself accordingly.
class GuestViewBase::OwnerContentsObserver : public WebContentsObserver {};

// This observer ensures that a GuestViewBase is destroyed if if its opener
// WebContents goes away before the GuestViewBase is attached.
// TODO(mcnee): This behaviour is WebViewGuest specific and could be moved there
// instead.
class GuestViewBase::OpenerLifetimeObserver : public WebContentsObserver {};

GuestViewBase::GuestViewBase(content::RenderFrameHost* owner_rfh)
    :{}

GuestViewBase::~GuestViewBase() {}

void GuestViewBase::Init(std::unique_ptr<GuestViewBase> owned_this,
                         const base::Value::Dict& create_params,
                         GuestCreatedCallback callback) {}

void GuestViewBase::InitWithWebContents(const base::Value::Dict& create_params,
                                        WebContents* guest_web_contents) {}

const std::optional<
    std::pair<base::Value::Dict, content::WebContents::CreateParams>>&
GuestViewBase::GetCreateParams() const {}

void GuestViewBase::SetCreateParams(
    const base::Value::Dict& create_params,
    const content::WebContents::CreateParams& web_contents_create_params) {}

void GuestViewBase::DispatchOnResizeEvent(const gfx::Size& old_size,
                                          const gfx::Size& new_size) {}

gfx::Size GuestViewBase::GetDefaultSize() const {}

void GuestViewBase::SetSize(const SetSizeParams& params) {}

// static
GuestViewBase* GuestViewBase::FromWebContents(WebContents* web_contents) {}

// static
GuestViewBase* GuestViewBase::FromRenderFrameHost(
    content::RenderFrameHost* rfh) {}

// static
GuestViewBase* GuestViewBase::FromRenderFrameHostId(
    const content::GlobalRenderFrameHostId& rfh_id) {}

// static
GuestViewBase* GuestViewBase::FromInstanceID(int owner_process_id,
                                             int guest_instance_id) {}

// static
WebContents* GuestViewBase::GetTopLevelWebContents(WebContents* web_contents) {}

// static
bool GuestViewBase::IsGuest(WebContents* web_contents) {}

// static
bool GuestViewBase::IsGuest(content::RenderFrameHost* rfh) {}

// static
bool GuestViewBase::IsGuest(const content::GlobalRenderFrameHostId& rfh_id) {}

bool GuestViewBase::IsAutoSizeSupported() const {}

bool GuestViewBase::IsPreferredSizeModeEnabled() const {}

bool GuestViewBase::ZoomPropagatesFromEmbedderToGuest() const {}

content::NavigationController& GuestViewBase::GetController() {}

GuestViewManager* GuestViewBase::GetGuestViewManager() const {}

std::unique_ptr<WebContents> GuestViewBase::CreateNewGuestWindow(
    const WebContents::CreateParams& create_params) {}

void GuestViewBase::DidAttach() {}

WebContents* GuestViewBase::GetOwnerWebContents() {}

content::RenderFrameHost* GuestViewBase::GetProspectiveOuterDocument() {}

const GURL& GuestViewBase::GetOwnerLastCommittedURL() const {}

const GURL& GuestViewBase::GetOwnerSiteURL() const {}

void GuestViewBase::SetAttachParams(const base::Value::Dict& params) {}

void GuestViewBase::SetOpener(GuestViewBase* guest) {}

void GuestViewBase::AttachToOuterWebContentsFrame(
    std::unique_ptr<GuestViewBase> owned_this,
    content::RenderFrameHost* outer_contents_frame,
    int element_instance_id,
    bool is_full_page_plugin,
    GuestViewMessageHandler::AttachToEmbedderFrameCallback
        attachment_callback) {}

void GuestViewBase::OnOwnerAudioMutedStateUpdated(bool muted) {}

void GuestViewBase::SignalWhenReady(base::OnceClosure callback) {}

int GuestViewBase::LogicalPixelsToPhysicalPixels(double logical_pixels) const {}

double GuestViewBase::PhysicalPixelsToLogicalPixels(int physical_pixels) const {}

void GuestViewBase::DidStopLoading() {}

void GuestViewBase::WebContentsDestroyed() {}

void GuestViewBase::DidFinishNavigation(
    content::NavigationHandle* navigation_handle) {}

void GuestViewBase::ActivateContents(WebContents* web_contents) {}

void GuestViewBase::ContentsMouseEvent(WebContents* source,
                                       const ui::Event& event) {}

void GuestViewBase::ContentsZoomChange(bool zoom_in) {}

bool GuestViewBase::HandleKeyboardEvent(
    WebContents* source,
    const input::NativeWebKeyboardEvent& event) {}

void GuestViewBase::LoadingStateChanged(WebContents* source,
                                        bool should_show_loading_ui) {}

void GuestViewBase::ResizeDueToAutoResize(WebContents* web_contents,
                                          const gfx::Size& new_size) {}

void GuestViewBase::RunFileChooser(
    content::RenderFrameHost* render_frame_host,
    scoped_refptr<content::FileSelectListener> listener,
    const blink::mojom::FileChooserParams& params) {}

bool GuestViewBase::ShouldFocusPageAfterCrash(content::WebContents* source) {}

bool GuestViewBase::PreHandleGestureEvent(WebContents* source,
                                          const blink::WebGestureEvent& event) {}

void GuestViewBase::UpdatePreferredSize(WebContents* target_web_contents,
                                        const gfx::Size& pref_size) {}

void GuestViewBase::UpdateTargetURL(WebContents* source, const GURL& url) {}

void GuestViewBase::OnZoomControllerDestroyed(zoom::ZoomController* source) {}

void GuestViewBase::OnZoomChanged(
    const zoom::ZoomController::ZoomChangedEventData& data) {}

void GuestViewBase::DispatchEventToGuestProxy(
    std::unique_ptr<GuestViewEvent> event) {}

void GuestViewBase::DispatchEventToView(std::unique_ptr<GuestViewEvent> event) {}

void GuestViewBase::SendQueuedEvents() {}

void GuestViewBase::CompleteInit(
    base::Value::Dict create_params,
    GuestCreatedCallback callback,
    std::unique_ptr<GuestViewBase> owned_this,
    std::unique_ptr<content::WebContents> guest_web_contents) {}

void GuestViewBase::TakeGuestContentsOwnership(
    std::unique_ptr<WebContents> guest_web_contents) {}

void GuestViewBase::ClearOwnedGuestContents() {}

void GuestViewBase::UpdateWebContentsForNewOwner(
    content::RenderFrameHost* new_owner_rfh) {}

double GuestViewBase::GetEmbedderZoomFactor() const {}

void GuestViewBase::SetUpSizing(const base::Value::Dict& params) {}

void GuestViewBase::SetGuestZoomLevelToMatchEmbedder() {}

void GuestViewBase::StartTrackingEmbedderZoomLevel() {}

void GuestViewBase::StopTrackingEmbedderZoomLevel() {}

void GuestViewBase::UpdateGuestSize(const gfx::Size& new_size,
                                    bool due_to_auto_resize) {}

bool GuestViewBase::IsOwnedByExtension() const {}

bool GuestViewBase::IsOwnedByWebUI() const {}

bool GuestViewBase::IsOwnedByControlledFrameEmbedder() const {}

void GuestViewBase::SetOwnerHost() {}

bool GuestViewBase::CanBeEmbeddedInsideCrossProcessFrames() const {}

bool GuestViewBase::RequiresSslInterstitials() const {}

bool GuestViewBase::IsPermissionRequestable(ContentSettingsType type) const {}

std::optional<content::PermissionResult>
GuestViewBase::OverridePermissionResult(ContentSettingsType type) const {}

content::RenderFrameHost* GuestViewBase::GetGuestMainFrame() const {}

base::WeakPtr<content::BrowserPluginGuestDelegate>
GuestViewBase::GetGuestDelegateWeakPtr() {}

}  // namespace guest_view