OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/cocoa/popup_controller.h" | 5 #import "ui/message_center/cocoa/popup_controller.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #import "base/mac/foundation_util.h" | 9 #import "base/mac/foundation_util.h" |
10 #import "base/mac/sdk_forward_declarations.h" | 10 #import "base/mac/sdk_forward_declarations.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 options:NSTrackingInVisibleRect | | 129 options:NSTrackingInVisibleRect | |
130 NSTrackingMouseEnteredAndExited | | 130 NSTrackingMouseEnteredAndExited | |
131 NSTrackingActiveAlways | 131 NSTrackingActiveAlways |
132 owner:self | 132 owner:self |
133 userInfo:nil]); | 133 userInfo:nil]); |
134 [[window contentView] addTrackingArea:trackingArea_.get()]; | 134 [[window contentView] addTrackingArea:trackingArea_.get()]; |
135 } | 135 } |
136 return self; | 136 return self; |
137 } | 137 } |
138 | 138 |
| 139 #ifndef NDEBUG |
| 140 - (void)dealloc { |
| 141 DCHECK(hasBeenClosed_); |
| 142 [super dealloc]; |
| 143 } |
| 144 #endif |
| 145 |
139 - (void)close { | 146 - (void)close { |
| 147 #ifndef NDEBUG |
| 148 hasBeenClosed_ = YES; |
| 149 #endif |
140 [self setBoundsAnimation:nil]; | 150 [self setBoundsAnimation:nil]; |
141 if (trackingArea_.get()) | 151 if (trackingArea_.get()) |
142 [[[self window] contentView] removeTrackingArea:trackingArea_.get()]; | 152 [[[self window] contentView] removeTrackingArea:trackingArea_.get()]; |
143 [super close]; | 153 [super close]; |
144 [self performSelectorOnMainThread:@selector(release) | 154 [self performSelectorOnMainThread:@selector(release) |
145 withObject:nil | 155 withObject:nil |
146 waitUntilDone:NO | 156 waitUntilDone:NO |
147 modes:@[ NSDefaultRunLoopMode ]]; | 157 modes:@[ NSDefaultRunLoopMode ]]; |
148 } | 158 } |
149 | 159 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 [self setBoundsAnimation:animation]; | 242 [self setBoundsAnimation:animation]; |
233 [boundsAnimation_ setDuration:[popupCollection_ popupAnimationDuration]]; | 243 [boundsAnimation_ setDuration:[popupCollection_ popupAnimationDuration]]; |
234 [boundsAnimation_ setDelegate:self]; | 244 [boundsAnimation_ setDelegate:self]; |
235 [boundsAnimation_ startAnimation]; | 245 [boundsAnimation_ startAnimation]; |
236 } | 246 } |
237 | 247 |
238 - (void)closeWithAnimation { | 248 - (void)closeWithAnimation { |
239 if (isClosing_) | 249 if (isClosing_) |
240 return; | 250 return; |
241 | 251 |
| 252 #ifndef NDEBUG |
| 253 hasBeenClosed_ = YES; |
| 254 #endif |
242 isClosing_ = YES; | 255 isClosing_ = YES; |
243 | 256 |
244 // If the notification was swiped closed, do not animate it as the | 257 // If the notification was swiped closed, do not animate it as the |
245 // notification has already faded out. | 258 // notification has already faded out. |
246 if (swipeGestureEnded_) { | 259 if (swipeGestureEnded_) { |
247 [self close]; | 260 [self close]; |
248 return; | 261 return; |
249 } | 262 } |
250 | 263 |
251 NSDictionary* animationDict = @{ | 264 NSDictionary* animationDict = @{ |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 298 |
286 - (void)mouseEntered:(NSEvent*)event { | 299 - (void)mouseEntered:(NSEvent*)event { |
287 messageCenter_->PausePopupTimers(); | 300 messageCenter_->PausePopupTimers(); |
288 } | 301 } |
289 | 302 |
290 - (void)mouseExited:(NSEvent*)event { | 303 - (void)mouseExited:(NSEvent*)event { |
291 messageCenter_->RestartPopupTimers(); | 304 messageCenter_->RestartPopupTimers(); |
292 } | 305 } |
293 | 306 |
294 @end | 307 @end |
OLD | NEW |