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

Side by Side Diff: public/platform/modules/notifications/WebNotificationManager.h

Issue 1235673003: Revert of Remove 'blink::WebSerializedOrigin' (1/3) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 5 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 | « public/platform/WebSocketHandle.h ('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 WebNotificationManager_h 5 #ifndef WebNotificationManager_h
6 #define WebNotificationManager_h 6 #define WebNotificationManager_h
7 7
8 #include "public/platform/WebCallbacks.h" 8 #include "public/platform/WebCallbacks.h"
9 #include "public/platform/WebSerializedOrigin.h"
10 #include "public/platform/WebString.h" 9 #include "public/platform/WebString.h"
11 #include "public/platform/WebVector.h" 10 #include "public/platform/WebVector.h"
12 #include "public/platform/modules/notifications/WebNotificationData.h" 11 #include "public/platform/modules/notifications/WebNotificationData.h"
13 #include "public/platform/modules/notifications/WebNotificationPermission.h" 12 #include "public/platform/modules/notifications/WebNotificationPermission.h"
14 #include <stdint.h> 13 #include <stdint.h>
15 14
16 namespace blink { 15 namespace blink {
17 16
18 class WebNotificationDelegate; 17 class WebNotificationDelegate;
19 class WebSecurityOrigin; 18 class WebSerializedOrigin;
20 class WebServiceWorkerRegistration; 19 class WebServiceWorkerRegistration;
21 20
22 // Structure representing the info associated with a persistent notification. 21 // Structure representing the info associated with a persistent notification.
23 struct WebPersistentNotificationInfo { 22 struct WebPersistentNotificationInfo {
24 int64_t persistentId = 0; 23 int64_t persistentId = 0;
25 WebNotificationData data; 24 WebNotificationData data;
26 }; 25 };
27 26
28 using WebNotificationGetCallbacks = WebCallbacks<WebVector<WebPersistentNotifica tionInfo>, void>; 27 using WebNotificationGetCallbacks = WebCallbacks<WebVector<WebPersistentNotifica tionInfo>, void>;
29 using WebNotificationShowCallbacks = WebCallbacks<void, void>; 28 using WebNotificationShowCallbacks = WebCallbacks<void, void>;
30 29
31 // Provides the services to show platform notifications to the user. 30 // Provides the services to show platform notifications to the user.
32 class WebNotificationManager { 31 class WebNotificationManager {
33 public: 32 public:
34 virtual ~WebNotificationManager() { } 33 virtual ~WebNotificationManager() { }
35 34
36 // Shows a page notification on the user's system. These notifications will have their 35 // Shows a page notification on the user's system. These notifications will have their
37 // events delivered to the delegate specified in this call. 36 // events delivered to the delegate specified in this call.
38 // 37 virtual void show(const WebSerializedOrigin&, const WebNotificationData&, We bNotificationDelegate*) = 0;
39 // TODO(mkwst): Drop the WebSerializedOrigin version once Chromium is update d: https://crbug.com/508896
40 virtual void show(const WebSecurityOrigin& origin, const WebNotificationData & data, WebNotificationDelegate* delegate)
41 {
42 show(WebSerializedOrigin(origin), data, delegate);
43 }
44 virtual void show(const WebSerializedOrigin&, const WebNotificationData&, We bNotificationDelegate*) {}
45 38
46 // Shows a persistent notification on the user's system. These notifications will have 39 // Shows a persistent notification on the user's system. These notifications will have
47 // their events delivered to a Service Worker rather than the object's deleg ate. Will 40 // their events delivered to a Service Worker rather than the object's deleg ate. Will
48 // take ownership of the WebNotificationShowCallbacks object. 41 // take ownership of the WebNotificationShowCallbacks object.
49 // 42 virtual void showPersistent(const WebSerializedOrigin&, const WebNotificatio nData&, WebServiceWorkerRegistration*, WebNotificationShowCallbacks*) = 0;
50 // TODO(mkwst): Drop the WebSerializedOrigin version once Chromium is update d: https://crbug.com/508896
51 virtual void showPersistent(const WebSecurityOrigin& origin, const WebNotifi cationData& data, WebServiceWorkerRegistration* registration, WebNotificationSho wCallbacks* callbacks)
52 {
53 showPersistent(WebSerializedOrigin(origin), data, registration, callback s);
54 }
55 virtual void showPersistent(const WebSerializedOrigin&, const WebNotificatio nData&, WebServiceWorkerRegistration*, WebNotificationShowCallbacks*) {}
56 43
57 // Asynchronously gets the persistent notifications belonging to the Service Worker Registration. 44 // Asynchronously gets the persistent notifications belonging to the Service Worker Registration.
58 // If |filterTag| is not an empty string, only the notification with the giv en tag will be 45 // If |filterTag| is not an empty string, only the notification with the giv en tag will be
59 // considered. Will take ownership of the WebNotificationGetCallbacks object . 46 // considered. Will take ownership of the WebNotificationGetCallbacks object .
60 virtual void getNotifications(const WebString& filterTag, WebServiceWorkerRe gistration*, WebNotificationGetCallbacks*) = 0; 47 virtual void getNotifications(const WebString& filterTag, WebServiceWorkerRe gistration*, WebNotificationGetCallbacks*) = 0;
61 48
62 // Closes a notification previously shown, and removes it if being shown. 49 // Closes a notification previously shown, and removes it if being shown.
63 virtual void close(WebNotificationDelegate*) = 0; 50 virtual void close(WebNotificationDelegate*) = 0;
64 51
65 // Closes a persistent notification identified by its persistent notificatio n Id. 52 // Closes a persistent notification identified by its persistent notificatio n Id.
66 // 53 virtual void closePersistent(const WebSerializedOrigin&, int64_t persistentN otificationId) = 0;
67 // TODO(mkwst): Drop the WebSerializedOrigin version once Chromium is update d: https://crbug.com/508896
68 virtual void closePersistent(const WebSecurityOrigin& origin, int64_t persis tentNotificationId)
69 {
70 closePersistent(WebSerializedOrigin(origin), persistentNotificationId);
71 }
72 virtual void closePersistent(const WebSerializedOrigin&, int64_t persistentN otificationId) {}
73 54
74 // Indicates that the delegate object is being destroyed, and must no longer 55 // Indicates that the delegate object is being destroyed, and must no longer
75 // be used by the embedder to dispatch events. 56 // be used by the embedder to dispatch events.
76 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; 57 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0;
77 58
78 // Synchronously checks the permission level for the given origin. 59 // Synchronously checks the permission level for the given origin.
79 // 60 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin& ) = 0;
80 // TODO(mkwst): Drop the WebSerializedOrigin version once Chromium is update d: https://crbug.com/508896
81 virtual WebNotificationPermission checkPermission(const WebSecurityOrigin& o rigin)
82 {
83 return checkPermission(WebSerializedOrigin(origin));
84 }
85 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin& ) { return WebNotificationPermissionDenied; }
86 }; 61 };
87 62
88 } // namespace blink 63 } // namespace blink
89 64
90 #endif // WebNotificationManager_h 65 #endif // WebNotificationManager_h
OLDNEW
« no previous file with comments | « public/platform/WebSocketHandle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698