| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #import "chrome/browser/ui/cocoa/info_bubble_window.h" | 5 #import "chrome/browser/ui/cocoa/info_bubble_window.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "chrome/common/chrome_notification_types.h" | 10 #include "chrome/common/chrome_notification_types.h" |
| 11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
| 13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
| 14 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 14 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 const CGFloat kOrderInSlideOffset = 10; | 17 const CGFloat kOrderInSlideOffset = 10; |
| 18 const NSTimeInterval kOrderInAnimationDuration = 0.075; | 18 const NSTimeInterval kOrderInAnimationDuration = 0.075; |
| 19 const NSTimeInterval kOrderOutAnimationDuration = 0.15; | 19 const NSTimeInterval kOrderOutAnimationDuration = 0.15; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 // Start invisible. Will be made visible when ordered front. | 117 // Start invisible. Will be made visible when ordered front. |
| 118 [self setAlphaValue:0.0]; | 118 [self setAlphaValue:0.0]; |
| 119 | 119 |
| 120 // Set up alphaValue animation so that self is delegate for the animation. | 120 // Set up alphaValue animation so that self is delegate for the animation. |
| 121 // Setting up the delegate is required so that the | 121 // Setting up the delegate is required so that the |
| 122 // animationDidStop:finished: callback can be handled. | 122 // animationDidStop:finished: callback can be handled. |
| 123 // Notice that only the alphaValue Animation is replaced in case | 123 // Notice that only the alphaValue Animation is replaced in case |
| 124 // superclasses set up animations. | 124 // superclasses set up animations. |
| 125 CAAnimation* alphaAnimation = [CABasicAnimation animation]; | 125 CAAnimation* alphaAnimation = [CABasicAnimation animation]; |
| 126 scoped_nsobject<InfoBubbleWindowCloser> delegate( | 126 base::scoped_nsobject<InfoBubbleWindowCloser> delegate( |
| 127 [[InfoBubbleWindowCloser alloc] initWithWindow:self]); | 127 [[InfoBubbleWindowCloser alloc] initWithWindow:self]); |
| 128 [alphaAnimation setDelegate:delegate]; | 128 [alphaAnimation setDelegate:delegate]; |
| 129 NSMutableDictionary* animations = | 129 NSMutableDictionary* animations = |
| 130 [NSMutableDictionary dictionaryWithDictionary:[self animations]]; | 130 [NSMutableDictionary dictionaryWithDictionary:[self animations]]; |
| 131 [animations setObject:alphaAnimation forKey:@"alphaValue"]; | 131 [animations setObject:alphaAnimation forKey:@"alphaValue"]; |
| 132 [self setAnimations:animations]; | 132 [self setAnimations:animations]; |
| 133 } | 133 } |
| 134 return self; | 134 return self; |
| 135 } | 135 } |
| 136 | 136 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 - (void)sendEvent:(NSEvent*)theEvent { | 226 - (void)sendEvent:(NSEvent*)theEvent { |
| 227 if (!closing_) | 227 if (!closing_) |
| 228 [super sendEvent:theEvent]; | 228 [super sendEvent:theEvent]; |
| 229 } | 229 } |
| 230 | 230 |
| 231 - (BOOL)isClosing { | 231 - (BOOL)isClosing { |
| 232 return closing_; | 232 return closing_; |
| 233 } | 233 } |
| 234 | 234 |
| 235 @end | 235 @end |
| OLD | NEW |