OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 13 matching lines...) Expand all Loading... |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
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 ServiceWorkerGlobalScopeClient_h | 31 #ifndef ServiceWorkerGlobalScopeClient_h |
32 #define ServiceWorkerGlobalScopeClient_h | 32 #define ServiceWorkerGlobalScopeClient_h |
33 | 33 |
| 34 #include "core/dom/MessagePort.h" |
34 #include "core/workers/WorkerClients.h" | 35 #include "core/workers/WorkerClients.h" |
35 #include "public/platform/WebCallbacks.h" | 36 #include "public/platform/WebCallbacks.h" |
| 37 #include "public/platform/WebMessagePortChannel.h" |
36 #include "public/platform/WebServiceWorkerClientsInfo.h" | 38 #include "public/platform/WebServiceWorkerClientsInfo.h" |
37 #include "public/platform/WebServiceWorkerEventResult.h" | 39 #include "public/platform/WebServiceWorkerEventResult.h" |
38 #include "wtf/Forward.h" | 40 #include "wtf/Forward.h" |
39 #include "wtf/Noncopyable.h" | 41 #include "wtf/Noncopyable.h" |
40 | 42 |
41 namespace blink { | 43 namespace blink { |
42 class WebURL; | 44 class WebURL; |
43 }; | 45 }; |
44 | 46 |
45 namespace WebCore { | 47 namespace WebCore { |
46 | 48 |
47 class ExecutionContext; | 49 class ExecutionContext; |
48 class Response; | 50 class Response; |
49 class WorkerClients; | 51 class WorkerClients; |
50 | 52 |
51 class ServiceWorkerGlobalScopeClient : public WillBeHeapSupplement<WorkerClients
> { | 53 class ServiceWorkerGlobalScopeClient : public WillBeHeapSupplement<WorkerClients
> { |
52 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeClient); | 54 WTF_MAKE_NONCOPYABLE(ServiceWorkerGlobalScopeClient); |
53 public: | 55 public: |
54 virtual ~ServiceWorkerGlobalScopeClient() { } | 56 virtual ~ServiceWorkerGlobalScopeClient() { } |
55 | 57 |
56 virtual void getClients(blink::WebServiceWorkerClientsCallbacks*) = 0; | 58 virtual void getClients(blink::WebServiceWorkerClientsCallbacks*) = 0; |
57 virtual blink::WebURL scope() const = 0; | 59 virtual blink::WebURL scope() const = 0; |
58 | 60 |
59 virtual void didHandleActivateEvent(int eventID, blink::WebServiceWorkerEven
tResult) = 0; | 61 virtual void didHandleActivateEvent(int eventID, blink::WebServiceWorkerEven
tResult) = 0; |
60 virtual void didHandleInstallEvent(int installEventID, blink::WebServiceWork
erEventResult) = 0; | 62 virtual void didHandleInstallEvent(int installEventID, blink::WebServiceWork
erEventResult) = 0; |
61 // A null response means no valid response was provided by the service worke
r, so fallback to native. | 63 // A null response means no valid response was provided by the service worke
r, so fallback to native. |
62 virtual void didHandleFetchEvent(int fetchEventID, PassRefPtr<Response> = nu
llptr) = 0; | 64 virtual void didHandleFetchEvent(int fetchEventID, PassRefPtr<Response> = nu
llptr) = 0; |
63 virtual void didHandleSyncEvent(int syncEventID) = 0; | 65 virtual void didHandleSyncEvent(int syncEventID) = 0; |
| 66 virtual void postMessageToClient(int clientID, const blink::WebString& messa
ge, PassOwnPtr<blink::WebMessagePortChannelArray>) = 0; |
64 | 67 |
65 static const char* supplementName(); | 68 static const char* supplementName(); |
66 static ServiceWorkerGlobalScopeClient* from(ExecutionContext*); | 69 static ServiceWorkerGlobalScopeClient* from(ExecutionContext*); |
67 | 70 |
68 protected: | 71 protected: |
69 ServiceWorkerGlobalScopeClient() { } | 72 ServiceWorkerGlobalScopeClient() { } |
70 }; | 73 }; |
71 | 74 |
72 void provideServiceWorkerGlobalScopeClientToWorker(WorkerClients*, PassOwnPtrWil
lBeRawPtr<ServiceWorkerGlobalScopeClient>); | 75 void provideServiceWorkerGlobalScopeClientToWorker(WorkerClients*, PassOwnPtrWil
lBeRawPtr<ServiceWorkerGlobalScopeClient>); |
73 | 76 |
74 } // namespace WebCore | 77 } // namespace WebCore |
75 | 78 |
76 #endif // ServiceWorkerGlobalScopeClient_h | 79 #endif // ServiceWorkerGlobalScopeClient_h |
OLD | NEW |