#include "chrome/browser/ui/views/tabs/new_tab_button.h"
#include <memory>
#include <string>
#include "base/strings/string_number_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_types.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/frame/top_container_background.h"
#include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
#include "chrome/browser/ui/views/tabs/tab_strip.h"
#include "chrome/grit/generated_resources.h"
#include "components/variations/variations_associated_data.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
#include "ui/base/theme_provider.h"
#include "ui/compositor/compositor.h"
#include "ui/gfx/color_utils.h"
#include "ui/gfx/scoped_canvas.h"
#include "ui/views/animation/flood_fill_ink_drop_ripple.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/ink_drop_mask.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h"
#if BUILDFLAG(IS_WIN)
#include "ui/display/win/screen_win.h"
#include "ui/views/win/hwnd_util.h"
#endif
const gfx::Size NewTabButton::kButtonSize{ … };
class NewTabButton::HighlightPathGenerator
: public views::HighlightPathGenerator { … };
NewTabButton::NewTabButton(TabStrip* tab_strip, PressedCallback callback)
: … { … }
NewTabButton::~NewTabButton() { … }
void NewTabButton::FrameColorsChanged() { … }
void NewTabButton::AnimateToStateForTesting(views::InkDropState state) { … }
void NewTabButton::AddLayerToRegion(ui::Layer* new_layer,
views::LayerRegion region) { … }
void NewTabButton::RemoveLayerFromRegions(ui::Layer* old_layer) { … }
SkColor NewTabButton::GetForegroundColor() const { … }
int NewTabButton::GetCornerRadius() const { … }
SkPath NewTabButton::GetBorderPath(const gfx::Point& origin,
bool extend_to_top) const { … }
void NewTabButton::OnBoundsChanged(const gfx::Rect& previous_bounds) { … }
void NewTabButton::AddedToWidget() { … }
void NewTabButton::RemovedFromWidget() { … }
void NewTabButton::OnThemeChanged() { … }
#if BUILDFLAG(IS_WIN)
void NewTabButton::OnMouseReleased(const ui::MouseEvent& event) {
if (!event.IsOnlyRightMouseButton()) {
views::ImageButton::OnMouseReleased(event);
return;
}
gfx::Point point = event.location();
views::View::ConvertPointToScreen(this, &point);
point = display::win::ScreenWin::DIPToScreenPoint(point);
auto weak_this = weak_factory_.GetWeakPtr();
views::ShowSystemMenuAtScreenPixelLocation(views::HWNDForView(this), point);
if (!weak_this) {
return;
}
SetState(views::Button::STATE_NORMAL);
}
#endif
void NewTabButton::OnGestureEvent(ui::GestureEvent* event) { … }
void NewTabButton::NotifyClick(const ui::Event& event) { … }
void NewTabButton::PaintButtonContents(gfx::Canvas* canvas) { … }
gfx::Size NewTabButton::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
bool NewTabButton::GetHitTestMask(SkPath* mask) const { … }
void NewTabButton::PaintFill(gfx::Canvas* canvas) const { … }
void NewTabButton::PaintIcon(gfx::Canvas* canvas) { … }
BEGIN_METADATA(…)