Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1104)

Unified Diff: chrome/browser/ui/cocoa/hover_close_button.mm

Issue 16098012: [Mac] Reimplement HoverButton and HoverImageButton using NSButton.state. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nonatomic, assign Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/base/cocoa/hover_button.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
Nico 2013/06/06 19:25:43 This is only called if showsBorderOnlyWhileMouseIn
Nico 2013/06/06 19:25:43 This is only called if showsBorderOnlyWhileMouseIn
+ 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];
}
}
« no previous file with comments | « no previous file | ui/base/cocoa/hover_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698