#include "components/media_message_center/media_notification_view_impl.h"
#include <vector>
#include "base/containers/contains.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "components/media_message_center/media_notification_background_ash_impl.h"
#include "components/media_message_center/media_notification_background_impl.h"
#include "components/media_message_center/media_notification_container.h"
#include "components/media_message_center/media_notification_item.h"
#include "components/media_message_center/media_notification_util.h"
#include "components/media_message_center/notification_theme.h"
#include "components/media_message_center/vector_icons/vector_icons.h"
#include "components/strings/grit/components_strings.h"
#include "services/media_session/public/mojom/media_session.mojom.h"
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/gfx/font.h"
#include "ui/gfx/font_list.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/message_center/public/cpp/message_center_constants.h"
#include "ui/message_center/views/notification_header_view.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/button/image_button_factory.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/style/typography.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/view_utils.h"
namespace media_message_center {
MediaSessionAction;
namespace {
constexpr size_t kMediaNotificationActionsCount = …;
constexpr size_t kMediaNotificationExpandedActionsCount = …;
constexpr int kDefaultMarginSize = …;
constexpr int kMediaButtonIconSize = …;
constexpr int kTitleArtistLineHeight = …;
constexpr double kMediaImageMaxWidthPct = …;
constexpr double kMediaImageMaxWidthExpandedPct = …;
constexpr gfx::Size kMediaButtonSize = …;
constexpr int kMediaButtonRowSeparator = …;
constexpr auto kMediaTitleArtistInsets = …;
constexpr auto kIconlessMediaNotificationHeaderInsets = …;
constexpr auto kIconMediaNotificationHeaderInsets = …;
constexpr gfx::Size kMediaNotificationButtonRowSize = …;
constexpr gfx::Size kPipButtonSeparatorViewSize = …;
constexpr int kCrOSTitleLineHeight = …;
constexpr int kCrOSArtistLineHeight = …;
constexpr int kCrOSMediaButtonRowSeparator = …;
constexpr int kCrOSHeaderRowSeparator = …;
constexpr gfx::Size kCrOSMediaButtonSize = …;
constexpr gfx::Insets kCrOSMediaTitleArtistInsets = …;
constexpr gfx::Size kCrOSMediaNotificationButtonRowSize = …;
constexpr gfx::Size kCrOSPipButtonSeparatorViewSize = …;
constexpr auto kCrOSHeaderRowInsets = …;
constexpr auto kCrOSMainRowInsetsWithArtwork = …;
constexpr auto kCrOSMainRowInsetsWithoutArtwork = …;
size_t GetMaxNumActions(bool expanded) { … }
void UpdateAppIconVisibility(message_center::NotificationHeaderView* header_row,
bool should_show_icon) { … }
}
MediaNotificationViewImpl::MediaNotificationViewImpl(
MediaNotificationContainer* container,
base::WeakPtr<MediaNotificationItem> item,
std::unique_ptr<views::View> header_row_controls_view,
const std::u16string& default_app_name,
int notification_width,
bool should_show_icon,
std::optional<NotificationTheme> theme)
: … { … }
MediaNotificationViewImpl::~MediaNotificationViewImpl() { … }
void MediaNotificationViewImpl::SetExpanded(bool expanded) { … }
void MediaNotificationViewImpl::UpdateCornerRadius(int top_radius,
int bottom_radius) { … }
void MediaNotificationViewImpl::SetForcedExpandedState(
bool* forced_expanded_state) { … }
void MediaNotificationViewImpl::UpdateWithMediaSessionInfo(
const media_session::mojom::MediaSessionInfoPtr& session_info) { … }
void MediaNotificationViewImpl::UpdateWithMediaMetadata(
const media_session::MediaMetadata& metadata) { … }
void MediaNotificationViewImpl::UpdateWithMediaActions(
const base::flat_set<media_session::mojom::MediaSessionAction>& actions) { … }
void MediaNotificationViewImpl::UpdateWithMediaArtwork(
const gfx::ImageSkia& image) { … }
void MediaNotificationViewImpl::UpdateWithFavicon(const gfx::ImageSkia& icon) { … }
void MediaNotificationViewImpl::UpdateWithVectorIcon(
const gfx::VectorIcon* vector_icon) { … }
void MediaNotificationViewImpl::UpdateDeviceSelectorVisibility(bool visible) { … }
void MediaNotificationViewImpl::OnThemeChanged() { … }
views::Button* MediaNotificationViewImpl::GetHeaderRowForTesting() const { … }
std::u16string MediaNotificationViewImpl::GetSourceTitleForTesting() const { … }
void MediaNotificationViewImpl::UpdateActionButtonsVisibility() { … }
void MediaNotificationViewImpl::UpdateViewForExpandedState() { … }
void MediaNotificationViewImpl::CreateMediaButton(
MediaSessionAction action,
const std::u16string& accessible_name) { … }
void MediaNotificationViewImpl::CreateHeaderRow(
std::unique_ptr<views::View> header_row_controls_view,
bool should_show_icon) { … }
void MediaNotificationViewImpl::CreateCrOSHeaderRow(
std::unique_ptr<views::View> header_row_controls_view) { … }
MediaNotificationBackground*
MediaNotificationViewImpl::GetMediaNotificationBackground() { … }
bool MediaNotificationViewImpl::GetExpandable() const { … }
bool MediaNotificationViewImpl::GetActuallyExpanded() const { … }
void MediaNotificationViewImpl::UpdateForegroundColor() { … }
void MediaNotificationViewImpl::ButtonPressed(views::Button* button) { … }
void MediaNotificationViewImpl::MaybeShowOrHideArtistLabel() { … }
std::vector<raw_ptr<views::View, VectorExperimental>>
MediaNotificationViewImpl::GetButtons() { … }
BEGIN_METADATA(…)
}