Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Unified Diff: chrome/browser/notifications/message_center_display_service.cc

Issue 1814923002: Nuke NotificationUIManager from PlatformNotificationServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profile_manager_load
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/message_center_display_service.cc
diff --git a/chrome/browser/notifications/message_center_display_service.cc b/chrome/browser/notifications/message_center_display_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8dc7420cafe2b9fdc9811c8ff68980b7a12b6de2
--- /dev/null
+++ b/chrome/browser/notifications/message_center_display_service.cc
@@ -0,0 +1,40 @@
+// 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/message_center_display_service.h"
+
+#include "chrome/browser/notifications/notification.h"
+#include "chrome/browser/notifications/notification_ui_manager.h"
+#include "chrome/browser/profiles/profile.h"
+
+MessageCenterDisplayService::MessageCenterDisplayService(
+ Profile* profile,
+ NotificationUIManager* ui_manager)
+ : profile_(profile), ui_manager_(ui_manager) {}
+
+MessageCenterDisplayService::~MessageCenterDisplayService() {}
+
+void MessageCenterDisplayService::Display(const std::string& notification_id,
+ const Notification& notification) {
+ ui_manager_->Add(notification, profile_);
+}
+
+void MessageCenterDisplayService::Close(const std::string& notification_id) {
+ ui_manager_->CancelById(notification_id,
+ NotificationUIManager::GetProfileID(profile_));
+}
+
+bool MessageCenterDisplayService::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 MessageCenterDisplayService::SupportsNotificationCenter() const {
+ return false;
+}

Powered by Google App Engine
This is Rietveld 408576698