| 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 20 matching lines...) Expand all Loading... |
| 31 #ifndef WebServiceWorkerContextClient_h | 31 #ifndef WebServiceWorkerContextClient_h |
| 32 #define WebServiceWorkerContextClient_h | 32 #define WebServiceWorkerContextClient_h |
| 33 | 33 |
| 34 #include "public/platform/WebMessagePortChannel.h" | 34 #include "public/platform/WebMessagePortChannel.h" |
| 35 #include "public/platform/WebURL.h" | 35 #include "public/platform/WebURL.h" |
| 36 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsClaimCall
backs.h" | 36 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsClaimCall
backs.h" |
| 37 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" | 37 #include "public/platform/modules/serviceworker/WebServiceWorkerClientsInfo.h" |
| 38 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" | 38 #include "public/platform/modules/serviceworker/WebServiceWorkerEventResult.h" |
| 39 #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallb
acks.h" | 39 #include "public/platform/modules/serviceworker/WebServiceWorkerSkipWaitingCallb
acks.h" |
| 40 #include "public/web/WebDevToolsAgentClient.h" | 40 #include "public/web/WebDevToolsAgentClient.h" |
| 41 #include <memory> |
| 41 #include <v8.h> | 42 #include <v8.h> |
| 42 | 43 |
| 43 namespace blink { | 44 namespace blink { |
| 44 | 45 |
| 45 struct WebCrossOriginServiceWorkerClient; | 46 struct WebCrossOriginServiceWorkerClient; |
| 46 struct WebServiceWorkerClientQueryOptions; | 47 struct WebServiceWorkerClientQueryOptions; |
| 47 class WebDataSource; | 48 class WebDataSource; |
| 48 class WebServiceWorkerContextProxy; | 49 class WebServiceWorkerContextProxy; |
| 49 class WebServiceWorkerNetworkProvider; | 50 class WebServiceWorkerNetworkProvider; |
| 50 class WebServiceWorkerProvider; | 51 class WebServiceWorkerProvider; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // This is called on the main thread. | 201 // This is called on the main thread. |
| 201 virtual WebServiceWorkerProvider* createServiceWorkerProvider() { | 202 virtual WebServiceWorkerProvider* createServiceWorkerProvider() { |
| 202 return nullptr; | 203 return nullptr; |
| 203 } | 204 } |
| 204 | 205 |
| 205 // Ownership of the passed callbacks is transferred to the callee, callee | 206 // Ownership of the passed callbacks is transferred to the callee, callee |
| 206 // should delete the callbacks after calling either onSuccess or onError. | 207 // should delete the callbacks after calling either onSuccess or onError. |
| 207 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are | 208 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are |
| 208 // passed to the WebServiceWorkerClientCallbacks implementation. | 209 // passed to the WebServiceWorkerClientCallbacks implementation. |
| 209 virtual void getClient(const WebString&, | 210 virtual void getClient(const WebString&, |
| 210 WebServiceWorkerClientCallbacks*) = 0; | 211 std::unique_ptr<WebServiceWorkerClientCallbacks>) = 0; |
| 211 | 212 |
| 212 // Ownership of the passed callbacks is transferred to the callee, callee | 213 // Ownership of the passed callbacks is transferred to the callee, callee |
| 213 // should delete the callbacks after calling either onSuccess or onError. | 214 // should delete the callbacks after calling either onSuccess or onError. |
| 214 // WebServiceWorkerClientsInfo and WebServiceWorkerError ownerships are | 215 // WebServiceWorkerClientsInfo and WebServiceWorkerError ownerships are |
| 215 // passed to the WebServiceWorkerClientsCallbacks implementation. | 216 // passed to the WebServiceWorkerClientsCallbacks implementation. |
| 216 virtual void getClients(const WebServiceWorkerClientQueryOptions&, | 217 virtual void getClients( |
| 217 WebServiceWorkerClientsCallbacks*) = 0; | 218 const WebServiceWorkerClientQueryOptions&, |
| 219 std::unique_ptr<WebServiceWorkerClientsCallbacks>) = 0; |
| 218 | 220 |
| 219 // Ownership of the passed callbacks is transferred to the callee, callee | 221 // Ownership of the passed callbacks is transferred to the callee, callee |
| 220 // should delete the callbacks after calling either onSuccess or onError. | 222 // should delete the callbacks after calling either onSuccess or onError. |
| 221 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are | 223 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are |
| 222 // passed to the WebServiceWorkerClientsCallbacks implementation. | 224 // passed to the WebServiceWorkerClientsCallbacks implementation. |
| 223 virtual void openWindow(const WebURL&, WebServiceWorkerClientCallbacks*) = 0; | 225 virtual void openWindow(const WebURL&, |
| 226 std::unique_ptr<WebServiceWorkerClientCallbacks>) = 0; |
| 224 | 227 |
| 225 // A suggestion to cache this metadata in association with this URL. | 228 // A suggestion to cache this metadata in association with this URL. |
| 226 virtual void setCachedMetadata(const WebURL& url, | 229 virtual void setCachedMetadata(const WebURL& url, |
| 227 const char* data, | 230 const char* data, |
| 228 size_t size) {} | 231 size_t size) {} |
| 229 | 232 |
| 230 // A suggestion to clear the cached metadata in association with this URL. | 233 // A suggestion to clear the cached metadata in association with this URL. |
| 231 virtual void clearCachedMetadata(const WebURL& url) {} | 234 virtual void clearCachedMetadata(const WebURL& url) {} |
| 232 | 235 |
| 233 // Callee receives ownership of the passed vector. | 236 // Callee receives ownership of the passed vector. |
| 234 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/351753 | 237 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/351753 |
| 235 virtual void postMessageToClient(const WebString& uuid, | 238 virtual void postMessageToClient(const WebString& uuid, |
| 236 const WebString&, | 239 const WebString&, |
| 237 WebMessagePortChannelArray*) = 0; | 240 WebMessagePortChannelArray*) = 0; |
| 238 | 241 |
| 239 // Callee receives ownership of the passed vector. | 242 // Callee receives ownership of the passed vector. |
| 240 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/351753 | 243 // FIXME: Blob refs should be passed to maintain ref counts. crbug.com/351753 |
| 241 virtual void postMessageToCrossOriginClient( | 244 virtual void postMessageToCrossOriginClient( |
| 242 const WebCrossOriginServiceWorkerClient&, | 245 const WebCrossOriginServiceWorkerClient&, |
| 243 const WebString&, | 246 const WebString&, |
| 244 WebMessagePortChannelArray*) = 0; | 247 WebMessagePortChannelArray*) = 0; |
| 245 | 248 |
| 246 // Ownership of the passed callbacks is transferred to the callee, callee | 249 // Ownership of the passed callbacks is transferred to the callee, callee |
| 247 // should delete the callbacks after run. | 250 // should delete the callbacks after run. |
| 248 virtual void skipWaiting(WebServiceWorkerSkipWaitingCallbacks*) = 0; | 251 virtual void skipWaiting( |
| 252 std::unique_ptr<WebServiceWorkerSkipWaitingCallbacks>) = 0; |
| 249 | 253 |
| 250 // Ownership of the passed callbacks is transferred to the callee, callee | 254 // Ownership of the passed callbacks is transferred to the callee, callee |
| 251 // should delete the callbacks after run. | 255 // should delete the callbacks after run. |
| 252 virtual void claim(WebServiceWorkerClientsClaimCallbacks*) = 0; | 256 virtual void claim( |
| 257 std::unique_ptr<WebServiceWorkerClientsClaimCallbacks>) = 0; |
| 253 | 258 |
| 254 // Ownership of the passed callbacks is transferred to the callee, callee | 259 // Ownership of the passed callbacks is transferred to the callee, callee |
| 255 // should delete the callback after calling either onSuccess or onError. | 260 // should delete the callback after calling either onSuccess or onError. |
| 256 virtual void focus(const WebString& uuid, | 261 virtual void focus(const WebString& uuid, |
| 257 WebServiceWorkerClientCallbacks*) = 0; | 262 std::unique_ptr<WebServiceWorkerClientCallbacks>) = 0; |
| 258 | 263 |
| 259 // Ownership of the passed callbacks is transferred to the callee, callee | 264 // Ownership of the passed callbacks is transferred to the callee, callee |
| 260 // should delete the callbacks after calling either onSuccess or onError. | 265 // should delete the callbacks after calling either onSuccess or onError. |
| 261 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are | 266 // WebServiceWorkerClientInfo and WebServiceWorkerError ownerships are |
| 262 // passed to the WebServiceWorkerClientsCallbacks implementation. | 267 // passed to the WebServiceWorkerClientsCallbacks implementation. |
| 263 virtual void navigate(const WebString& uuid, | 268 virtual void navigate(const WebString& uuid, |
| 264 const WebURL&, | 269 const WebURL&, |
| 265 WebServiceWorkerClientCallbacks*) = 0; | 270 std::unique_ptr<WebServiceWorkerClientCallbacks>) = 0; |
| 266 | 271 |
| 267 // Called when the worker wants to register subscopes to handle via foreign | 272 // Called when the worker wants to register subscopes to handle via foreign |
| 268 // fetch. Will only be called while an install event is in progress. | 273 // fetch. Will only be called while an install event is in progress. |
| 269 virtual void registerForeignFetchScopes( | 274 virtual void registerForeignFetchScopes( |
| 270 const WebVector<WebURL>& subScopes, | 275 const WebVector<WebURL>& subScopes, |
| 271 const WebVector<WebSecurityOrigin>& origins) = 0; | 276 const WebVector<WebSecurityOrigin>& origins) = 0; |
| 272 }; | 277 }; |
| 273 | 278 |
| 274 } // namespace blink | 279 } // namespace blink |
| 275 | 280 |
| 276 #endif // WebServiceWorkerContextClient_h | 281 #endif // WebServiceWorkerContextClient_h |
| OLD | NEW |