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

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

Issue 1240083002: Remove 'blink::WebSerializedOrigin' (2/4) (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"
9 #include "public/platform/WebString.h" 10 #include "public/platform/WebString.h"
10 #include "public/platform/WebVector.h" 11 #include "public/platform/WebVector.h"
11 #include "public/platform/modules/notifications/WebNotificationData.h" 12 #include "public/platform/modules/notifications/WebNotificationData.h"
12 #include "public/platform/modules/notifications/WebNotificationPermission.h" 13 #include "public/platform/modules/notifications/WebNotificationPermission.h"
13 #include <stdint.h> 14 #include <stdint.h>
14 15
15 namespace blink { 16 namespace blink {
16 17
17 class WebNotificationDelegate; 18 class WebNotificationDelegate;
18 class WebSerializedOrigin; 19 class WebSecurityOrigin;
19 class WebServiceWorkerRegistration; 20 class WebServiceWorkerRegistration;
20 21
21 // Structure representing the info associated with a persistent notification. 22 // Structure representing the info associated with a persistent notification.
22 struct WebPersistentNotificationInfo { 23 struct WebPersistentNotificationInfo {
23 int64_t persistentId = 0; 24 int64_t persistentId = 0;
24 WebNotificationData data; 25 WebNotificationData data;
25 }; 26 };
26 27
27 using WebNotificationGetCallbacks = WebCallbacks<WebVector<WebPersistentNotifica tionInfo>, void>; 28 using WebNotificationGetCallbacks = WebCallbacks<WebVector<WebPersistentNotifica tionInfo>, void>;
28 using WebNotificationShowCallbacks = WebCallbacks<void, void>; 29 using WebNotificationShowCallbacks = WebCallbacks<void, void>;
29 30
30 // Provides the services to show platform notifications to the user. 31 // Provides the services to show platform notifications to the user.
31 class WebNotificationManager { 32 class WebNotificationManager {
32 public: 33 public:
33 virtual ~WebNotificationManager() { } 34 virtual ~WebNotificationManager() { }
34 35
35 // Shows a page notification on the user's system. These notifications will have their 36 // Shows a page notification on the user's system. These notifications will have their
36 // events delivered to the delegate specified in this call. 37 // events delivered to the delegate specified in this call.
37 virtual void show(const WebSerializedOrigin&, const WebNotificationData&, We bNotificationDelegate*) = 0; 38 //
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*) {}
38 45
39 // Shows a persistent notification on the user's system. These notifications will have 46 // Shows a persistent notification on the user's system. These notifications will have
40 // their events delivered to a Service Worker rather than the object's deleg ate. Will 47 // their events delivered to a Service Worker rather than the object's deleg ate. Will
41 // take ownership of the WebNotificationShowCallbacks object. 48 // take ownership of the WebNotificationShowCallbacks object.
42 virtual void showPersistent(const WebSerializedOrigin&, const WebNotificatio nData&, WebServiceWorkerRegistration*, WebNotificationShowCallbacks*) = 0; 49 //
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*) {}
43 56
44 // Asynchronously gets the persistent notifications belonging to the Service Worker Registration. 57 // Asynchronously gets the persistent notifications belonging to the Service Worker Registration.
45 // If |filterTag| is not an empty string, only the notification with the giv en tag will be 58 // If |filterTag| is not an empty string, only the notification with the giv en tag will be
46 // considered. Will take ownership of the WebNotificationGetCallbacks object . 59 // considered. Will take ownership of the WebNotificationGetCallbacks object .
47 virtual void getNotifications(const WebString& filterTag, WebServiceWorkerRe gistration*, WebNotificationGetCallbacks*) = 0; 60 virtual void getNotifications(const WebString& filterTag, WebServiceWorkerRe gistration*, WebNotificationGetCallbacks*) = 0;
48 61
49 // Closes a notification previously shown, and removes it if being shown. 62 // Closes a notification previously shown, and removes it if being shown.
50 virtual void close(WebNotificationDelegate*) = 0; 63 virtual void close(WebNotificationDelegate*) = 0;
51 64
52 // Closes a persistent notification identified by its persistent notificatio n Id. 65 // Closes a persistent notification identified by its persistent notificatio n Id.
53 virtual void closePersistent(const WebSerializedOrigin&, int64_t persistentN otificationId) = 0; 66 //
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) {}
54 73
55 // Indicates that the delegate object is being destroyed, and must no longer 74 // Indicates that the delegate object is being destroyed, and must no longer
56 // be used by the embedder to dispatch events. 75 // be used by the embedder to dispatch events.
57 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0; 76 virtual void notifyDelegateDestroyed(WebNotificationDelegate*) = 0;
58 77
59 // Synchronously checks the permission level for the given origin. 78 // Synchronously checks the permission level for the given origin.
60 virtual WebNotificationPermission checkPermission(const WebSerializedOrigin& ) = 0; 79 //
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; }
61 }; 86 };
62 87
63 } // namespace blink 88 } // namespace blink
64 89
65 #endif // WebNotificationManager_h 90 #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