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

Unified Diff: content/public/browser/notification_event_dispatcher.h

Issue 728763003: Introduce a //content/ API for dispatching notificationclick events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « content/content_common.gypi ('k') | content/public/common/persistent_notification_status.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/notification_event_dispatcher.h
diff --git a/content/public/browser/notification_event_dispatcher.h b/content/public/browser/notification_event_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..38a7b441497a9a2c31c692243176fac48f360117
--- /dev/null
+++ b/content/public/browser/notification_event_dispatcher.h
@@ -0,0 +1,50 @@
+// Copyright 2014 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.
+
+#ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
+#define CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
+
+#include <string>
+
+#include "base/callback_forward.h"
+#include "content/common/content_export.h"
+#include "content/public/common/persistent_notification_status.h"
+
+class GURL;
+
+namespace content {
+
+class BrowserContext;
+struct ShowDesktopNotificationHostMsgParams;
+
+// This is the dispatcher to be used for firing events related to persistent
+// notifications on a Service Worker. This class is a singleton, the instance of
+// which can be retrieved using the static GetInstance() method. All methods
+// must be called on the UI thread.
+class CONTENT_EXPORT NotificationEventDispatcher {
+ public:
+ static NotificationEventDispatcher* GetInstance();
+
+ using NotificationClickDispatchCompleteCallback =
+ base::Callback<void(PersistentNotificationStatus)>;
+
+ // Dispatches the "notificationclick" event on the Service Worker associated
+ // with |origin| and |service_worker_registration_id|. The |callback| will
+ // be invoked when it's known whether the event successfully executed.
+ virtual void DispatchNotificationClickEvent(
+ BrowserContext* browser_context,
+ const GURL& origin,
+ int64 service_worker_registration_id,
+ const std::string& notification_id,
+ const ShowDesktopNotificationHostMsgParams& notification_data,
+ const NotificationClickDispatchCompleteCallback&
+ dispatch_complete_callback) = 0;
+
+ protected:
+ virtual ~NotificationEventDispatcher() {}
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
« no previous file with comments | « content/content_common.gypi ('k') | content/public/common/persistent_notification_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698