Chromium Code Reviews| Index: chrome/browser/notifications/chrome_notification_display_service.cc |
| diff --git a/chrome/browser/notifications/chrome_notification_display_service.cc b/chrome/browser/notifications/chrome_notification_display_service.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4bea0e7bc7926ceb1f3d5562821d267f050d7cb7 |
| --- /dev/null |
| +++ b/chrome/browser/notifications/chrome_notification_display_service.cc |
| @@ -0,0 +1,42 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/notifications/chrome_notification_display_service.h" |
| + |
| +#include "chrome/browser/notifications/notification.h" |
| +#include "chrome/browser/notifications/notification_ui_manager.h" |
| +#include "chrome/browser/profiles/profile.h" |
| + |
| +ChromeNotificationDisplayService::ChromeNotificationDisplayService( |
| + Profile* profile, |
| + NotificationUIManager* ui_manager) |
| + : profile_(profile), ui_manager_(ui_manager) {} |
| + |
| +ChromeNotificationDisplayService::~ChromeNotificationDisplayService() {} |
| + |
| +void ChromeNotificationDisplayService::Display( |
| + const std::string& notification_id, |
| + const Notification& notification) { |
| + 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
|
| +} |
| + |
| +void ChromeNotificationDisplayService::Close( |
| + const std::string& notification_id) { |
| + ui_manager_->CancelById(notification_id, |
| + NotificationUIManager::GetProfileID(profile_)); |
| +} |
| + |
| +bool ChromeNotificationDisplayService::GetDisplayed( |
| + std::set<std::string>* notifications) const { |
| + DCHECK(notifications); |
| + for (auto notification_id : ui_manager_->GetAllIdsByProfile( |
| + NotificationUIManager::GetProfileID(profile_))) { |
| + notifications->insert(notification_id); |
| + } |
| + return true; |
| +} |
| + |
| +bool ChromeNotificationDisplayService::SupportsNotificationCenter() const { |
| + return false; |
| +} |