#include "chrome/browser/ui/views/bubble/webui_bubble_dialog_view.h"
#include "build/build_config.h"
#include "components/input/native_web_keyboard_event.h"
#include "content/public/browser/keyboard_event_processing_result.h"
#include "content/public/browser/visibility.h"
#include "third_party/skia/include/core/SkRect.h"
#include "ui/base/hit_test.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/dialog_button.mojom.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rounded_corners_f.h"
#include "ui/views/bubble/bubble_border.h"
#include "ui/views/controls/webview/webview.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/widget/widget.h"
#if defined(USE_AURA)
#include "chrome/browser/ui/views/bubble/webui_bubble_event_handler_aura.h"
#include "ui/aura/window.h"
#endif
#if BUILDFLAG(ENABLE_DESKTOP_AURA)
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
#endif
namespace {
constexpr gfx::Size kMinSize(25, 25);
#if defined(USE_AURA)
bool ShouldUseEventHandlerForBubbleDrag(aura::Window* window) { … }
#endif
class WebUIBubbleView : public views::WebView { … };
SkRegion ComputeDraggableRegion(
const std::vector<blink::mojom::DraggableRegionPtr>& regions) { … }
BEGIN_METADATA(…)
}
WebUIBubbleDialogView::WebUIBubbleDialogView(
views::View* anchor_view,
base::WeakPtr<WebUIContentsWrapper> contents_wrapper,
const std::optional<gfx::Rect>& anchor_rect,
views::BubbleBorder::Arrow arrow,
bool autosize)
: … { … }
WebUIBubbleDialogView::~WebUIBubbleDialogView() { … }
void WebUIBubbleDialogView::ClearContentsWrapper() { … }
base::WeakPtr<WebUIBubbleDialogView> WebUIBubbleDialogView::GetWeakPtr() { … }
void WebUIBubbleDialogView::OnWidgetClosing(views::Widget* widget) { … }
gfx::Size WebUIBubbleDialogView::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
void WebUIBubbleDialogView::AddedToWidget() { … }
gfx::Rect WebUIBubbleDialogView::GetBubbleBounds() { … }
std::unique_ptr<views::NonClientFrameView>
WebUIBubbleDialogView::CreateNonClientFrameView(views::Widget* widget) { … }
void WebUIBubbleDialogView::ShowUI() { … }
void WebUIBubbleDialogView::CloseUI() { … }
void WebUIBubbleDialogView::ResizeDueToAutoResize(content::WebContents* source,
const gfx::Size& new_size) { … }
bool WebUIBubbleDialogView::HandleKeyboardEvent(
content::WebContents* source,
const input::NativeWebKeyboardEvent& event) { … }
void WebUIBubbleDialogView::DraggableRegionsChanged(
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
content::WebContents* contents) { … }
bool WebUIBubbleDialogView::ShouldDescendIntoChildForEventHandling(
gfx::NativeView child,
const gfx::Point& location) { … }
gfx::Rect WebUIBubbleDialogView::GetAnchorRect() const { … }
int WebUIBubbleDialogView::NonClientHitTest(const gfx::Point& point) const { … }
BEGIN_METADATA(…)