#include "chrome/browser/ui/views/tabs/alert_indicator_button.h"
#include <utility>
#include "base/feature_list.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/user_metrics.h"
#include "base/time/time.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/views/tabs/tab.h"
#include "chrome/browser/ui/views/tabs/tab_slot_controller.h"
#include "chrome/grit/generated_resources.h"
#include "components/content_settings/core/common/features.h"
#include "components/vector_icons/vector_icons.h"
#include "media/base/media_switches.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/pointer/touch_ui_controller.h"
#include "ui/base/ui_base_features.h"
#include "ui/gfx/animation/multi_animation.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/animation/animation_delegate_views.h"
#include "ui/views/metrics.h"
#include "ui/views/view_class_properties.h"
namespace {
constexpr auto kIndicatorFadeInDuration = …;
constexpr auto kIndicatorFadeOutDuration = …;
constexpr auto kAlertIndicatorMinimumHoldDuration = …;
constexpr base::TimeDelta kIndicatorFrameInterval = …;
std::unique_ptr<gfx::MultiAnimation> CreateTabRecordingIndicatorAnimation() { … }
const int kMinMouseSelectableAreaPercent = …;
const int kMinGestureSelectableAreaPercent = …;
bool IsShiftOrControlDown(const ui::Event& event) { … }
ui::ImageModel GetTabAlertIndicatorImageForPressedState(
TabAlertState alert_state,
ui::ColorId button_color) { … }
}
class AlertIndicatorButton::FadeAnimationDelegate
: public views::AnimationDelegateViews { … };
AlertIndicatorButton::AlertIndicatorButton(Tab* parent_tab)
: … { … }
AlertIndicatorButton::~AlertIndicatorButton() = default;
void AlertIndicatorButton::TransitionToAlertState(
std::optional<TabAlertState> next_state) { … }
void AlertIndicatorButton::UpdateEnabledForMuteToggle() { … }
void AlertIndicatorButton::OnParentTabButtonColorChanged() { … }
views::View* AlertIndicatorButton::GetTooltipHandlerForPoint(
const gfx::Point& point) { … }
bool AlertIndicatorButton::OnMousePressed(const ui::MouseEvent& event) { … }
void AlertIndicatorButton::OnBoundsChanged(const gfx::Rect& previous_bounds) { … }
bool AlertIndicatorButton::DoesIntersectRect(const views::View* target,
const gfx::Rect& rect) const { … }
void AlertIndicatorButton::NotifyClick(const ui::Event& event) { … }
bool AlertIndicatorButton::IsTriggerableEvent(const ui::Event& event) { … }
void AlertIndicatorButton::PaintButtonContents(gfx::Canvas* canvas) { … }
gfx::ImageSkia AlertIndicatorButton::GetImageToPaint() { … }
std::unique_ptr<gfx::Animation>
AlertIndicatorButton::CreateTabAlertIndicatorFadeAnimation(
std::optional<TabAlertState> alert_state) { … }
Tab* AlertIndicatorButton::GetTab() { … }
ui::ImageModel AlertIndicatorButton::GetTabAlertIndicatorImage(
TabAlertState alert_state,
ui::ColorId button_color) { … }
ui::ImageModel AlertIndicatorButton::GetTabAlertIndicatorImageForHoverCard(
TabAlertState alert_state) { … }
void AlertIndicatorButton::UpdateIconForAlertState(TabAlertState state) { … }
BEGIN_METADATA(…)