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 |