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_info_map.h" | 10 #include "chrome/browser/extensions/extension_info_map.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 #endif | 57 #endif |
58 } | 58 } |
59 | 59 |
60 MessageCenterNotificationManager::~MessageCenterNotificationManager() { | 60 MessageCenterNotificationManager::~MessageCenterNotificationManager() { |
61 message_center_->RemoveObserver(this); | 61 message_center_->RemoveObserver(this); |
62 } | 62 } |
63 | 63 |
64 //////////////////////////////////////////////////////////////////////////////// | 64 //////////////////////////////////////////////////////////////////////////////// |
65 // NotificationUIManager | 65 // NotificationUIManager |
66 | 66 |
67 bool MessageCenterNotificationManager::DoesIdExist(const std::string& id) { | 67 bool MessageCenterNotificationManager::DoesIdExist( |
68 if (NotificationUIManagerImpl::DoesIdExist(id)) | 68 const std::string& id, Notification* matched_notification) { |
| 69 if (NotificationUIManagerImpl::DoesIdExist(id, matched_notification)) |
69 return true; | 70 return true; |
70 NotificationMap::iterator iter = profile_notifications_.find(id); | 71 NotificationMap::iterator iter = profile_notifications_.find(id); |
71 if (iter == profile_notifications_.end()) | 72 if (iter == profile_notifications_.end()) |
72 return false; | 73 return false; |
| 74 if (matched_notification) |
| 75 *matched_notification = iter->second->notification(); |
73 return true; | 76 return true; |
74 } | 77 } |
75 | 78 |
76 bool MessageCenterNotificationManager::CancelById(const std::string& id) { | 79 bool MessageCenterNotificationManager::CancelById(const std::string& id) { |
77 // See if this ID hasn't been shown yet. | 80 // See if this ID hasn't been shown yet. |
78 if (NotificationUIManagerImpl::CancelById(id)) | 81 if (NotificationUIManagerImpl::CancelById(id)) |
79 return true; | 82 return true; |
80 | 83 |
81 // If it has been shown, remove it. | 84 // If it has been shown, remove it. |
82 NotificationMap::iterator iter = profile_notifications_.find(id); | 85 NotificationMap::iterator iter = profile_notifications_.find(id); |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 | 527 |
525 MessageCenterNotificationManager::ProfileNotification* | 528 MessageCenterNotificationManager::ProfileNotification* |
526 MessageCenterNotificationManager::FindProfileNotification( | 529 MessageCenterNotificationManager::FindProfileNotification( |
527 const std::string& id) const { | 530 const std::string& id) const { |
528 NotificationMap::const_iterator iter = profile_notifications_.find(id); | 531 NotificationMap::const_iterator iter = profile_notifications_.find(id); |
529 if (iter == profile_notifications_.end()) | 532 if (iter == profile_notifications_.end()) |
530 return NULL; | 533 return NULL; |
531 | 534 |
532 return (*iter).second; | 535 return (*iter).second; |
533 } | 536 } |
OLD | NEW |