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> | |
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 { | |
jkarlin
2014/07/23 12:03:32
Please add 'CacheStorageErrorNoError' as the first
gavinp
2014/07/25 07:44:03
(your name still shows OOO from your vacation...)
| |
23 CacheStorageErrorNotImplemented, | |
24 CacheStorageErrorNotFound, | |
25 CacheStorageErrorExists, | |
26 CacheStorageErrorLast = CacheStorageErrorExists | |
jkarlin
2014/07/24 13:20:16
Please append CacheStorageErrorStorage to the enum
gavinp
2014/07/25 07:44:03
Tricky decision. I can see the argument; this fail
| |
27 }; | |
28 | |
29 typedef WebCallbacks<void, ErrorReason> CacheStorageCallbacks; | |
30 typedef WebCallbacks<int /* cacheID */, ErrorReason> CacheStorageWithCacheCa llbacks; | |
31 typedef WebCallbacks<WebVector<WebString>, ErrorReason> CacheStorageKeysCall backs; | |
32 | |
33 WebServiceWorkerCacheStorage() { } | |
34 virtual ~WebServiceWorkerCacheStorage() { } | |
35 | |
36 // Ownership of the CacheStorage*Callbacks methods passes to the WebServiceW orkerCacheStorage | |
37 // instance, which will delete it after calling onSuccess or onFailure. | |
38 virtual void dispatchCreate(CacheStorageWithCacheCallbacks*, const WebString & key) = 0; | |
39 virtual void dispatchRename(CacheStorageCallbacks*, const WebString& oldKey, const WebString& newKey) = 0; | |
40 virtual void dispatchGet(CacheStorageWithCacheCallbacks*, const WebString& k ey) = 0; | |
41 virtual void dispatchDelete(CacheStorageCallbacks*, const WebString& key) = 0; | |
42 virtual void dispatchKeys(CacheStorageKeysCallbacks*) = 0; | |
43 }; | |
44 | |
45 } // namespace blink | |
46 | |
47 #endif // WebServiceWorkerCacheStorage_h | |
OLD | NEW |