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

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

Issue 1814923002: Nuke NotificationUIManager from PlatformNotificationServiceImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@profile_manager_load
Patch Set: Review comments + unique_ptr rename 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/native_notification_display_service.cc
diff --git a/chrome/browser/notifications/native_notification_display_service.cc b/chrome/browser/notifications/native_notification_display_service.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2c08e19320a7338b85d35c79db053632e7257caa
--- /dev/null
+++ b/chrome/browser/notifications/native_notification_display_service.cc
@@ -0,0 +1,55 @@
+// 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/native_notification_display_service.h"
+
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/notifications/notification_bridge.h"
+#include "chrome/browser/profiles/profile.h"
+
+namespace {
+
+std::string GetProfileId(Profile* profile) {
+#if defined(OS_WIN)
+ std::string profile_id =
+ base::WideToUTF8(profile->GetPath().BaseName().value());
+#elif defined(OS_POSIX)
+ std::string profile_id = profile->GetPath().BaseName().value();
+#endif
+ return profile_id;
+}
+
+} // namespace
+
+NativeNotificationDisplayService::NativeNotificationDisplayService(
+ Profile* profile,
+ NotificationBridge* notification_bridge)
+ : profile_(profile), notification_bridge_(notification_bridge) {
+ DCHECK(profile_);
+ DCHECK(notification_bridge_);
+}
+
+NativeNotificationDisplayService::~NativeNotificationDisplayService() {}
+
+void NativeNotificationDisplayService::Display(
+ const std::string& notification_id,
+ const Notification& notification) {
+ notification_bridge_->Display(notification_id, GetProfileId(profile_),
+ profile_->IsOffTheRecord(), notification);
+}
+
+void NativeNotificationDisplayService::Close(
+ const std::string& notification_id) {
+ notification_bridge_->Close(GetProfileId(profile_), notification_id);
+}
+
+bool NativeNotificationDisplayService::GetDisplayed(
+ std::set<std::string>* notifications) const {
+ return notification_bridge_->GetDisplayed(
+ GetProfileId(profile_), profile_->IsOffTheRecord(), notifications);
+}
+
+bool NativeNotificationDisplayService::SupportsNotificationCenter() const {
+ return notification_bridge_->SupportsNotificationCenter();
+}

Powered by Google App Engine
This is Rietveld 408576698