| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 : message_center_(message_center), | 55 : message_center_(message_center), |
| 56 popup_collection_(popup_collection) { | 56 popup_collection_(popup_collection) { |
| 57 message_center_->AddObserver(this); | 57 message_center_->AddObserver(this); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual ~PopupCollectionObserver() { | 60 virtual ~PopupCollectionObserver() { |
| 61 message_center_->RemoveObserver(this); | 61 message_center_->RemoveObserver(this); |
| 62 } | 62 } |
| 63 | 63 |
| 64 virtual void OnNotificationAdded( | 64 virtual void OnNotificationAdded( |
| 65 const std::string& notification_id) OVERRIDE { | 65 const std::string& notification_id) override { |
| 66 [popup_collection_ layoutNewNotifications]; | 66 [popup_collection_ layoutNewNotifications]; |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual void OnNotificationRemoved(const std::string& notification_id, | 69 virtual void OnNotificationRemoved(const std::string& notification_id, |
| 70 bool user_id) OVERRIDE { | 70 bool user_id) override { |
| 71 [popup_collection_ removeNotification:notification_id]; | 71 [popup_collection_ removeNotification:notification_id]; |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void OnNotificationUpdated( | 74 virtual void OnNotificationUpdated( |
| 75 const std::string& notification_id) OVERRIDE { | 75 const std::string& notification_id) override { |
| 76 [popup_collection_ updateNotification:notification_id]; | 76 [popup_collection_ updateNotification:notification_id]; |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 message_center::MessageCenter* message_center_; // Weak, global. | 80 message_center::MessageCenter* message_center_; // Weak, global. |
| 81 | 81 |
| 82 MCPopupCollection* popup_collection_; // Weak, owns this. | 82 MCPopupCollection* popup_collection_; // Weak, owns this. |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 } // namespace | 85 } // namespace |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 } | 393 } |
| 394 | 394 |
| 395 pendingUpdateNotificationIDs_.clear(); | 395 pendingUpdateNotificationIDs_.clear(); |
| 396 | 396 |
| 397 // Start re-layout of all notifications, so that it readjusts the Y origin of | 397 // Start re-layout of all notifications, so that it readjusts the Y origin of |
| 398 // all updated popups and any popups that come below them. | 398 // all updated popups and any popups that come below them. |
| 399 [self layoutNotifications]; | 399 [self layoutNotifications]; |
| 400 } | 400 } |
| 401 | 401 |
| 402 @end | 402 @end |
| OLD | NEW |