OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/notifications/message_center_display_service.h" |
| 6 |
| 7 #include "chrome/browser/notifications/notification.h" |
| 8 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 9 #include "chrome/browser/profiles/profile.h" |
| 10 |
| 11 MessageCenterDisplayService::MessageCenterDisplayService( |
| 12 Profile* profile, |
| 13 NotificationUIManager* ui_manager) |
| 14 : profile_(profile), ui_manager_(ui_manager) {} |
| 15 |
| 16 MessageCenterDisplayService::~MessageCenterDisplayService() {} |
| 17 |
| 18 void MessageCenterDisplayService::Display(const std::string& notification_id, |
| 19 const Notification& notification) { |
| 20 ui_manager_->Add(notification, profile_); |
| 21 } |
| 22 |
| 23 void MessageCenterDisplayService::Close(const std::string& notification_id) { |
| 24 ui_manager_->CancelById(notification_id, |
| 25 NotificationUIManager::GetProfileID(profile_)); |
| 26 } |
| 27 |
| 28 bool MessageCenterDisplayService::GetDisplayed( |
| 29 std::set<std::string>* notifications) const { |
| 30 DCHECK(notifications); |
| 31 for (auto notification_id : ui_manager_->GetAllIdsByProfile( |
| 32 NotificationUIManager::GetProfileID(profile_))) { |
| 33 notifications->insert(notification_id); |
| 34 } |
| 35 return true; |
| 36 } |
| 37 |
| 38 bool MessageCenterDisplayService::SupportsNotificationCenter() const { |
| 39 return false; |
| 40 } |
OLD | NEW |