Index: chrome/browser/ui/cocoa/hover_close_button.mm |
diff --git a/chrome/browser/ui/cocoa/hover_close_button.mm b/chrome/browser/ui/cocoa/hover_close_button.mm |
index f01a1720b226400c9ccffd6ac7054dfb37f06129..8c62e55b228c6e3604940d1a4ba24fbc6a7f732e 100644 |
--- a/chrome/browser/ui/cocoa/hover_close_button.mm |
+++ b/chrome/browser/ui/cocoa/hover_close_button.mm |
@@ -176,25 +176,24 @@ NSString* const kFadeOutValueKeyPath = @"fadeOutValue"; |
return bundle.GetNativeImageNamed(imageID).ToNSImage(); |
} |
-- (void)setHoverState:(HoverState)state { |
- if (state != self.hoverState) { |
- previousState_ = self.hoverState; |
- [super setHoverState:state]; |
- // Only animate the HoverStateNone case. |
- if (state == kHoverStateNone) { |
- DCHECK(fadeOutAnimation_ == nil); |
- fadeOutAnimation_ = |
- [[GTMKeyValueAnimation alloc] initWithTarget:self |
- keyPath:kFadeOutValueKeyPath]; |
- [fadeOutAnimation_ setDuration:kCloseAnimationDuration]; |
- [fadeOutAnimation_ setFrameRate:kFramesPerSecond]; |
- [fadeOutAnimation_ setDelegate:self]; |
- [fadeOutAnimation_ startAnimation]; |
- } else { |
- // -stopAnimation will call the animationDidStop: delegate method |
- // which will clean up the animation. |
- [fadeOutAnimation_ stopAnimation]; |
- } |
+- (void)mouseExited:(NSEvent*)event { |
+ previousState_ = self.hoverState; |
+ [super mouseExited:event]; |
+ |
+ // Only animate the HoverStateNone case. |
+ if (self.hoverState == kHoverStateNone) { |
+ DCHECK(fadeOutAnimation_ == nil); |
+ fadeOutAnimation_ = |
+ [[GTMKeyValueAnimation alloc] initWithTarget:self |
+ keyPath:kFadeOutValueKeyPath]; |
+ [fadeOutAnimation_ setDuration:kCloseAnimationDuration]; |
+ [fadeOutAnimation_ setFrameRate:kFramesPerSecond]; |
+ [fadeOutAnimation_ setDelegate:self]; |
+ [fadeOutAnimation_ startAnimation]; |
+ } else { |
+ // -stopAnimation will call the animationDidStop: delegate method |
+ // which will clean up the animation. |
+ [fadeOutAnimation_ stopAnimation]; |
} |
} |