Chromium Code Reviews| 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/chrome_notification_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 ChromeNotificationDisplayService::ChromeNotificationDisplayService( | |
| 12 Profile* profile, | |
| 13 NotificationUIManager* ui_manager) | |
| 14 : profile_(profile), ui_manager_(ui_manager) {} | |
| 15 | |
| 16 ChromeNotificationDisplayService::~ChromeNotificationDisplayService() {} | |
| 17 | |
| 18 void ChromeNotificationDisplayService::Display( | |
| 19 const std::string& notification_id, | |
| 20 const Notification& notification) { | |
| 21 ui_manager_->Add(notification, profile_); | |
|
Peter Beverloo
2016/04/18 14:57:09
How do you imagine this will be updated with deleg
Miguel Garcia
2016/04/19 14:24:57
Once we start getting mojo objects instead of Noti
| |
| 22 } | |
| 23 | |
| 24 void ChromeNotificationDisplayService::Close( | |
| 25 const std::string& notification_id) { | |
| 26 ui_manager_->CancelById(notification_id, | |
| 27 NotificationUIManager::GetProfileID(profile_)); | |
| 28 } | |
| 29 | |
| 30 bool ChromeNotificationDisplayService::GetDisplayed( | |
| 31 std::set<std::string>* notifications) const { | |
| 32 DCHECK(notifications); | |
| 33 for (auto notification_id : ui_manager_->GetAllIdsByProfile( | |
| 34 NotificationUIManager::GetProfileID(profile_))) { | |
| 35 notifications->insert(notification_id); | |
| 36 } | |
| 37 return true; | |
| 38 } | |
| 39 | |
| 40 bool ChromeNotificationDisplayService::SupportsNotificationCenter() const { | |
| 41 return false; | |
| 42 } | |
| OLD | NEW |