chromium/chrome/browser/ui/views/tabs/alert_indicator_button.cc

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

#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 {

// Fade-in/out duration for the tab indicator animations.  Fade-in is quick to
// immediately notify the user.  Fade-out is more gradual, so that the user has
// a chance of finding a tab that has quickly "blipped" on and off.
constexpr auto kIndicatorFadeInDuration =;
constexpr auto kIndicatorFadeOutDuration =;

// A minimum delay before the alert indicator disappears.
constexpr auto kAlertIndicatorMinimumHoldDuration =;

// Interval between frame updates of the tab indicator animations.  This is not
// the usual 60 FPS because a trade-off must be made between tab UI animation
// smoothness and media recording/playback performance on low-end hardware.
constexpr base::TimeDelta kIndicatorFrameInterval =;  // 20 FPS

std::unique_ptr<gfx::MultiAnimation> CreateTabRecordingIndicatorAnimation() {}

// The minimum required click-to-select area of an inactive Tab before allowing
// the click-to-mute functionality to be enabled.  These values are in terms of
// some percentage of the AlertIndicatorButton's width.  See comments in
// UpdateEnabledForMuteToggle().
const int kMinMouseSelectableAreaPercent =;
const int kMinGestureSelectableAreaPercent =;

// Returns true if either Shift or Control are being held down.  In this case,
// mouse events are delegated to the Tab, to perform tab selection in the tab
// strip instead.
bool IsShiftOrControlDown(const ui::Event& event) {}

ui::ImageModel GetTabAlertIndicatorImageForPressedState(
    TabAlertState alert_state,
    ui::ColorId button_color) {}

}  // namespace

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() {}

// Returns a cached image, to be shown by the alert indicator for the given
// |alert_state|.  Uses the global ui::ResourceBundle shared instance.
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()