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

Unified Diff: content/browser/notifications/persistent_notification_delegate.cc

Issue 1116693002: [NOT FOR REVIEW] Significantly simplify the PlatformNotificationService //content API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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: content/browser/notifications/persistent_notification_delegate.cc
diff --git a/content/browser/notifications/persistent_notification_delegate.cc b/content/browser/notifications/persistent_notification_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6bd945f9dcc64de10d7cb8ae69597b839793e62f
--- /dev/null
+++ b/content/browser/notifications/persistent_notification_delegate.cc
@@ -0,0 +1,51 @@
+// Copyright 2015 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 "content/browser/notifications/persistent_notification_delegate.h"
+
+#include "base/bind.h"
+#include "content/public/browser/notification_event_dispatcher.h"
+
+namespace content {
+namespace {
+
+// Persistent notifications fired through the delegate do not care about the
+// lifetime of the Service Worker responsible for executing the event.
+void OnEventDispatchComplete(content::PersistentNotificationStatus status) {
+ // TODO(peter): Record UMA statistics about the result status of running
+ // events for persistent Web Notifications.
+}
+
+} // namespace
+
+PersistentNotificationDelegate::PersistentNotificationDelegate(
+ BrowserContext* browser_context,
+ const GURL& origin,
+ int64_t persistent_notification_id)
+ : browser_context_(browser_context),
+ origin_(origin),
+ persistent_notification_id_(persistent_notification_id) {
+}
+
+PersistentNotificationDelegate::~PersistentNotificationDelegate() {
+}
+
+void PersistentNotificationDelegate::Close(bool by_user) {
+ // TODO(peter): Implement this method after the following CL lands:
+ // https://codereview.chromium.org/1071773003/
+}
+
+bool PersistentNotificationDelegate::HasClickedListener() {
+ return true;
+}
+
+void PersistentNotificationDelegate::Click() {
+ NotificationEventDispatcher::GetInstance()
+ ->DispatchNotificationClickEvent(browser_context_,
+ persistent_notification_id_,
+ origin_,
+ base::Bind(&OnEventDispatchComplete));
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698