Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: ui/message_center/cocoa/popup_collection.mm

Issue 14735009: mac: Minor tweaks to notifications code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tweak text metrics Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/message_center/cocoa/notification_controller.mm ('k') | ui/message_center/message_center.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_constants.h" 10 #include "ui/message_center/message_center_constants.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 popup_collection_(popup_collection) { 44 popup_collection_(popup_collection) {
45 message_center_->AddObserver(this); 45 message_center_->AddObserver(this);
46 } 46 }
47 47
48 virtual ~PopupCollectionObserver() { 48 virtual ~PopupCollectionObserver() {
49 message_center_->RemoveObserver(this); 49 message_center_->RemoveObserver(this);
50 } 50 }
51 51
52 virtual void OnNotificationAdded( 52 virtual void OnNotificationAdded(
53 const std::string& notification_id) OVERRIDE { 53 const std::string& notification_id) OVERRIDE {
54 const auto& popups = message_center_->GetPopupNotifications(); 54 for (const auto& notification : message_center_->GetPopupNotifications()) {
55 for (auto it = popups.begin(); it != popups.end(); ++it) { 55 if (notification->id() == notification_id) {
56 if ((*it)->id() == notification_id) { 56 [popup_collection_ addNotification:notification];
57 [popup_collection_ addNotification:*it];
58 return; 57 return;
59 } 58 }
60 } 59 }
61 } 60 }
62 61
63 virtual void OnNotificationRemoved(const std::string& notification_id, 62 virtual void OnNotificationRemoved(const std::string& notification_id,
64 bool user_id) OVERRIDE { 63 bool user_id) OVERRIDE {
65 [popup_collection_ removeNotification:notification_id]; 64 [popup_collection_ removeNotification:notification_id];
66 } 65 }
67 66
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 // If there's no room left on screen to display notifications, stop 256 // If there's no room left on screen to display notifications, stop
258 // trying. 257 // trying.
259 if (![self addNotification:*it]) 258 if (![self addNotification:*it])
260 break; 259 break;
261 } 260 }
262 } 261 }
263 } 262 }
264 } 263 }
265 264
266 @end 265 @end
OLDNEW
« no previous file with comments | « ui/message_center/cocoa/notification_controller.mm ('k') | ui/message_center/message_center.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698