OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/info_bubble_window.h" | 5 #import "chrome/browser/cocoa/info_bubble_window.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
9 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 9 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
10 | 10 |
(...skipping 88 matching lines...) Loading... |
99 - (void)close { | 99 - (void)close { |
100 // Block the window from receiving events while it fades out. | 100 // Block the window from receiving events while it fades out. |
101 closing_ = YES; | 101 closing_ = YES; |
102 | 102 |
103 if (!delayOnClose_) { | 103 if (!delayOnClose_) { |
104 [self finishCloseAfterAnimation]; | 104 [self finishCloseAfterAnimation]; |
105 } else { | 105 } else { |
106 // Apply animations to hide self. | 106 // Apply animations to hide self. |
107 [NSAnimationContext beginGrouping]; | 107 [NSAnimationContext beginGrouping]; |
108 [[NSAnimationContext currentContext] | 108 [[NSAnimationContext currentContext] |
109 gtm_setDuration:kOrderOutAnimationDuration]; | 109 gtm_setDuration:kOrderOutAnimationDuration |
| 110 eventMask:NSLeftMouseDownMask]; |
110 [[self animator] setAlphaValue:0.0]; | 111 [[self animator] setAlphaValue:0.0]; |
111 [NSAnimationContext endGrouping]; | 112 [NSAnimationContext endGrouping]; |
112 } | 113 } |
113 } | 114 } |
114 | 115 |
115 // Called by InfoBubbleWindowCloser when the window is to be really closed | 116 // Called by InfoBubbleWindowCloser when the window is to be really closed |
116 // after the fading animation is complete. | 117 // after the fading animation is complete. |
117 - (void)finishCloseAfterAnimation { | 118 - (void)finishCloseAfterAnimation { |
118 if (closing_) | 119 if (closing_) |
119 [super close]; | 120 [super close]; |
(...skipping 11 matching lines...) Loading... |
131 | 132 |
132 // Set up frame so it can be adjust down by a few pixels. | 133 // Set up frame so it can be adjust down by a few pixels. |
133 NSRect frame = [self frame]; | 134 NSRect frame = [self frame]; |
134 NSPoint newOrigin = frame.origin; | 135 NSPoint newOrigin = frame.origin; |
135 newOrigin.y += kOrderInSlideOffset; | 136 newOrigin.y += kOrderInSlideOffset; |
136 [self setFrameOrigin:newOrigin]; | 137 [self setFrameOrigin:newOrigin]; |
137 | 138 |
138 // Apply animations to show and move self. | 139 // Apply animations to show and move self. |
139 [NSAnimationContext beginGrouping]; | 140 [NSAnimationContext beginGrouping]; |
140 [[NSAnimationContext currentContext] | 141 [[NSAnimationContext currentContext] |
141 gtm_setDuration:kOrderInAnimationDuration]; | 142 gtm_setDuration:kOrderInAnimationDuration |
| 143 eventMask:NSLeftMouseDownMask]; |
142 [[self animator] setAlphaValue:1.0]; | 144 [[self animator] setAlphaValue:1.0]; |
143 [[self animator] setFrame:frame display:YES]; | 145 [[self animator] setFrame:frame display:YES]; |
144 [NSAnimationContext endGrouping]; | 146 [NSAnimationContext endGrouping]; |
145 } else { | 147 } else { |
146 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; | 148 [super orderWindow:orderingMode relativeTo:otherWindowNumber]; |
147 } | 149 } |
148 } | 150 } |
149 | 151 |
150 // If the window is currently animating a close, block all UI events to the | 152 // If the window is currently animating a close, block all UI events to the |
151 // window. | 153 // window. |
152 - (void)sendEvent:(NSEvent*)theEvent { | 154 - (void)sendEvent:(NSEvent*)theEvent { |
153 if (!closing_) | 155 if (!closing_) |
154 [super sendEvent:theEvent]; | 156 [super sendEvent:theEvent]; |
155 } | 157 } |
156 | 158 |
157 - (BOOL)isClosing { | 159 - (BOOL)isClosing { |
158 return closing_; | 160 return closing_; |
159 } | 161 } |
160 | 162 |
161 @end | 163 @end |
OLD | NEW |