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_collection.h" | 5 #import "ui/message_center/cocoa/popup_collection.h" |
6 | 6 |
7 #import "ui/message_center/cocoa/notification_controller.h" | 7 #import "ui/message_center/cocoa/notification_controller.h" |
8 #import "ui/message_center/cocoa/popup_controller.h" | 8 #import "ui/message_center/cocoa/popup_controller.h" |
9 #include "ui/message_center/message_center.h" | 9 #include "ui/message_center/message_center.h" |
10 #include "ui/message_center/message_center_observer.h" | 10 #include "ui/message_center/message_center_observer.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 - (void)setAnimationEndedCallback: | 143 - (void)setAnimationEndedCallback: |
144 (message_center::AnimationEndedCallback)callback { | 144 (message_center::AnimationEndedCallback)callback { |
145 testingAnimationEndedCallback_.reset(Block_copy(callback)); | 145 testingAnimationEndedCallback_.reset(Block_copy(callback)); |
146 } | 146 } |
147 | 147 |
148 // Private ///////////////////////////////////////////////////////////////////// | 148 // Private ///////////////////////////////////////////////////////////////////// |
149 | 149 |
150 - (NSRect)screenFrame { | 150 - (NSRect)screenFrame { |
151 if (!NSIsEmptyRect(testingScreenFrame_)) | 151 if (!NSIsEmptyRect(testingScreenFrame_)) |
152 return testingScreenFrame_; | 152 return testingScreenFrame_; |
153 return [[[NSScreen screens] objectAtIndex:0] visibleFrame]; | 153 return [[[NSScreen screens] firstObject] visibleFrame]; |
154 } | 154 } |
155 | 155 |
156 - (BOOL)addNotification:(const message_center::Notification*)notification { | 156 - (BOOL)addNotification:(const message_center::Notification*)notification { |
157 // Wait till all existing animations end. | 157 // Wait till all existing animations end. |
158 if ([self isAnimating]) | 158 if ([self isAnimating]) |
159 return NO; | 159 return NO; |
160 | 160 |
161 // The popup is owned by itself. It will be released at close. | 161 // The popup is owned by itself. It will be released at close. |
162 MCPopupController* popup = | 162 MCPopupController* popup = |
163 [[MCPopupController alloc] initWithNotification:notification | 163 [[MCPopupController alloc] initWithNotification:notification |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 389 } |
390 | 390 |
391 pendingUpdateNotificationIDs_.clear(); | 391 pendingUpdateNotificationIDs_.clear(); |
392 | 392 |
393 // Start re-layout of all notifications, so that it readjusts the Y origin of | 393 // Start re-layout of all notifications, so that it readjusts the Y origin of |
394 // all updated popups and any popups that come below them. | 394 // all updated popups and any popups that come below them. |
395 [self layoutNotifications]; | 395 [self layoutNotifications]; |
396 } | 396 } |
397 | 397 |
398 @end | 398 @end |
OLD | NEW |