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

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: 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..2155b35a6310d5c22533493950868c42e08515c5
--- /dev/null
+++ b/chrome/browser/notifications/native_notification_display_service.cc
@@ -0,0 +1,54 @@
+// 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) {
Peter Beverloo 2016/04/18 14:57:09 micro nit: blank lines after namespace opening and
Miguel Garcia 2016/04/19 14:24:57 Done.
+#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) {}
+
+NativeNotificationDisplayService::~NativeNotificationDisplayService() {}
+
+void NativeNotificationDisplayService::Display(
+ const std::string& notification_id,
+ const Notification& notification) {
+ DCHECK(notification_bridge_);
Peter Beverloo 2016/04/18 14:57:09 nit: DCHECK in the constructor instead? That way w
Miguel Garcia 2016/04/19 14:24:57 Done.
+ notification_bridge_->Display(notification_id, GetProfileId(profile_),
+ profile_->IsOffTheRecord(), notification);
+}
+
+void NativeNotificationDisplayService::Close(
+ const std::string& notification_id) {
+ DCHECK(notification_bridge_);
+ notification_bridge_->Close(GetProfileId(profile_), notification_id);
+}
+
+bool NativeNotificationDisplayService::GetDisplayed(
+ std::set<std::string>* notifications) const {
+ DCHECK(notification_bridge_);
+ return notification_bridge_->GetDisplayed(
+ GetProfileId(profile_), profile_->IsOffTheRecord(), notifications);
+}
+
+bool NativeNotificationDisplayService::SupportsNotificationCenter() const {
+ DCHECK(notification_bridge_);
+ return notification_bridge_->SupportsNotificationCenter();
+}

Powered by Google App Engine
This is Rietveld 408576698