OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebServiceWorkerContextProxy_h | 31 #ifndef WebServiceWorkerContextProxy_h |
32 #define WebServiceWorkerContextProxy_h | 32 #define WebServiceWorkerContextProxy_h |
33 | 33 |
34 #include "public/platform/WebGeofencingEventType.h" | 34 #include "public/platform/WebGeofencingEventType.h" |
35 #include "public/platform/WebMessagePortChannel.h" | 35 #include "public/platform/WebMessagePortChannel.h" |
36 #include "public/platform/WebPassOwnPtr.h" | |
37 #include "public/platform/modules/serviceworker/WebServiceWorker.h" | 36 #include "public/platform/modules/serviceworker/WebServiceWorker.h" |
38 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" | 37 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" |
39 | 38 |
| 39 #include <memory> |
| 40 |
40 namespace blink { | 41 namespace blink { |
41 | 42 |
42 class WebServiceWorkerRequest; | 43 class WebServiceWorkerRequest; |
43 class WebString; | 44 class WebString; |
44 struct WebCircularGeofencingRegion; | 45 struct WebCircularGeofencingRegion; |
45 struct WebNotificationData; | 46 struct WebNotificationData; |
46 struct WebServiceWorkerClientInfo; | 47 struct WebServiceWorkerClientInfo; |
47 | 48 |
48 // A proxy interface to talk to the worker's GlobalScope implementation. | 49 // A proxy interface to talk to the worker's GlobalScope implementation. |
49 // All methods of this class must be called on the worker thread. | 50 // All methods of this class must be called on the worker thread. |
50 class WebServiceWorkerContextProxy { | 51 class WebServiceWorkerContextProxy { |
51 public: | 52 public: |
52 virtual ~WebServiceWorkerContextProxy() { } | 53 virtual ~WebServiceWorkerContextProxy() { } |
53 | 54 |
54 virtual void setRegistration(WebPassOwnPtr<WebServiceWorkerRegistration::Han
dle>) = 0; | 55 virtual void setRegistration(std::unique_ptr<WebServiceWorkerRegistration::H
andle>) = 0; |
55 | 56 |
56 virtual void dispatchActivateEvent(int eventID) = 0; | 57 virtual void dispatchActivateEvent(int eventID) = 0; |
57 virtual void dispatchExtendableMessageEvent(int eventID, const WebString& me
ssage, const WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&,
const WebServiceWorkerClientInfo&) = 0; | 58 virtual void dispatchExtendableMessageEvent(int eventID, const WebString& me
ssage, const WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&,
const WebServiceWorkerClientInfo&) = 0; |
58 virtual void dispatchExtendableMessageEvent(int eventID, const WebString& me
ssage, const WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&,
WebPassOwnPtr<WebServiceWorker::Handle>) = 0; | 59 virtual void dispatchExtendableMessageEvent(int eventID, const WebString& me
ssage, const WebSecurityOrigin& sourceOrigin, const WebMessagePortChannelArray&,
std::unique_ptr<WebServiceWorker::Handle>) = 0; |
59 virtual void dispatchInstallEvent(int eventID) = 0; | 60 virtual void dispatchInstallEvent(int eventID) = 0; |
60 virtual void dispatchFetchEvent(int eventID, const WebServiceWorkerRequest&
webRequest) = 0; | 61 virtual void dispatchFetchEvent(int eventID, const WebServiceWorkerRequest&
webRequest) = 0; |
61 virtual void dispatchForeignFetchEvent(int eventID, const WebServiceWorkerRe
quest& webRequest) = 0; | 62 virtual void dispatchForeignFetchEvent(int eventID, const WebServiceWorkerRe
quest& webRequest) = 0; |
62 virtual void dispatchGeofencingEvent(int eventID, WebGeofencingEventType, co
nst WebString& regionID, const WebCircularGeofencingRegion&) = 0; | 63 virtual void dispatchGeofencingEvent(int eventID, WebGeofencingEventType, co
nst WebString& regionID, const WebCircularGeofencingRegion&) = 0; |
63 | 64 |
64 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by | 65 // TODO(nhiroki): Remove this after ExtendableMessageEvent is enabled by |
65 // default (crbug.com/543198). | 66 // default (crbug.com/543198). |
66 virtual void dispatchMessageEvent(const WebString& message, const WebMessage
PortChannelArray&) = 0; | 67 virtual void dispatchMessageEvent(const WebString& message, const WebMessage
PortChannelArray&) = 0; |
67 | 68 |
68 virtual void dispatchNotificationClickEvent(int eventID, int64_t notificatio
nID, const WebNotificationData&, int actionIndex) = 0; | 69 virtual void dispatchNotificationClickEvent(int eventID, int64_t notificatio
nID, const WebNotificationData&, int actionIndex) = 0; |
69 virtual void dispatchNotificationCloseEvent(int eventID, int64_t notificatio
nID, const WebNotificationData&) = 0; | 70 virtual void dispatchNotificationCloseEvent(int eventID, int64_t notificatio
nID, const WebNotificationData&) = 0; |
70 virtual void dispatchPushEvent(int eventID, const WebString& data) = 0; | 71 virtual void dispatchPushEvent(int eventID, const WebString& data) = 0; |
71 | 72 |
72 enum LastChanceOption { | 73 enum LastChanceOption { |
73 IsNotLastChance, | 74 IsNotLastChance, |
74 IsLastChance | 75 IsLastChance |
75 }; | 76 }; |
76 | 77 |
77 // Once the ServiceWorker has finished handling the sync event, | 78 // Once the ServiceWorker has finished handling the sync event, |
78 // didHandleSyncEvent is called on the context client. | 79 // didHandleSyncEvent is called on the context client. |
79 virtual void dispatchSyncEvent(int syncEventID, const WebString& tag, LastCh
anceOption) = 0; | 80 virtual void dispatchSyncEvent(int syncEventID, const WebString& tag, LastCh
anceOption) = 0; |
80 }; | 81 }; |
81 | 82 |
82 } // namespace blink | 83 } // namespace blink |
83 | 84 |
84 #endif // WebServiceWorkerContextProxy_h | 85 #endif // WebServiceWorkerContextProxy_h |
OLD | NEW |