chromium/ui/views/bubble/bubble_dialog_delegate_view.cc

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

#include "ui/views/bubble/bubble_dialog_delegate_view.h"

#include <algorithm>
#include <set>
#include <string>
#include <unordered_set>
#include <utility>
#include <vector>

#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/accessibility/ax_role_properties.h"
#include "ui/base/class_property.h"
#include "ui/base/default_style.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/mojom/ui_base_types.mojom-shared.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_id.h"
#include "ui/color/color_provider.h"
#include "ui/color/color_provider_key.h"
#include "ui/compositor/compositor.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_element.h"
#include "ui/compositor/layer_animator.h"
#include "ui/display/screen.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rounded_corners_f.h"
#include "ui/gfx/geometry/vector2d_conversions.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/bubble_histograms_variant.h"
#include "ui/views/layout/layout_manager.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/style/platform_style.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/views_features.h"
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_observer.h"
#include "ui/views/window/dialog_client_view.h"

#if BUILDFLAG(IS_WIN)
#include "ui/base/win/shell.h"
#endif

#if BUILDFLAG(IS_MAC)
#include "ui/views/widget/widget_utils_mac.h"
#else
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#endif

#if BUILDFLAG(IS_OZONE)
#include "ui/ozone/public/ozone_platform.h"
#endif

DEFINE_UI_CLASS_PROPERTY_TYPE()

