Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / appcache_service.h
blob67d1ca6702ec35b69d6ba54fcb5e840f1d9eee7d
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 CONTENT_PUBLIC_BROWSER_APPCACHE_SERVICE_H_
6 #define CONTENT_PUBLIC_BROWSER_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 "content/common/content_export.h"
14 #include "content/public/common/appcache_info.h"
15 #include "net/base/completion_callback.h"
17 namespace content {
19 class AppCacheStorage;
21 // Refcounted container to avoid copying the collection in callbacks.
22 struct CONTENT_EXPORT AppCacheInfoCollection
23 : public base::RefCountedThreadSafe<AppCacheInfoCollection> {
24 AppCacheInfoCollection();
26 std::map<GURL, AppCacheInfoVector> infos_by_origin;
28 private:
29 friend class base::RefCountedThreadSafe<AppCacheInfoCollection>;
30 virtual ~AppCacheInfoCollection();
33 // Exposes a limited interface to the AppCacheService.
34 // Call these methods only on the IO thread.
35 class CONTENT_EXPORT AppCacheService {
36 public:
37 // Determines if a request for 'url' can be satisfied while offline.
38 // This method always completes asynchronously.
39 virtual void CanHandleMainResourceOffline(const GURL& url,
40 const GURL& first_party,
41 const net::CompletionCallback&
42 callback) = 0;
44 // Populates 'collection' with info about all of the appcaches stored
45 // within the service, 'callback' is invoked upon completion. The service
46 // acquires a reference to the 'collection' until completion.
47 // This method always completes asynchronously.
48 virtual void GetAllAppCacheInfo(AppCacheInfoCollection* collection,
49 const net::CompletionCallback& callback) = 0;
51 // Deletes the group identified by 'manifest_url', 'callback' is
52 // invoked upon completion. Upon completion, the cache group and
53 // any resources within the group are no longer loadable and all
54 // subresource loads for pages associated with a deleted group
55 // will fail. This method always completes asynchronously.
56 virtual void DeleteAppCacheGroup(const GURL& manifest_url,
57 const net::CompletionCallback& callback) = 0;
59 protected:
60 virtual ~AppCacheService() {}
63 } // namespace content
65 #endif // CONTENT_PUBLIC_BROWSER_APPCACHE_SERVICE_H_