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

Side by Side Diff: content/browser/notifications/notification_event_dispatcher_impl.h

Issue 1619703002: Implement notificationclose event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 11 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_BROWSER_NOTIFICATIONS_NOTIFICATION_EVENT_DISPATCHER_IMPL_H_ 5 #ifndef CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_EVENT_DISPATCHER_IMPL_H_
6 #define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_EVENT_DISPATCHER_IMPL_H_ 6 #define CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_EVENT_DISPATCHER_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/singleton.h" 11 #include "base/memory/singleton.h"
12 #include "content/public/browser/notification_database_data.h"
12 #include "content/public/browser/notification_event_dispatcher.h" 13 #include "content/public/browser/notification_event_dispatcher.h"
13 14
14 namespace content { 15 namespace content {
15 16
17 class PlatformNotificationContext;
18 class ServiceWorkerRegistration;
19
16 class NotificationEventDispatcherImpl : public NotificationEventDispatcher { 20 class NotificationEventDispatcherImpl : public NotificationEventDispatcher {
17 public: 21 public:
18 // Returns the instance of the NotificationEventDispatcherImpl. Must be called 22 // Returns the instance of the NotificationEventDispatcherImpl. Must be called
19 // on the UI thread. 23 // on the UI thread.
20 static NotificationEventDispatcherImpl* GetInstance(); 24 static NotificationEventDispatcherImpl* GetInstance();
21 25
26 using NotificationActionCallback =
27 base::Callback<void(const ServiceWorkerRegistration*,
28 const NotificationDatabaseData&)>;
29
30 using CurriedNotificationActionCallback =
31 base::Callback<void(scoped_refptr<PlatformNotificationContext>,
32 const ServiceWorkerRegistration*,
33 const NotificationDatabaseData&)>;
34
22 // NotificationEventDispatcher implementation. 35 // NotificationEventDispatcher implementation.
23 void DispatchNotificationClickEvent( 36 void DispatchNotificationClickEvent(
24 BrowserContext* browser_context, 37 BrowserContext* browser_context,
25 int64_t persistent_notification_id, 38 int64_t persistent_notification_id,
26 const GURL& origin, 39 const GURL& origin,
27 int action_index, 40 int action_index,
28 const NotificationClickDispatchCompleteCallback& 41 const NotificationDispatchCompleteCallback& dispatch_complete_callback)
29 dispatch_complete_callback) override; 42 override;
43 void DispatchNotificationCloseEvent(
44 BrowserContext* browser_context,
45 int64_t persistent_notification_id,
46 const GURL& origin,
47 const NotificationDispatchCompleteCallback& dispatch_complete_callback)
48 override;
30 49
31 private: 50 private:
32 NotificationEventDispatcherImpl(); 51 NotificationEventDispatcherImpl();
33 ~NotificationEventDispatcherImpl() override; 52 ~NotificationEventDispatcherImpl() override;
34 53
54 // Dispatches any notification event. The actual, specific event dispatch
55 // should be done by the |notification_action_callback|.
56 void DispatchNotificationEvent(
Peter Beverloo 2016/01/26 16:13:45 Is there a reason that we'd like to expose this in
Nina 2016/01/27 18:48:58 No reason - fixed.
57 BrowserContext* browser_context,
58 int64_t persistent_notification_id,
59 const GURL& origin,
60 const CurriedNotificationActionCallback& notification_action_callback,
61 const NotificationDispatchCompleteCallback& notification_error_callback);
62
35 friend struct base::DefaultSingletonTraits<NotificationEventDispatcherImpl>; 63 friend struct base::DefaultSingletonTraits<NotificationEventDispatcherImpl>;
36 64
37 DISALLOW_COPY_AND_ASSIGN(NotificationEventDispatcherImpl); 65 DISALLOW_COPY_AND_ASSIGN(NotificationEventDispatcherImpl);
38 }; 66 };
39 67
40 } // namespace content 68 } // namespace content
41 69
42 #endif // CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_EVENT_DISPATCHER_IMPL_H_ 70 #endif // CONTENT_BROWSER_NOTIFICATIONS_NOTIFICATION_EVENT_DISPATCHER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698