Commit 2e1dd46f authored by Jazz Xu's avatar Jazz Xu Committed by Chromium LUCI CQ

CrOS GMC: Hide artist label when both artist and artwork are empty.

Bug: 1144325
Change-Id: I59caaf4c860adce66fcda090c46a6dd91dc37ce5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2533284Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Commit-Queue: Jazz Xu <jazzhsu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#832115}
parent 1d49f3ea
...@@ -432,6 +432,7 @@ void MediaNotificationViewImpl::UpdateWithMediaMetadata( ...@@ -432,6 +432,7 @@ void MediaNotificationViewImpl::UpdateWithMediaMetadata(
container_->OnMediaSessionMetadataChanged(metadata); container_->OnMediaSessionMetadataChanged(metadata);
MaybeShowOrHideArtistLabel();
PreferredSizeChanged(); PreferredSizeChanged();
Layout(); Layout();
SchedulePaint(); SchedulePaint();
...@@ -463,6 +464,7 @@ void MediaNotificationViewImpl::UpdateWithMediaArtwork( ...@@ -463,6 +464,7 @@ void MediaNotificationViewImpl::UpdateWithMediaArtwork(
container_->OnMediaArtworkChanged(image); container_->OnMediaArtworkChanged(image);
MaybeShowOrHideArtistLabel();
PreferredSizeChanged(); PreferredSizeChanged();
Layout(); Layout();
SchedulePaint(); SchedulePaint();
...@@ -794,6 +796,13 @@ void MediaNotificationViewImpl::ButtonPressed(views::Button* button) { ...@@ -794,6 +796,13 @@ void MediaNotificationViewImpl::ButtonPressed(views::Button* button) {
item_->OnMediaSessionActionButtonPressed(GetActionFromButtonTag(*button)); item_->OnMediaSessionActionButtonPressed(GetActionFromButtonTag(*button));
} }
void MediaNotificationViewImpl::MaybeShowOrHideArtistLabel() {
if (!is_cros_)
return;
artist_label_->SetVisible(!artist_label_->GetText().empty() || has_artwork_);
}
std::vector<views::View*> MediaNotificationViewImpl::GetButtons() { std::vector<views::View*> MediaNotificationViewImpl::GetButtons() {
auto buttons = button_row_->children(); auto buttons = button_row_->children();
buttons.insert(buttons.cbegin(), buttons.insert(buttons.cbegin(),
......
...@@ -134,6 +134,8 @@ class COMPONENT_EXPORT(MEDIA_MESSAGE_CENTER) MediaNotificationViewImpl ...@@ -134,6 +134,8 @@ class COMPONENT_EXPORT(MEDIA_MESSAGE_CENTER) MediaNotificationViewImpl
void ButtonPressed(views::Button* button); void ButtonPressed(views::Button* button);
void MaybeShowOrHideArtistLabel();
// Returns the buttons contained in the button row and playback button // Returns the buttons contained in the button row and playback button
// container. // container.
std::vector<views::View*> GetButtons(); std::vector<views::View*> GetButtons();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment