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

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

Issue 2392343002: Plumbing in notification replies: PlatformNotificationService -> SW (Closed)
Patch Set: include base/logging.h for NOTIMPLEMENTED 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 "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "content/public/common/persistent_notification_status.h" 12 #include "content/public/common/persistent_notification_status.h"
13 13
14 class GURL; 14 class GURL;
15 15
16 namespace base {
17 class NullableString16;
18 }
19
16 namespace content { 20 namespace content {
17 21
18 class BrowserContext; 22 class BrowserContext;
19 23
20 // This is the dispatcher to be used for firing events related to persistent 24 // 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 25 // 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 26 // which can be retrieved using the static GetInstance() method. All methods
23 // must be called on the UI thread. 27 // must be called on the UI thread.
24 class CONTENT_EXPORT NotificationEventDispatcher { 28 class CONTENT_EXPORT NotificationEventDispatcher {
25 public: 29 public:
26 static NotificationEventDispatcher* GetInstance(); 30 static NotificationEventDispatcher* GetInstance();
27 31
28 using NotificationDispatchCompleteCallback = 32 using NotificationDispatchCompleteCallback =
29 base::Callback<void(PersistentNotificationStatus)>; 33 base::Callback<void(PersistentNotificationStatus)>;
30 34
31 // Dispatches the "notificationclick" event on the Service Worker associated 35 // Dispatches the "notificationclick" event on the Service Worker associated
32 // with |notification_id| belonging to |origin|. The |callback| will be 36 // with |notification_id| belonging to |origin|. The |callback| will be
33 // invoked when it's known whether the event successfully executed. 37 // invoked when it's known whether the event successfully executed.
34 virtual void DispatchNotificationClickEvent( 38 virtual void DispatchNotificationClickEvent(
35 BrowserContext* browser_context, 39 BrowserContext* browser_context,
36 const std::string& notification_id, 40 const std::string& notification_id,
37 const GURL& origin, 41 const GURL& origin,
38 int action_index, 42 int action_index,
43 const base::NullableString16& reply,
39 const NotificationDispatchCompleteCallback& 44 const NotificationDispatchCompleteCallback&
40 dispatch_complete_callback) = 0; 45 dispatch_complete_callback) = 0;
41 46
42 // Dispatches the "notificationclose" event on the Service Worker associated 47 // Dispatches the "notificationclose" event on the Service Worker associated
43 // with |notification_id| belonging to |origin|. The 48 // with |notification_id| belonging to |origin|. The
44 // |dispatch_complete_callback| will be invoked when it's known whether the 49 // |dispatch_complete_callback| will be invoked when it's known whether the
45 // event successfully executed. 50 // event successfully executed.
46 virtual void DispatchNotificationCloseEvent( 51 virtual void DispatchNotificationCloseEvent(
47 BrowserContext* browser_context, 52 BrowserContext* browser_context,
48 const std::string& notification_id, 53 const std::string& notification_id,
49 const GURL& origin, 54 const GURL& origin,
50 bool by_user, 55 bool by_user,
51 const NotificationDispatchCompleteCallback& 56 const NotificationDispatchCompleteCallback&
52 dispatch_complete_callback) = 0; 57 dispatch_complete_callback) = 0;
53 58
54 protected: 59 protected:
55 virtual ~NotificationEventDispatcher() {} 60 virtual ~NotificationEventDispatcher() {}
56 }; 61 };
57 62
58 } // namespace content 63 } // namespace content
59 64
60 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ 65 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698