Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "content/common/content_export.h" | |
| 12 #include "content/public/common/persistent_notification_status.h" | |
| 13 | |
| 14 class GURL; | |
| 15 | |
| 16 namespace content { | |
| 17 | |
| 18 class BrowserContext; | |
| 19 struct ShowDesktopNotificationHostMsgParams; | |
| 20 | |
| 21 // This is the dispatcher to be used for firing events related to persistent | |
| 22 // notifications on a Service Worker. All methods in this interface must be | |
| 23 // called on the UI thread. | |
| 24 class CONTENT_EXPORT NotificationEventDispatcher { | |
|
Michael van Ouwerkerk
2014/12/08 15:13:43
Please document somewhere that this is expected to
Peter Beverloo
2014/12/08 17:27:08
Done.
| |
| 25 public: | |
| 26 CONTENT_EXPORT static NotificationEventDispatcher* GetInstance(); | |
| 27 | |
| 28 using NotificationClickDispatchCompleteCallback = | |
| 29 base::Callback<void(PersistentNotificationStatus)>; | |
| 30 | |
| 31 // Dispatches the "notificationclick" event on the Service Worker associated | |
| 32 // with |origin| and |service_worker_registration_id|. The |callback| will | |
| 33 // be invoked when it's known whether the event successfully executed. | |
| 34 virtual void DispatchNotificationClickEvent( | |
| 35 BrowserContext* browser_context, | |
| 36 const GURL& origin, | |
| 37 int64 service_worker_registration_id, | |
| 38 const std::string& notification_id, | |
| 39 const ShowDesktopNotificationHostMsgParams& notification_data, | |
| 40 const NotificationClickDispatchCompleteCallback& callback) = 0; | |
| 41 | |
| 42 protected: | |
| 43 virtual ~NotificationEventDispatcher() {} | |
| 44 }; | |
| 45 | |
| 46 } // namespace content | |
| 47 | |
| 48 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ | |
| OLD | NEW |