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/WebString.h" | |
11 #include "public/platform/WebVector.h" | |
12 #include <string> | |
13 #include <vector> | |
falken
2014/07/23 04:56:10
Seems <string> and <vector> aren't used?
gavinp
2014/07/25 07:44:02
Done.
| |
14 | |
15 namespace WebCore { class ServiceWorker; } | |
16 | |
17 namespace blink { | |
18 | |
19 // An interface to the CacheStorage API, implemented by the embedder and passed in to blink. | |
20 class WebServiceWorkerCacheStorage { | |
21 public: | |
22 enum ErrorReason { | |
23 CacheStorageErrorNotImplemented, | |
24 CacheStorageErrorNotFound, | |
25 CacheStorageErrorExists, | |
falken
2014/07/23 04:56:10
nit: enum values should be prefixed with the name
gavinp
2014/07/25 07:44:02
Done.
| |
26 }; | |
27 | |
28 typedef WebCallbacks<void, ErrorReason> CacheStorageCallbacks; | |
29 typedef WebCallbacks<int /* cacheID */, ErrorReason> CacheStorageCreateCallb acks; | |
30 typedef WebCallbacks<WebVector<WebString>, ErrorReason> CacheStorageKeysCall backs; | |
31 | |
32 WebServiceWorkerCacheStorage() { } | |
33 virtual ~WebServiceWorkerCacheStorage() { } | |
34 | |
35 // Ownership of the CacheStorage*Callbacks methods passes to the WebServiceW orkerCacheStorage | |
36 // instance, which will delete it after calling onSuccess or onFailure. | |
37 virtual void dispatchCreate(CacheStorageCreateCallbacks*, const WebString& k ey) = 0; | |
38 virtual void dispatchRename(CacheStorageCallbacks*, const WebString& oldKey, const WebString& newKey) = 0; | |
39 virtual void dispatchGet(CacheStorageCallbacks*, const WebString& key) = 0; | |
40 virtual void dispatchDelete(CacheStorageCallbacks*, const WebString& key) = 0; | |
41 virtual void dispatchKeys(CacheStorageKeysCallbacks*) = 0; | |
42 }; | |
43 | |
44 } // namespace blink | |
45 | |
46 #endif // WebServiceWorkerCacheStorage_h | |
OLD | NEW |