| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebServiceWorkerCacheStorage_h | 5 #include "public/platform/modules/serviceworker/WebServiceWorkerCacheStorage.h" |
| 6 #define WebServiceWorkerCacheStorage_h | |
| 7 | |
| 8 #include "WebCommon.h" | |
| 9 #include "public/platform/WebCallbacks.h" | |
| 10 #include "public/platform/WebServiceWorkerCache.h" | |
| 11 #include "public/platform/WebServiceWorkerCacheError.h" | |
| 12 #include "public/platform/WebString.h" | |
| 13 #include "public/platform/WebVector.h" | |
| 14 | |
| 15 namespace blink { | |
| 16 | |
| 17 class WebServiceWorkerCache; | |
| 18 | |
| 19 // An interface to the CacheStorage API, implemented by the embedder and passed
in to Blink. Blink's implementation | |
| 20 // of the ServiceWorker spec will call these methods to create/open caches, and
expect callbacks from the embedder | |
| 21 // after operations complete. | |
| 22 class WebServiceWorkerCacheStorage { | |
| 23 public: | |
| 24 typedef WebCallbacks<void, WebServiceWorkerCacheError*> CacheStorageCallback
s; | |
| 25 typedef WebCallbacks<WebServiceWorkerCache*, WebServiceWorkerCacheError*> Ca
cheStorageWithCacheCallbacks; | |
| 26 typedef WebCallbacks<WebVector<WebString>*, WebServiceWorkerCacheError*> Cac
heStorageKeysCallbacks; | |
| 27 typedef WebCallbacks<WebServiceWorkerResponse*, WebServiceWorkerCacheError*>
CacheStorageMatchCallbacks; | |
| 28 | |
| 29 virtual ~WebServiceWorkerCacheStorage() { } | |
| 30 | |
| 31 // Ownership of the CacheStorage*Callbacks methods passes to the WebServiceW
orkerCacheStorage instance, which | |
| 32 // will delete it after calling onSuccess or onFailure. | |
| 33 | |
| 34 // dispatchOpen() can return a WebServiceWorkerCache object. These | |
| 35 // objects are owned by Blink and should be destroyed when they are no | |
| 36 // longer needed. | |
| 37 virtual void dispatchHas(CacheStorageCallbacks*, const WebString& cacheName)
= 0; | |
| 38 virtual void dispatchOpen(CacheStorageWithCacheCallbacks*, const WebString&
cacheName) = 0; | |
| 39 virtual void dispatchDelete(CacheStorageCallbacks*, const WebString& cacheNa
me) = 0; | |
| 40 virtual void dispatchKeys(CacheStorageKeysCallbacks*) = 0; | |
| 41 virtual void dispatchMatch(CacheStorageMatchCallbacks*, const WebServiceWork
erRequest&, const WebServiceWorkerCache::QueryParams&) = 0; | |
| 42 }; | |
| 43 | |
| 44 } // namespace blink | |
| 45 | |
| 46 #endif // WebServiceWorkerCacheStorage_h | |
| OLD | NEW |