Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/notifications/message_center_notification_manager.h" | 5 #include "chrome/browser/notifications/message_center_notification_manager.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 // (which is an app url in case of app/extension) to scope the replace ids | 134 // (which is an app url in case of app/extension) to scope the replace ids |
| 135 // in the given profile. | 135 // in the given profile. |
| 136 for (NotificationMap::iterator iter = profile_notifications_.begin(); | 136 for (NotificationMap::iterator iter = profile_notifications_.begin(); |
| 137 iter != profile_notifications_.end(); ++iter) { | 137 iter != profile_notifications_.end(); ++iter) { |
| 138 ProfileNotification* old_notification = (*iter).second; | 138 ProfileNotification* old_notification = (*iter).second; |
| 139 if (old_notification->notification().replace_id() == replace_id && | 139 if (old_notification->notification().replace_id() == replace_id && |
| 140 old_notification->notification().origin_url() == origin_url && | 140 old_notification->notification().origin_url() == origin_url && |
| 141 old_notification->profile()->IsSameProfile(profile)) { | 141 old_notification->profile()->IsSameProfile(profile)) { |
| 142 std::string old_id = | 142 std::string old_id = |
| 143 old_notification->notification().notification_id(); | 143 old_notification->notification().notification_id(); |
| 144 DCHECK(message_center_->GetNotificationList()->HasNotification(old_id)); | 144 DCHECK(message_center_->notification_list()->HasNotification(old_id)); |
|
dharcourt
2013/03/01 10:17:31
GetNotificationList() was a functional duplicate o
| |
| 145 | 145 |
| 146 // Add/remove notification in the local list but just update the same | 146 // Add/remove notification in the local list but just update the same |
| 147 // one in MessageCenter. | 147 // one in MessageCenter. |
| 148 old_notification->notification().Close(false); // Not by user. | 148 old_notification->notification().Close(false); // Not by user. |
| 149 delete old_notification; | 149 delete old_notification; |
| 150 profile_notifications_.erase(old_id); | 150 profile_notifications_.erase(old_id); |
| 151 ProfileNotification* new_notification = | 151 ProfileNotification* new_notification = |
| 152 new ProfileNotification(profile, notification, message_center_); | 152 new ProfileNotification(profile, notification, message_center_); |
| 153 profile_notifications_[notification.notification_id()] = new_notification; | 153 profile_notifications_[notification.notification_id()] = new_notification; |
| 154 message_center_->UpdateNotification(old_id, | 154 message_center_->UpdateNotification(old_id, |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 | 403 |
| 404 MessageCenterNotificationManager::ProfileNotification* | 404 MessageCenterNotificationManager::ProfileNotification* |
| 405 MessageCenterNotificationManager::FindProfileNotification( | 405 MessageCenterNotificationManager::FindProfileNotification( |
| 406 const std::string& id) const { | 406 const std::string& id) const { |
| 407 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 407 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
| 408 // If the notification is shown in UI, it must be in the map. | 408 // If the notification is shown in UI, it must be in the map. |
| 409 DCHECK(iter != profile_notifications_.end()); | 409 DCHECK(iter != profile_notifications_.end()); |
| 410 DCHECK((*iter).second); | 410 DCHECK((*iter).second); |
| 411 return (*iter).second; | 411 return (*iter).second; |
| 412 } | 412 } |
| OLD | NEW |