Chromium Code Reviews| Index: chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.mm |
| diff --git a/chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.mm b/chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.mm |
| index 7bfde635e58cbed315e936a7a0c1051b95215500..0bfe358743f9352742b0dcf61d37c33d08875ae5 100644 |
| --- a/chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.mm |
| +++ b/chrome/browser/ui/cocoa/tabs/alert_indicator_button_cocoa.mm |
| @@ -72,17 +72,22 @@ class FadeAnimationDelegate : public gfx::AnimationDelegate { |
| [super removeFromSuperview]; |
| } |
| +- (void)updateIconForState:(TabAlertState)aState { |
| + if (aState != TabAlertState::NONE) { |
| + TabView* const tabView = base::mac::ObjCCast<TabView>([self superview]); |
| + SkColor iconColor = [tabView closeButtonColor]; |
| + NSImage* tabIndicatorImage = |
| + chrome::GetTabAlertIndicatorImage(aState, iconColor).ToNSImage(); |
| + [self setImage:tabIndicatorImage]; |
| + affordanceImage_.reset([tabIndicatorImage retain]); |
|
Avi (use Gerrit)
2016/04/14 02:35:08
You can do
affordanceImage_.reset(tabIndicatorIma
|
| + } |
| +} |
| + |
| - (void)transitionToAlertState:(TabAlertState)nextState { |
| if (nextState == alertState_) |
| return; |
| - if (nextState != TabAlertState::NONE) { |
| - [self |
| - setImage:chrome::GetTabAlertIndicatorImage(nextState, 0).ToNSImage()]; |
| - affordanceImage_.reset( |
| - [chrome::GetTabAlertIndicatorAffordanceImage(nextState, 0) |
| - .ToNSImage() retain]); |
| - } |
| + [self updateIconForState:nextState]; |
| if ((alertState_ == TabAlertState::AUDIO_PLAYING && |
| nextState == TabAlertState::AUDIO_MUTING) || |
| @@ -237,4 +242,15 @@ class FadeAnimationDelegate : public gfx::AnimationDelegate { |
| [self setEnabled:enable]; |
| } |
| +// ThemedWindowDrawing protocol support. |
| + |
| +- (void)windowDidChangeTheme { |
| + // Force the alert icon to update because the icon color may change based |
| + // on the current theme. |
| + [self updateIconForState:alertState_]; |
| +} |
| + |
| +- (void)windowDidChangeActive { |
| +} |
| + |
| @end |