| 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 21 matching lines...) Expand all Loading... |
| 32 #define WebServiceWorkerContextProxy_h | 32 #define WebServiceWorkerContextProxy_h |
| 33 | 33 |
| 34 #include "public/platform/WebMessagePortChannel.h" | 34 #include "public/platform/WebMessagePortChannel.h" |
| 35 #include "public/platform/modules/serviceworker/WebServiceWorker.h" | 35 #include "public/platform/modules/serviceworker/WebServiceWorker.h" |
| 36 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" | 36 #include "public/platform/modules/serviceworker/WebServiceWorkerRegistration.h" |
| 37 | 37 |
| 38 #include <memory> | 38 #include <memory> |
| 39 | 39 |
| 40 namespace blink { | 40 namespace blink { |
| 41 | 41 |
| 42 class WebDataConsumerHandle; |
| 42 class WebServiceWorkerRequest; | 43 class WebServiceWorkerRequest; |
| 44 class WebServiceWorkerResponse; |
| 43 class WebString; | 45 class WebString; |
| 44 struct WebNotificationData; | 46 struct WebNotificationData; |
| 45 struct WebServiceWorkerClientInfo; | 47 struct WebServiceWorkerClientInfo; |
| 48 struct WebServiceWorkerError; |
| 46 | 49 |
| 47 // A proxy interface to talk to the worker's GlobalScope implementation. | 50 // A proxy interface to talk to the worker's GlobalScope implementation. |
| 48 // All methods of this class must be called on the worker thread. | 51 // All methods of this class must be called on the worker thread. |
| 49 class WebServiceWorkerContextProxy { | 52 class WebServiceWorkerContextProxy { |
| 50 public: | 53 public: |
| 51 virtual ~WebServiceWorkerContextProxy() {} | 54 virtual ~WebServiceWorkerContextProxy() {} |
| 52 | 55 |
| 53 virtual void setRegistration( | 56 virtual void setRegistration( |
| 54 std::unique_ptr<WebServiceWorkerRegistration::Handle>) = 0; | 57 std::unique_ptr<WebServiceWorkerRegistration::Handle>) = 0; |
| 55 | 58 |
| 56 virtual void dispatchActivateEvent(int eventID) = 0; | 59 virtual void dispatchActivateEvent(int eventID) = 0; |
| 57 virtual void dispatchExtendableMessageEvent( | 60 virtual void dispatchExtendableMessageEvent( |
| 58 int eventID, | 61 int eventID, |
| 59 const WebString& message, | 62 const WebString& message, |
| 60 const WebSecurityOrigin& sourceOrigin, | 63 const WebSecurityOrigin& sourceOrigin, |
| 61 const WebMessagePortChannelArray&, | 64 const WebMessagePortChannelArray&, |
| 62 const WebServiceWorkerClientInfo&) = 0; | 65 const WebServiceWorkerClientInfo&) = 0; |
| 63 virtual void dispatchExtendableMessageEvent( | 66 virtual void dispatchExtendableMessageEvent( |
| 64 int eventID, | 67 int eventID, |
| 65 const WebString& message, | 68 const WebString& message, |
| 66 const WebSecurityOrigin& sourceOrigin, | 69 const WebSecurityOrigin& sourceOrigin, |
| 67 const WebMessagePortChannelArray&, | 70 const WebMessagePortChannelArray&, |
| 68 std::unique_ptr<WebServiceWorker::Handle>) = 0; | 71 std::unique_ptr<WebServiceWorker::Handle>) = 0; |
| 69 virtual void dispatchInstallEvent(int eventID) = 0; | 72 virtual void dispatchInstallEvent(int eventID) = 0; |
| 70 virtual void dispatchFetchEvent( | 73 virtual void dispatchFetchEvent(int fetchEventID, |
| 71 int fetchEventID, | 74 const WebServiceWorkerRequest& webRequest, |
| 72 const WebServiceWorkerRequest& webRequest) = 0; | 75 bool navigationPreloadSent) = 0; |
| 73 virtual void dispatchForeignFetchEvent( | 76 virtual void dispatchForeignFetchEvent( |
| 74 int fetchEventID, | 77 int fetchEventID, |
| 75 const WebServiceWorkerRequest& webRequest) = 0; | 78 const WebServiceWorkerRequest& webRequest) = 0; |
| 76 virtual void dispatchNotificationClickEvent(int eventID, | 79 virtual void dispatchNotificationClickEvent(int eventID, |
| 77 const WebString& notificationID, | 80 const WebString& notificationID, |
| 78 const WebNotificationData&, | 81 const WebNotificationData&, |
| 79 int actionIndex, | 82 int actionIndex, |
| 80 const WebString& reply) = 0; | 83 const WebString& reply) = 0; |
| 81 virtual void dispatchNotificationCloseEvent(int eventID, | 84 virtual void dispatchNotificationCloseEvent(int eventID, |
| 82 const WebString& notificationID, | 85 const WebString& notificationID, |
| 83 const WebNotificationData&) = 0; | 86 const WebNotificationData&) = 0; |
| 84 virtual void dispatchPushEvent(int eventID, const WebString& data) = 0; | 87 virtual void dispatchPushEvent(int eventID, const WebString& data) = 0; |
| 85 | 88 |
| 86 virtual bool hasFetchEventHandler() = 0; | 89 virtual bool hasFetchEventHandler() = 0; |
| 87 | 90 |
| 88 enum LastChanceOption { IsNotLastChance, IsLastChance }; | 91 enum LastChanceOption { IsNotLastChance, IsLastChance }; |
| 89 | 92 |
| 90 // Once the ServiceWorker has finished handling the sync event, | 93 // Once the ServiceWorker has finished handling the sync event, |
| 91 // didHandleSyncEvent is called on the context client. | 94 // didHandleSyncEvent is called on the context client. |
| 92 virtual void dispatchSyncEvent(int syncEventID, | 95 virtual void dispatchSyncEvent(int syncEventID, |
| 93 const WebString& tag, | 96 const WebString& tag, |
| 94 LastChanceOption) = 0; | 97 LastChanceOption) = 0; |
| 98 |
| 99 virtual void onNavigationPreloadResponse( |
| 100 int fetchEventID, |
| 101 std::unique_ptr<WebServiceWorkerResponse>, |
| 102 std::unique_ptr<WebDataConsumerHandle>) = 0; |
| 103 virtual void onNavigationPreloadError( |
| 104 int fetchEventID, |
| 105 std::unique_ptr<WebServiceWorkerError>) = 0; |
| 95 }; | 106 }; |
| 96 | 107 |
| 97 } // namespace blink | 108 } // namespace blink |
| 98 | 109 |
| 99 #endif // WebServiceWorkerContextProxy_h | 110 #endif // WebServiceWorkerContextProxy_h |
| OLD | NEW |