#include "chrome/browser/ui/views/toolbar/webui_tab_counter_button.h"
#include <memory>
#include <string>
#include "base/functional/bind.h"
#include "base/i18n/message_formatter.h"
#include "base/i18n/number_formatting.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/chrome_typography.h"
#include "chrome/browser/ui/views/flying_indicator.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h"
#include "chrome/grit/generated_resources.h"
#include "components/user_education/common/user_education_class_properties.h"
#include "components/vector_icons/vector_icons.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.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/base/models/menu_separator_types.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/theme_provider.h"
#include "ui/gfx/animation/multi_animation.h"
#include "ui/gfx/animation/slide_animation.h"
#include "ui/gfx/animation/tween.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/favicon_size.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/animation/ink_drop.h"
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/border.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/context_menu_controller.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/menu/menu_model_adapter.h"
#include "ui/views/controls/menu/menu_runner.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/layout_provider.h"
#include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/widget/native_widget.h"
#include "ui/views/widget/widget.h"
namespace {
constexpr int kOffscreenLabelDistance = …;
constexpr base::TimeDelta kFirstPartDuration = …;
bool ShouldChangeStartThrobber(TabStripModel* tab_strip_model,
const TabStripModelChange& change) { … }
std::u16string GetTabCounterLabelText(int num_tabs) { … }
class NumberLabel : public views::Label { … };
BEGIN_METADATA(…)
class InteractionTracker : public ui::EventHandler,
public views::WidgetObserver { … };
class TabCounterAnimator : public gfx::AnimationDelegate { … };
TabCounterAnimator::TabCounterAnimator(views::Label* appearing_label,
views::Label* disappearing_label,
views::View* border_view,
views::Throbber* throbber)
: … { … }
void TabCounterAnimator::Animate(int new_num_tabs, bool should_start_throbber) { … }
void TabCounterAnimator::MaybeStartPendingAnimation() { … }
void TabCounterAnimator::StartFlyingLinkFrom(
const gfx::Point& screen_position) { … }
void TabCounterAnimator::LayoutIfAnimating() { … }
void TabCounterAnimator::AnimationProgressed(const gfx::Animation* animation) { … }
void TabCounterAnimator::AnimationEnded(const gfx::Animation* animation) { … }
int TabCounterAnimator::GetBorderTargetYDelta() const { … }
int TabCounterAnimator::GetBorderOvershootYDelta() const { … }
int TabCounterAnimator::GetAppearingLabelStartPosition() const { … }
int TabCounterAnimator::GetDisappearingLabelTargetPosition() const { … }
int TabCounterAnimator::GetBorderStartingY() const { … }
class WebUITabCounterButton : public views::Button,
public TabStripModelObserver,
public views::ContextMenuController,
public ui::SimpleMenuModel::Delegate { … };
WebUITabCounterButton::WebUITabCounterButton(PressedCallback pressed_callback,
BrowserView* browser_view)
: … { … }
WebUITabCounterButton::~WebUITabCounterButton() { … }
void WebUITabCounterButton::UpdateTooltip(int num_tabs) { … }
void WebUITabCounterButton::UpdateColors() { … }
void WebUITabCounterButton::Init() { … }
void WebUITabCounterButton::AddedToWidget() { … }
void WebUITabCounterButton::AfterPropertyChange(const void* key,
int64_t old_value) { … }
void WebUITabCounterButton::AddLayerToRegion(ui::Layer* new_layer,
views::LayerRegion region) { … }
void WebUITabCounterButton::RemoveLayerFromRegions(ui::Layer* old_layer) { … }
void WebUITabCounterButton::OnThemeChanged() { … }
void WebUITabCounterButton::Layout(PassKey) { … }
void WebUITabCounterButton::MaybeStartFlyingLink(
WindowOpenDisposition disposition) { … }
void WebUITabCounterButton::OnTabStripModelChanged(
TabStripModel* tab_strip_model,
const TabStripModelChange& change,
const TabStripSelectionChange& selection) { … }
void WebUITabCounterButton::ShowContextMenuForViewImpl(
views::View* source,
const gfx::Point& point,
ui::MenuSourceType source_type) { … }
void WebUITabCounterButton::ExecuteCommand(int command_id, int event_flags) { … }
BEGIN_METADATA(…)
}
std::unique_ptr<views::View> CreateWebUITabCounterButton(
views::Button::PressedCallback pressed_callback,
BrowserView* browser_view) { … }