OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebServiceWorkerCacheStorage_h |
| 6 #define WebServiceWorkerCacheStorage_h |
| 7 |
| 8 #include "WebCommon.h" |
| 9 #include "public/platform/WebCallbacks.h" |
| 10 #include "public/platform/WebServiceWorkerCacheStorageError.h" |
| 11 #include "public/platform/WebString.h" |
| 12 #include "public/platform/WebVector.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 // An interface to the CacheStorage API, implemented by the embedder and passed
in to blink. Blink's implementation |
| 17 // of the ServiceWorker spec will call these methods to create/open caches, and
expect callbacks from the embedder |
| 18 // after operations complete. |
| 19 class WebServiceWorkerCacheStorage { |
| 20 public: |
| 21 |
| 22 typedef WebCallbacks<void, WebServiceWorkerCacheStorageError> CacheStorageCa
llbacks; |
| 23 typedef WebCallbacks<int /* cacheID */, WebServiceWorkerCacheStorageError> C
acheStorageWithCacheCallbacks; |
| 24 typedef WebCallbacks<WebVector<WebString>, WebServiceWorkerCacheStorageError
> CacheStorageKeysCallbacks; |
| 25 |
| 26 WebServiceWorkerCacheStorage() { } |
| 27 virtual ~WebServiceWorkerCacheStorage() { } |
| 28 |
| 29 // Ownership of the CacheStorage*Callbacks methods passes to the WebServiceW
orkerCacheStorage |
| 30 // instance, which will delete it after calling onSuccess or onFailure. |
| 31 virtual void dispatchCreate(CacheStorageWithCacheCallbacks*, const WebString
& key) = 0; |
| 32 virtual void dispatchRename(CacheStorageCallbacks*, const WebString& oldKey,
const WebString& newKey) = 0; |
| 33 virtual void dispatchGet(CacheStorageWithCacheCallbacks*, const WebString& k
ey) = 0; |
| 34 virtual void dispatchDelete(CacheStorageCallbacks*, const WebString& key) =
0; |
| 35 virtual void dispatchKeys(CacheStorageKeysCallbacks*) = 0; |
| 36 }; |
| 37 |
| 38 } // namespace blink |
| 39 |
| 40 #endif // WebServiceWorkerCacheStorage_h |
OLD | NEW |