OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 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 WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_H_ | |
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_H_ | |
7 | |
8 #include <map> | |
9 #include <set> | |
10 | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "webkit/browser/webkit_storage_browser_export.h" | |
14 #include "webkit/common/appcache/appcache_interfaces.h" | |
15 | |
16 namespace appcache { | |
17 | |
18 class AppCacheStorage; | |
19 | |
20 // Refcounted container to avoid copying the collection in callbacks. | |
21 struct WEBKIT_STORAGE_BROWSER_EXPORT AppCacheInfoCollection | |
22 : public base::RefCountedThreadSafe<AppCacheInfoCollection> { | |
23 AppCacheInfoCollection(); | |
24 | |
25 std::map<GURL, AppCacheInfoVector> infos_by_origin; | |
26 | |
27 private: | |
28 friend class base::RefCountedThreadSafe<AppCacheInfoCollection>; | |
29 virtual ~AppCacheInfoCollection(); | |
30 }; | |
31 | |
32 // Class that manages the application cache service. Sends notifications | |
33 // to many frontends. One instance per user-profile. Each instance has | |
34 // exclusive access to its cache_directory on disk. | |
35 class WEBKIT_STORAGE_BROWSER_EXPORT AppCacheService { | |
36 public: | |
37 virtual ~AppCacheService() { } | |
38 | |
39 // Determines if a request for 'url' can be satisfied while offline. | |
40 // This method always completes asynchronously. | |
41 virtual void CanHandleMainResourceOffline(const GURL& url, | |
42 const GURL& first_party, | |
43 const net::CompletionCallback& | |
44 callback) = 0; | |
45 | |
46 // Populates 'collection' with info about all of the appcaches stored | |
47 // within the service, 'callback' is invoked upon completion. The service | |
48 // acquires a reference to the 'collection' until until completion. | |
49 // This method always completes asynchronously. | |
50 virtual void GetAllAppCacheInfo(AppCacheInfoCollection* collection, | |
51 const net::CompletionCallback& callback) = 0; | |
52 | |
53 // Deletes the group identified by 'manifest_url', 'callback' is | |
54 // invoked upon completion. Upon completion, the cache group and | |
55 // any resources within the group are no longer loadable and all | |
56 // subresource loads for pages associated with a deleted group | |
57 // will fail. This method always completes asynchronously. | |
58 virtual void DeleteAppCacheGroup(const GURL& manifest_url, | |
59 const net::CompletionCallback& callback) = 0; | |
60 }; | |
61 | |
62 } // namespace appcache | |
63 | |
64 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_H_ | |
OLD | NEW |