| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 NSRect bounds = [popup bounds]; | 185 NSRect bounds = [popup bounds]; |
| 186 bounds.origin.x = x; | 186 bounds.origin.x = x; |
| 187 bounds.origin.y = y; | 187 bounds.origin.y = y; |
| 188 [popup showWithAnimation:bounds]; | 188 [popup showWithAnimation:bounds]; |
| 189 [popups_ addObject:popup]; | 189 [popups_ addObject:popup]; |
| 190 messageCenter_->DisplayedNotification( | 190 messageCenter_->DisplayedNotification( |
| 191 notification->id(), message_center::DISPLAY_SOURCE_POPUP); | 191 notification->id(), message_center::DISPLAY_SOURCE_POPUP); |
| 192 return YES; | 192 return YES; |
| 193 } | 193 } |
| 194 | 194 |
| 195 // The popup cannot fit on screen, so it has to be released now. | 195 // The popup cannot fit on screen, so it has to be closed now. |
| 196 [popup release]; | 196 [popup close]; |
| 197 return NO; | 197 return NO; |
| 198 } | 198 } |
| 199 | 199 |
| 200 - (void)updateNotification:(const std::string&)notificationID { | 200 - (void)updateNotification:(const std::string&)notificationID { |
| 201 // The notification may not be on screen. Create it if needed. | 201 // The notification may not be on screen. Create it if needed. |
| 202 if ([self indexOfPopupWithNotificationID:notificationID] == NSNotFound) { | 202 if ([self indexOfPopupWithNotificationID:notificationID] == NSNotFound) { |
| 203 [self layoutNewNotifications]; | 203 [self layoutNewNotifications]; |
| 204 return; | 204 return; |
| 205 } | 205 } |
| 206 | 206 |
| (...skipping 182 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 |