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

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

Issue 2916383004: Revert of Minimize the delegate dependencies for non persistent notifications. (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « content/browser/notifications/notification_message_filter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 14 matching lines...) Expand all
25 // 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
26 // which can be retrieved using the static GetInstance() method. All methods 26 // which can be retrieved using the static GetInstance() method. All methods
27 // must be called on the UI thread. 27 // must be called on the UI thread.
28 class CONTENT_EXPORT NotificationEventDispatcher { 28 class CONTENT_EXPORT NotificationEventDispatcher {
29 public: 29 public:
30 static NotificationEventDispatcher* GetInstance(); 30 static NotificationEventDispatcher* GetInstance();
31 31
32 using NotificationDispatchCompleteCallback = 32 using NotificationDispatchCompleteCallback =
33 base::Callback<void(PersistentNotificationStatus)>; 33 base::Callback<void(PersistentNotificationStatus)>;
34 34
35 // Dispatch methods for persistent (SW backed) notifications.
36 // TODO(miguelg) consider merging them with the non persistent ones below.
37
38 // Dispatches the "notificationclick" event on the Service Worker associated 35 // Dispatches the "notificationclick" event on the Service Worker associated
39 // with |notification_id| belonging to |origin|. The |callback| will be 36 // with |notification_id| belonging to |origin|. The |callback| will be
40 // invoked when it's known whether the event successfully executed. 37 // invoked when it's known whether the event successfully executed.
41 virtual void DispatchNotificationClickEvent( 38 virtual void DispatchNotificationClickEvent(
42 BrowserContext* browser_context, 39 BrowserContext* browser_context,
43 const std::string& notification_id, 40 const std::string& notification_id,
44 const GURL& origin, 41 const GURL& origin,
45 int action_index, 42 int action_index,
46 const base::NullableString16& reply, 43 const base::NullableString16& reply,
47 const NotificationDispatchCompleteCallback& 44 const NotificationDispatchCompleteCallback&
48 dispatch_complete_callback) = 0; 45 dispatch_complete_callback) = 0;
49 46
50 // Dispatches the "notificationclose" event on the Service Worker associated 47 // Dispatches the "notificationclose" event on the Service Worker associated
51 // with |notification_id| belonging to |origin|. The 48 // with |notification_id| belonging to |origin|. The
52 // |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
53 // event successfully executed. 50 // event successfully executed.
54 virtual void DispatchNotificationCloseEvent( 51 virtual void DispatchNotificationCloseEvent(
55 BrowserContext* browser_context, 52 BrowserContext* browser_context,
56 const std::string& notification_id, 53 const std::string& notification_id,
57 const GURL& origin, 54 const GURL& origin,
58 bool by_user, 55 bool by_user,
59 const NotificationDispatchCompleteCallback& 56 const NotificationDispatchCompleteCallback&
60 dispatch_complete_callback) = 0; 57 dispatch_complete_callback) = 0;
61 58
62 // Dispatch methods for the different non persistent (not backed by a service
63 // worker) notification events.
64 virtual void DispatchNonPersistentShowEvent(
65 const std::string& notification_id) = 0;
66 virtual void DispatchNonPersistentClickEvent(
67 const std::string& notification_id) = 0;
68 virtual void DispatchNonPersistentCloseEvent(
69 const std::string& notification_id) = 0;
70
71 protected: 59 protected:
72 virtual ~NotificationEventDispatcher() {} 60 virtual ~NotificationEventDispatcher() {}
73 }; 61 };
74 62
75 } // namespace content 63 } // namespace content
76 64
77 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_ 65 #endif // CONTENT_PUBLIC_BROWSER_NOTIFICATION_EVENT_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/browser/notifications/notification_message_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698