#include "chrome/browser/ui/views/controls/hover_button.h"
#include <algorithm>
#include <string_view>
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/hover_button_controller.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model.h"
#include "ui/color/color_id.h"
#include "ui/compositor/layer.h"
#include "ui/events/event_constants.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/background.h"
#include "ui/views/border.h"
#include "ui/views/controls/button/menu_button_controller.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/focus/focus_manager.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"
#include "ui/views/view_class_properties.h"
namespace {
std::unique_ptr<views::Border> CreateBorderWithVerticalSpacing(
int vertical_spacing) { … }
int GetVerticalSpacing() { … }
class IconWrapper : public views::View { … };
BEGIN_METADATA(…)
}
HoverButton::HoverButton(PressedCallback callback, const std::u16string& text)
: … { … }
HoverButton::HoverButton(PressedCallback callback,
const ui::ImageModel& icon,
const std::u16string& text)
: … { … }
HoverButton::HoverButton(PressedCallback callback,
std::unique_ptr<views::View> icon_view,
const std::u16string& title,
const std::u16string& subtitle,
std::unique_ptr<views::View> secondary_view,
bool add_vertical_label_spacing,
const std::u16string& footer)
: … { … }
HoverButton::~HoverButton() = default;
gfx::Size HoverButton::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
void HoverButton::SetBorder(std::unique_ptr<views::Border> b) { … }
void HoverButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { … }
void HoverButton::PreferredSizeChanged() { … }
void HoverButton::OnViewBoundsChanged(View* observed_view) { … }
void HoverButton::SetTitleTextStyle(views::style::TextStyle text_style,
SkColor background_color,
std::optional<ui::ColorId> color_id) { … }
void HoverButton::SetSubtitleTextStyle(int text_context,
views::style::TextStyle text_style) { … }
void HoverButton::SetFooterTextStyle(int text_content,
views::style::TextStyle text_style) { … }
void HoverButton::SetIconHorizontalMargins(int left, int right) { … }
void HoverButton::UpdateTooltipAndAccessibleName() { … }
views::Button::KeyClickAction HoverButton::GetKeyClickActionForEvent(
const ui::KeyEvent& event) { … }
void HoverButton::StateChanged(ButtonState old_state) { … }
views::View* HoverButton::GetTooltipHandlerForPoint(const gfx::Point& point) { … }
void HoverButton::OnPressed(const ui::Event& event) { … }
std::unique_ptr<views::Label> HoverButton::CreateSecondaryLabel(
const std::u16string& text) { … }
BEGIN_METADATA(…)