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

Side by Side Diff: content/public/browser/notification_event_dispatcher.h

Issue 2392343002: Plumbing in notification replies: PlatformNotificationService -> SW (Closed)
Patch Set: Remove todo as it doesn't seem necessary after all Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
6 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ 6 #define CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
11 #include "base/strings/nullable_string16.h"
11 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
12 #include "content/public/common/persistent_notification_status.h" 13 #include "content/public/common/persistent_notification_status.h"
13 14
14 class GURL; 15 class GURL;
15 16
16 namespace content { 17 namespace content {
17 18
18 class BrowserContext; 19 class BrowserContext;
19 20
20 // This is the dispatcher to be used for firing events related to persistent 21 // This is the dispatcher to be used for firing events related to persistent
21 // notifications on a Service Worker. This class is a singleton, the instance of 22 // notifications on a Service Worker. This class is a singleton, the instance of
22 // which can be retrieved using the static GetInstance() method. All methods 23 // which can be retrieved using the static GetInstance() method. All methods
23 // must be called on the UI thread. 24 // must be called on the UI thread.
24 class CONTENT_EXPORT NotificationEventDispatcher { 25 class CONTENT_EXPORT NotificationEventDispatcher {
25 public: 26 public:
26 static NotificationEventDispatcher* GetInstance(); 27 static NotificationEventDispatcher* GetInstance();
27 28
28 using NotificationDispatchCompleteCallback = 29 using NotificationDispatchCompleteCallback =
29 base::Callback<void(PersistentNotificationStatus)>; 30 base::Callback<void(PersistentNotificationStatus)>;
30 31
31 // Dispatches the "notificationclick" event on the Service Worker associated 32 // Dispatches the "notificationclick" event on the Service Worker associated
32 // with |notification_id| belonging to |origin|. The |callback| will be 33 // with |notification_id| belonging to |origin|. The |callback| will be
33 // invoked when it's known whether the event successfully executed. 34 // invoked when it's known whether the event successfully executed.
34 virtual void DispatchNotificationClickEvent( 35 virtual void DispatchNotificationClickEvent(
35 BrowserContext* browser_context, 36 BrowserContext* browser_context,
36 const std::string& notification_id, 37 const std::string& notification_id,
37 const GURL& origin, 38 const GURL& origin,
38 int action_index, 39 int action_index,
40 const base::NullableString16& reply,
39 const NotificationDispatchCompleteCallback& 41 const NotificationDispatchCompleteCallback&
40 dispatch_complete_callback) = 0; 42 dispatch_complete_callback) = 0;
41 43
42 // Dispatches the "notificationclose" event on the Service Worker associated 44 // Dispatches the "notificationclose" event on the Service Worker associated
43 // with |notification_id| belonging to |origin|. The 45 // with |notification_id| belonging to |origin|. The
44 // |dispatch_complete_callback| will be invoked when it's known whether the 46 // |dispatch_complete_callback| will be invoked when it's known whether the
45 // event successfully executed. 47 // event successfully executed.
46 virtual void DispatchNotificationCloseEvent( 48 virtual void DispatchNotificationCloseEvent(
47 BrowserContext* browser_context, 49 BrowserContext* browser_context,
48 const std::string& notification_id, 50 const std::string& notification_id,
49 const GURL& origin, 51 const GURL& origin,
50 bool by_user, 52 bool by_user,
51 const NotificationDispatchCompleteCallback& 53 const NotificationDispatchCompleteCallback&
52 dispatch_complete_callback) = 0; 54 dispatch_complete_callback) = 0;
53 55
54 protected: 56 protected:
55 virtual ~NotificationEventDispatcher() {} 57 virtual ~NotificationEventDispatcher() {}
56 }; 58 };
57 59
58 } // namespace content 60 } // namespace content
59 61
60 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ 62 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698