#include "components/global_media_controls/public/views/media_progress_view.h"
#include "base/i18n/number_formatting.h"
#include "base/i18n/rtl.h"
#include "cc/paint/paint_flags.h"
#include "components/global_media_controls/media_view_utils.h"
#include "components/strings/grit/components_strings.h"
#include "services/media_session/public/mojom/media_session.mojom.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/accessibility/ax_action_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/skia_conversions.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/widget/widget.h"
namespace global_media_controls {
namespace {
constexpr int kSquigglyProgressViewHeight = …;
constexpr int kStraightProgressViewHeight = …;
constexpr int kStrokeWidth = …;
constexpr int kLargeStrokeWidth = …;
constexpr int kProgressClickHeight = …;
constexpr int kWidthInset = …;
constexpr int kProgressWavelength = …;
constexpr int kProgressAmplitude = …;
constexpr int kProgressPhaseSpeed = …;
constexpr gfx::SizeF kSquigglyProgressIndicatorSize = …;
constexpr gfx::SizeF kStraightProgressIndicatorSize = …;
constexpr int kStraightProgressIndicatorGap = …;
constexpr base::TimeDelta kSlideAnimationDuration = …;
constexpr base::TimeDelta kProgressUpdateFrequency = …;
constexpr base::TimeDelta kSwitchProgressColorsDelayTime = …;
constexpr base::TimeDelta kProgressDragStartedDelayTime = …;
constexpr float kFocusRingRadius = …;
constexpr base::TimeDelta kCurrentPositionChange = …;
}
MediaProgressView::MediaProgressView(
bool use_squiggly_line,
ui::ColorId playing_foreground_color_id,
ui::ColorId playing_background_color_id,
ui::ColorId paused_foreground_color_id,
ui::ColorId paused_background_color_id,
ui::ColorId focus_ring_color_id,
base::RepeatingCallback<void(DragState)> drag_state_change_callback,
base::RepeatingCallback<void(PlaybackStateChangeForDragging)>
playback_state_change_for_dragging_callback,
base::RepeatingCallback<void(double)> seek_callback,
base::RepeatingCallback<void(base::TimeDelta)> on_update_progress_callback)
: … { … }
MediaProgressView::~MediaProgressView() = default;
void MediaProgressView::AnimationProgressed(const gfx::Animation* animation) { … }
gfx::Size MediaProgressView::CalculatePreferredSize(
const views::SizeBounds& available_size) const { … }
void MediaProgressView::GetAccessibleNodeData(ui::AXNodeData* node_data) { … }
bool MediaProgressView::HandleAccessibleAction(
const ui::AXActionData& action_data) { … }
void MediaProgressView::VisibilityChanged(View* starting_from,
bool is_visible) { … }
void MediaProgressView::AddedToWidget() { … }
void MediaProgressView::OnPaint(gfx::Canvas* canvas) { … }
void MediaProgressView::OnFocus() { … }
void MediaProgressView::OnBlur() { … }
bool MediaProgressView::OnMousePressed(const ui::MouseEvent& event) { … }
bool MediaProgressView::OnMouseDragged(const ui::MouseEvent& event) { … }
void MediaProgressView::OnMouseReleased(const ui::MouseEvent& event) { … }
bool MediaProgressView::OnKeyPressed(const ui::KeyEvent& event) { … }
void MediaProgressView::OnGestureEvent(ui::GestureEvent* event) { … }
void MediaProgressView::UpdateProgress(
const media_session::MediaPosition& media_position) { … }
void MediaProgressView::MaybeNotifyAccessibilityValueChanged() { … }
void MediaProgressView::OnProgressDragStarted(double location) { … }
void MediaProgressView::DelayedProgressDragStarted(double location) { … }
void MediaProgressView::OnProgressDragEnded() { … }
void MediaProgressView::UpdateProgressColors(bool is_paused) { … }
void MediaProgressView::HandleSeeking(double location) { … }
double MediaProgressView::CalculateNewValue(base::TimeDelta new_position) { … }
bool MediaProgressView::IsValidSeekPosition(int x, int y) { … }
double MediaProgressView::current_value_for_testing() const { … }
bool MediaProgressView::is_paused_for_testing() const { … }
bool MediaProgressView::is_live_for_testing() const { … }
bool MediaProgressView::use_paused_colors_for_testing() const { … }
void MediaProgressView::set_update_progress_timer_for_testing(
std::unique_ptr<base::OneShotTimer> test_timer) { … }
void MediaProgressView::set_switch_progress_colors_delay_timer_for_testing(
std::unique_ptr<base::OneShotTimer> test_timer) { … }
void MediaProgressView::set_progress_drag_started_delay_timer_for_testing(
std::unique_ptr<base::OneShotTimer> test_timer) { … }
BEGIN_METADATA(…)
}