OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "webkit/appcache/appcache_service.h" | 13 #include "webkit/appcache/appcache_service.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 class ResourceContext; | 18 class ResourceContext; |
19 } | 19 } |
20 | 20 |
21 // This class fetches appcache information on behalf of a caller | 21 // This class fetches appcache information on behalf of a caller |
22 // on the UI thread. | 22 // on the UI thread. |
23 class BrowsingDataAppCacheHelper | 23 class BrowsingDataAppCacheHelper |
24 : public base::RefCountedThreadSafe<BrowsingDataAppCacheHelper> { | 24 : public base::RefCountedThreadSafe<BrowsingDataAppCacheHelper> { |
25 public: | 25 public: |
| 26 typedef std::map<GURL, appcache::AppCacheInfoVector> OriginAppCacheInfoMap; |
| 27 |
26 explicit BrowsingDataAppCacheHelper(Profile* profile); | 28 explicit BrowsingDataAppCacheHelper(Profile* profile); |
27 | 29 |
28 virtual void StartFetching(const base::Closure& completion_callback); | 30 virtual void StartFetching(const base::Closure& completion_callback); |
29 virtual void DeleteAppCacheGroup(const GURL& manifest_url); | 31 virtual void DeleteAppCacheGroup(const GURL& manifest_url); |
30 | 32 |
31 appcache::AppCacheInfoCollection* info_collection() const { | 33 appcache::AppCacheInfoCollection* info_collection() const { |
32 DCHECK(!is_fetching_); | 34 DCHECK(!is_fetching_); |
33 return info_collection_; | 35 return info_collection_; |
34 } | 36 } |
35 | 37 |
(...skipping 29 matching lines...) Expand all Loading... |
65 // Add an appcache to the set of canned caches that is returned by this | 67 // Add an appcache to the set of canned caches that is returned by this |
66 // helper. | 68 // helper. |
67 void AddAppCache(const GURL& manifest_url); | 69 void AddAppCache(const GURL& manifest_url); |
68 | 70 |
69 // Clears the list of canned caches. | 71 // Clears the list of canned caches. |
70 void Reset(); | 72 void Reset(); |
71 | 73 |
72 // True if no appcaches are currently stored. | 74 // True if no appcaches are currently stored. |
73 bool empty() const; | 75 bool empty() const; |
74 | 76 |
| 77 // Returns the number of app cache resources. |
| 78 size_t GetAppCacheCount() const; |
| 79 |
| 80 // Returns a current map with the |AppCacheInfoVector|s per origin. |
| 81 const OriginAppCacheInfoMap& GetOriginAppCacheInfoMap() const; |
| 82 |
75 // BrowsingDataAppCacheHelper methods. | 83 // BrowsingDataAppCacheHelper methods. |
76 virtual void StartFetching(const base::Closure& completion_callback) OVERRIDE; | 84 virtual void StartFetching(const base::Closure& completion_callback) OVERRIDE; |
77 | 85 |
78 private: | 86 private: |
79 virtual ~CannedBrowsingDataAppCacheHelper(); | 87 virtual ~CannedBrowsingDataAppCacheHelper(); |
80 | 88 |
81 Profile* profile_; | 89 Profile* profile_; |
82 | 90 |
83 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataAppCacheHelper); | 91 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataAppCacheHelper); |
84 }; | 92 }; |
85 | 93 |
86 #endif // CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ | 94 #endif // CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ |
OLD | NEW |