When enabling new profile management programmatically, make sure to set the
[chromium-blink-merge.git] / webkit / browser / appcache / appcache_service.h
blobdc6e33b4308ef35b70a7f784128782788201cddc
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.
5 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_H_
6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_H_
8 #include <map>
9 #include <set>
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"
16 namespace appcache {
18 class AppCacheStorage;
20 // Refcounted container to avoid copying the collection in callbacks.
21 struct WEBKIT_STORAGE_BROWSER_EXPORT AppCacheInfoCollection
22 : public base::RefCountedThreadSafe<AppCacheInfoCollection> {
23 AppCacheInfoCollection();
25 std::map<GURL, AppCacheInfoVector> infos_by_origin;
27 private:
28 friend class base::RefCountedThreadSafe<AppCacheInfoCollection>;
29 virtual ~AppCacheInfoCollection();
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() { }
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;
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;
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;
62 } // namespace appcache
64 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_SERVICE_H_