#include "content/browser/web_contents/web_contents_view_child_frame.h"
#include <utility>
#include "build/build_config.h"
#include "content/browser/renderer_host/render_frame_proxy_host.h"
#include "content/browser/renderer_host/render_widget_host_view_child_frame.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/web_contents_view_delegate.h"
#include "third_party/blink/public/mojom/input/focus_type.mojom.h"
#include "ui/base/dragdrop/mojom/drag_drop_types.mojom.h"
#include "ui/display/display_util.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#if BUILDFLAG(IS_MAC)
#include "content/browser/renderer_host/popup_menu_helper_mac.h"
#endif
DragOperationsMask;
namespace content {
namespace {
#if BUILDFLAG(IS_MAC)
class NoOpPopupMenuHelperDelegate : public PopupMenuHelper::Delegate {
public:
void OnMenuClosed() final {
}
};
#endif
}
WebContentsViewChildFrame::WebContentsViewChildFrame(
WebContentsImpl* web_contents,
std::unique_ptr<WebContentsViewDelegate> delegate,
raw_ptr<RenderViewHostDelegateView>* delegate_view)
: … { … }
WebContentsViewChildFrame::~WebContentsViewChildFrame() = default;
WebContentsView* WebContentsViewChildFrame::GetOuterView() { … }
const WebContentsView* WebContentsViewChildFrame::GetOuterView() const { … }
RenderViewHostDelegateView* WebContentsViewChildFrame::GetOuterDelegateView() { … }
gfx::NativeView WebContentsViewChildFrame::GetNativeView() const { … }
gfx::NativeView WebContentsViewChildFrame::GetContentNativeView() const { … }
gfx::NativeWindow WebContentsViewChildFrame::GetTopLevelNativeWindow() const { … }
gfx::Rect WebContentsViewChildFrame::GetContainerBounds() const { … }
void WebContentsViewChildFrame::SetInitialFocus() { … }
gfx::Rect WebContentsViewChildFrame::GetViewBounds() const { … }
void WebContentsViewChildFrame::CreateView(gfx::NativeView context) { … }
RenderWidgetHostViewBase* WebContentsViewChildFrame::CreateViewForWidget(
RenderWidgetHost* render_widget_host) { … }
RenderWidgetHostViewBase* WebContentsViewChildFrame::CreateViewForChildWidget(
RenderWidgetHost* render_widget_host) { … }
void WebContentsViewChildFrame::SetPageTitle(const std::u16string& title) { … }
void WebContentsViewChildFrame::RenderViewReady() { … }
void WebContentsViewChildFrame::RenderViewHostChanged(
RenderViewHost* old_host,
RenderViewHost* new_host) { … }
void WebContentsViewChildFrame::SetOverscrollControllerEnabled(bool enabled) { … }
#if BUILDFLAG(IS_MAC)
bool WebContentsViewChildFrame::CloseTabAfterEventTrackingIfNeeded() {
return false;
}
#endif
void WebContentsViewChildFrame::OnCapturerCountChanged() { … }
void WebContentsViewChildFrame::FullscreenStateChanged(bool is_fullscreen) { … }
void WebContentsViewChildFrame::UpdateWindowControlsOverlay(
const gfx::Rect& bounding_rect) { … }
BackForwardTransitionAnimationManager*
WebContentsViewChildFrame::GetBackForwardTransitionAnimationManager() { … }
void WebContentsViewChildFrame::RestoreFocus() { … }
void WebContentsViewChildFrame::Focus() { … }
void WebContentsViewChildFrame::StoreFocus() { … }
void WebContentsViewChildFrame::FocusThroughTabTraversal(bool reverse) { … }
DropData* WebContentsViewChildFrame::GetDropData() const { … }
void WebContentsViewChildFrame::UpdateDragOperation(
ui::mojom::DragOperation operation,
bool document_is_handling_drag) { … }
void WebContentsViewChildFrame::GotFocus(
RenderWidgetHostImpl* render_widget_host) { … }
void WebContentsViewChildFrame::TakeFocus(bool reverse) { … }
void WebContentsViewChildFrame::ShowContextMenu(
RenderFrameHost& render_frame_host,
const ContextMenuParams& params) { … }
#if BUILDFLAG(USE_EXTERNAL_POPUP_MENU)
void WebContentsViewChildFrame::ShowPopupMenu(
RenderFrameHost* render_frame_host,
mojo::PendingRemote<blink::mojom::PopupMenuClient> popup_client,
const gfx::Rect& bounds,
int item_height,
double item_font_size,
int selected_item,
std::vector<blink::mojom::MenuItemPtr> menu_items,
bool right_aligned,
bool allow_multiple_selection) {
#if BUILDFLAG(IS_MAC)
NoOpPopupMenuHelperDelegate delegate;
PopupMenuHelper helper(&delegate, render_frame_host, std::move(popup_client));
helper.ShowPopupMenu(bounds, item_height, item_font_size, selected_item,
std::move(menu_items), right_aligned,
allow_multiple_selection);
#endif
}
#endif
void WebContentsViewChildFrame::StartDragging(
const DropData& drop_data,
const url::Origin& source_origin,
DragOperationsMask ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& cursor_offset,
const gfx::Rect& drag_obj_rect,
const blink::mojom::DragEventSourceInfo& event_info,
RenderWidgetHostImpl* source_rwh) { … }
RenderWidgetHostViewChildFrame*
WebContentsViewChildFrame::CreateRenderWidgetHostViewForInnerFrameTree(
WebContentsImpl* web_contents,
RenderWidgetHost* render_widget_host) { … }
}