Merge pull request #19689 from thirumurugan-git/fix-playlist-icon-issue

Playlist icon visibility issue fix
This commit is contained in:
Brian Clifton
2023-08-17 22:39:40 -07:00
committed by GitHub
2 changed files with 5 additions and 12 deletions
@@ -72,7 +72,6 @@ void PlaylistActionIconView::ShowPlaylistBubble() {
}
DCHECK(saved_item_count || found_item_count > 1u);
DCHECK_EQ(last_web_contents_, GetWebContents());
PlaylistActionBubbleView::ShowBubble(browser_, this, playlist_tab_helper);
}
@@ -86,8 +85,7 @@ const gfx::VectorIcon& PlaylistActionIconView::GetVectorIcon() const {
}
void PlaylistActionIconView::UpdateImpl() {
if (auto old_contents = std::exchange(last_web_contents_, GetWebContents());
old_contents == last_web_contents_) {
if (!GetWebContents()) {
return;
}
@@ -133,12 +131,10 @@ void PlaylistActionIconView::UpdateState(bool has_saved, bool found_items) {
: found_items ? State::kFound
: State::kNone;
if (auto old_state = std::exchange(state_, target_state);
old_state == target_state) {
return;
old_state != target_state) {
DVLOG(2) << __FUNCTION__ << " " << static_cast<int>(target_state);
UpdateIconImage();
}
DVLOG(2) << __FUNCTION__ << " " << static_cast<int>(target_state);
UpdateIconImage();
UpdateVisibilityPerState();
}
@@ -43,8 +43,7 @@ class PlaylistActionIconView : public PageActionIconView,
enum class State { kNone, kAdded, kFound };
playlist::PlaylistTabHelper* playlist_tab_helper() {
return playlist::PlaylistTabHelper::FromWebContents(
last_web_contents_.get());
return playlist::PlaylistTabHelper::FromWebContents(GetWebContents());
}
void UpdateState(bool has_saved, bool found_items);
@@ -63,8 +62,6 @@ class PlaylistActionIconView : public PageActionIconView,
State state_ = State::kNone;
raw_ptr<content::WebContents> last_web_contents_ = nullptr;
base::ScopedObservation<playlist::PlaylistTabHelper,
playlist::PlaylistTabHelperObserver>
playlist_tab_helper_observation_{this};