namespace views {

namespace {

// Some anchors may have multiple bubbles associated with them. This can happen
// if a bubble does not have close_on_deactivate and another bubble appears
// that needs the same anchor view. This property maintains a vector of bubbles
// in anchored order where the last item is the primary anchored bubble. If the
// last item is removed, the new last item, if available, is notified that it is
// the new primary anchored bubble.
DEFINE_OWNED_UI_CLASS_PROPERTY_KEY()

std::vector<BubbleDialogDelegate*>& GetAnchorVector(View* view) {}

// Override base functionality of Widget to give bubble dialogs access to the
// theme provider of the window they're anchored to.
class BubbleWidget : public Widget {};

// The frame view for bubble dialog widgets. These are not user-sizable so have
// simplified logic for minimum and maximum sizes to avoid repeated calls to
// CalculatePreferredSize().
class BubbleDialogFrameView : public BubbleFrameView {};

// Create a widget to host the bubble.
Widget* CreateBubbleWidget(BubbleDialogDelegate* bubble) {}

}  // namespace

class BubbleDialogDelegate::AnchorViewObserver : public ViewObserver {};

// This class is responsible for observing events on a BubbleDialogDelegate's
// anchor widget and notifying the BubbleDialogDelegate of them.
#if BUILDFLAG(IS_MAC)
class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver {
#else
class BubbleDialogDelegate::AnchorWidgetObserver : public WidgetObserver,
                                                   public aura::WindowObserver {};

// This class is responsible for observing events on a BubbleDialogDelegate's
// widget and notifying the BubbleDialogDelegate of them.
class BubbleDialogDelegate::BubbleWidgetObserver : public WidgetObserver {};

class BubbleDialogDelegate::ThemeObserver : public ViewObserver {};

class BubbleDialogDelegateView::CloseOnDeactivatePin::Pins {};

BubbleDialogDelegate::CloseOnDeactivatePin::CloseOnDeactivatePin(
    base::WeakPtr<Pins> pins)
    :{}

BubbleDialogDelegate::CloseOnDeactivatePin::~CloseOnDeactivatePin() {}

BubbleDialogDelegate::BubbleDialogDelegate(View* anchor_view,
                                           BubbleBorder::Arrow arrow,
                                           BubbleBorder::Shadow shadow,
                                           bool autosize)
    :{}

BubbleDialogDelegate::~BubbleDialogDelegate() {}

// static
Widget* BubbleDialogDelegate::CreateBubble(
    std::unique_ptr<BubbleDialogDelegate> bubble_delegate_unique) {}

Widget* BubbleDialogDelegateView::CreateBubble(BubbleDialogDelegateView* view) {}

BubbleDialogDelegateView::BubbleDialogDelegateView()
    :{}

BubbleDialogDelegateView::BubbleDialogDelegateView(View* anchor_view,
                                                   BubbleBorder::Arrow arrow,
                                                   BubbleBorder::Shadow shadow,
                                                   bool autosize)
    :{}

BubbleDialogDelegateView::~BubbleDialogDelegateView() {}

BubbleDialogDelegate* BubbleDialogDelegate::AsBubbleDialogDelegate() {}

std::unique_ptr<NonClientFrameView>
BubbleDialogDelegate::CreateNonClientFrameView(Widget* widget) {}

ClientView* BubbleDialogDelegate::CreateClientView(Widget* widget) {}

Widget* BubbleDialogDelegateView::GetWidget() {}

const Widget* BubbleDialogDelegateView::GetWidget() const {}

View* BubbleDialogDelegateView::GetContentsView() {}

void BubbleDialogDelegate::OnBubbleWidgetClosing() {}

void BubbleDialogDelegate::OnAnchorWidgetDestroying() {}

void BubbleDialogDelegate::OnBubbleWidgetActivationChanged(bool active) {}

void BubbleDialogDelegate::OnAnchorWidgetBoundsChanged() {}


BubbleBorder::Shadow BubbleDialogDelegate::GetShadow() const {}

View* BubbleDialogDelegate::GetAnchorView() const {}

void BubbleDialogDelegate::SetMainImage(ui::ImageModel main_image) {}

bool BubbleDialogDelegate::ShouldCloseOnDeactivate() const {}

std::unique_ptr<BubbleDialogDelegate::CloseOnDeactivatePin>
BubbleDialogDelegate::PreventCloseOnDeactivate() {}

void BubbleDialogDelegate::SetHighlightedButton(Button* highlighted_button) {}

void BubbleDialogDelegate::SetArrow(BubbleBorder::Arrow arrow) {}

void BubbleDialogDelegate::SetArrowWithoutResizing(BubbleBorder::Arrow arrow) {}

gfx::Rect BubbleDialogDelegate::GetAnchorRect() const {}

SkColor BubbleDialogDelegate::GetBackgroundColor() {}

ui::LayerType BubbleDialogDelegate::GetLayerType() const {}

void BubbleDialogDelegate::SetPaintClientToLayer(bool paint_client_to_layer) {}

void BubbleDialogDelegate::UseCompactMargins() {}

// static
gfx::Size BubbleDialogDelegate::GetMaxAvailableScreenSpaceToPlaceBubble(
    View* anchor_view,
    BubbleBorder::Arrow arrow,
    bool adjust_if_offscreen,
    BubbleFrameView::PreferredArrowAdjustment arrow_adjustment) {}

// static
gfx::Size BubbleDialogDelegate::GetAvailableSpaceToPlaceBubble(
    BubbleBorder::Arrow arrow,
    gfx::Rect anchor_rect,
    gfx::Rect screen_rect) {}

void BubbleDialogDelegate::OnAnchorBoundsChanged() {}

void BubbleDialogDelegate::UpdateInputProtectorsTimeStamp() {}

BubbleDialogDelegate::BubbleUmaLogger::BubbleUmaLogger() = default;

BubbleDialogDelegate::BubbleUmaLogger::~BubbleUmaLogger() = default;

base::WeakPtr<BubbleDialogDelegate::BubbleUmaLogger>
BubbleDialogDelegate::BubbleUmaLogger::GetWeakPtr() {}

std::optional<std::string>
BubbleDialogDelegate::BubbleUmaLogger::GetBubbleName() const {}

template <typename Value>
void BubbleDialogDelegate::BubbleUmaLogger::LogMetric(
    void (*uma_func)(const std::string&, Value),
    const std::string& histogram_name,
    Value value) const {}

// Instantiate template function to be able to use in views_unittests.
template VIEWS_EXPORT void BubbleDialogDelegate::BubbleUmaLogger::LogMetric<
    base::TimeDelta>(void (*uma_func)(const std::string&, base::TimeDelta),
                     const std::string& histogram_name,
                     base::TimeDelta value) const;

gfx::Rect BubbleDialogDelegate::GetBubbleBounds() {}

ax::mojom::Role BubbleDialogDelegate::GetAccessibleWindowRole() {}

gfx::Rect BubbleDialogDelegate::GetDesiredBubbleBounds() {}

gfx::Size BubbleDialogDelegateView::GetMinimumSize() const {}

gfx::Size BubbleDialogDelegateView::GetMaximumSize() const {}

void BubbleDialogDelegate::SetAnchorView(View* anchor_view) {}

void BubbleDialogDelegate::SetAnchorRect(const gfx::Rect& rect) {}

void BubbleDialogDelegate::SizeToContents() {}

std::u16string BubbleDialogDelegate::GetSubtitle() const {}

void BubbleDialogDelegate::SetSubtitle(const std::u16string& subtitle) {}

bool BubbleDialogDelegate::GetSubtitleAllowCharacterBreak() const {}

void BubbleDialogDelegate::SetSubtitleAllowCharacterBreak(bool allow) {}

void BubbleDialogDelegate::UpdateColorsFromTheme() {}

void BubbleDialogDelegate::OnBubbleWidgetVisibilityChanged(bool visible) {}

void BubbleDialogDelegate::OnDeactivate() {}

void BubbleDialogDelegate::NotifyAnchoredBubbleIsPrimary() {}

void BubbleDialogDelegate::SetAnchoredDialogKey() {}

void BubbleDialogDelegate::UpdateHighlightedButton(bool highlighted) {}

BEGIN_METADATA()

}  // namespace views