OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/appcache/chrome_appcache_service.h" | |
12 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
13 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "webkit/appcache/appcache_service.h" |
14 | 14 |
15 class Profile; | 15 class Profile; |
16 | 16 |
| 17 namespace content { |
| 18 class ResourceContext; |
| 19 } |
| 20 |
17 // This class fetches appcache information on behalf of a caller | 21 // This class fetches appcache information on behalf of a caller |
18 // on the UI thread. | 22 // on the UI thread. |
19 class BrowsingDataAppCacheHelper | 23 class BrowsingDataAppCacheHelper |
20 : public base::RefCountedThreadSafe<BrowsingDataAppCacheHelper> { | 24 : public base::RefCountedThreadSafe<BrowsingDataAppCacheHelper> { |
21 public: | 25 public: |
22 explicit BrowsingDataAppCacheHelper(Profile* profile); | 26 explicit BrowsingDataAppCacheHelper(Profile* profile); |
23 | 27 |
24 virtual void StartFetching(const base::Closure& completion_callback); | 28 virtual void StartFetching(const base::Closure& completion_callback); |
25 virtual void CancelNotification(); | 29 virtual void CancelNotification(); |
26 virtual void DeleteAppCacheGroup(const GURL& manifest_url); | 30 virtual void DeleteAppCacheGroup(const GURL& manifest_url); |
27 | 31 |
28 appcache::AppCacheInfoCollection* info_collection() const { | 32 appcache::AppCacheInfoCollection* info_collection() const { |
29 DCHECK(!is_fetching_); | 33 DCHECK(!is_fetching_); |
30 return info_collection_; | 34 return info_collection_; |
31 } | 35 } |
32 | 36 |
33 protected: | 37 protected: |
34 friend class base::RefCountedThreadSafe<BrowsingDataAppCacheHelper>; | 38 friend class base::RefCountedThreadSafe<BrowsingDataAppCacheHelper>; |
35 virtual ~BrowsingDataAppCacheHelper(); | 39 virtual ~BrowsingDataAppCacheHelper(); |
36 | 40 |
37 base::Closure completion_callback_; | 41 base::Closure completion_callback_; |
38 scoped_refptr<appcache::AppCacheInfoCollection> info_collection_; | 42 scoped_refptr<appcache::AppCacheInfoCollection> info_collection_; |
39 | 43 |
40 private: | 44 private: |
41 void OnFetchComplete(int rv); | 45 void OnFetchComplete(int rv); |
42 | 46 |
43 bool is_fetching_; | 47 bool is_fetching_; |
44 scoped_refptr<ChromeAppCacheService> appcache_service_; | 48 content::ResourceContext* resource_context_; |
45 net::CancelableCompletionCallback appcache_info_callback_; | 49 net::CancelableCompletionCallback appcache_info_callback_; |
46 | 50 |
47 DISALLOW_COPY_AND_ASSIGN(BrowsingDataAppCacheHelper); | 51 DISALLOW_COPY_AND_ASSIGN(BrowsingDataAppCacheHelper); |
48 }; | 52 }; |
49 | 53 |
50 // This class is a thin wrapper around BrowsingDataAppCacheHelper that does not | 54 // This class is a thin wrapper around BrowsingDataAppCacheHelper that does not |
51 // fetch its information from the appcache service, but gets them passed as | 55 // fetch its information from the appcache service, but gets them passed as |
52 // a parameter during construction. | 56 // a parameter during construction. |
53 class CannedBrowsingDataAppCacheHelper : public BrowsingDataAppCacheHelper { | 57 class CannedBrowsingDataAppCacheHelper : public BrowsingDataAppCacheHelper { |
54 public: | 58 public: |
(...skipping 20 matching lines...) Expand all Loading... |
75 | 79 |
76 private: | 80 private: |
77 virtual ~CannedBrowsingDataAppCacheHelper(); | 81 virtual ~CannedBrowsingDataAppCacheHelper(); |
78 | 82 |
79 Profile* profile_; | 83 Profile* profile_; |
80 | 84 |
81 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataAppCacheHelper); | 85 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataAppCacheHelper); |
82 }; | 86 }; |
83 | 87 |
84 #endif // CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ | 88 #endif // CHROME_BROWSER_BROWSING_DATA_APPCACHE_HELPER_H_ |
OLD | NEW |