Commit 359ca5eb authored by Tommy Steimel's avatar Tommy Steimel Committed by Commit Bot

GMC: Fix crash when updating icon

This CL modifies the MediaToolbarButtonView to check for a Widget
before updating its icons. This prevents a crash where the button would
try to read theme data from the Widget after it was gone. In addition,
this CL changes the logic for updating the icon on enable/disable to
only happen on Mac, since Mac is the only OS where the icon can change
from enabling/disabling.

Bug: 1006359
Change-Id: I009d5e5e921982be2628ce51f0488c463985dd58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1815904Reviewed-by: default avatarJazz Xu <jazzhsu@chromium.org>
Commit-Queue: Tommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699062}
parent d26bde32
......@@ -68,14 +68,18 @@ void MediaToolbarButtonView::Hide() {
void MediaToolbarButtonView::Enable() {
SetEnabled(true);
UpdateIcon();
InformIPHOfButtonEnabled();
#if defined(OS_MACOSX)
UpdateIcon();
#endif // defined(OS_MACOSX)
}
void MediaToolbarButtonView::Disable() {
SetEnabled(false);
UpdateIcon();
InformIPHOfButtonDisabledorHidden();
#if defined(OS_MACOSX)
UpdateIcon();
#endif // defined(OS_MACOSX)
}
SkColor MediaToolbarButtonView::GetInkDropBaseColor() const {
......@@ -85,6 +89,9 @@ SkColor MediaToolbarButtonView::GetInkDropBaseColor() const {
}
void MediaToolbarButtonView::UpdateIcon() {
if (!GetWidget())
return;
const gfx::VectorIcon& icon = ::vector_icons::kQueueMusicIcon;
const SkColor normal_color =
......
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