| 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_BROWSING_DATA_APPCACHE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_APPCACHE_HELPER_H_ |
| 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_APPCACHE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_APPCACHE_HELPER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/public/browser/appcache_service.h" |
| 10 #include "net/base/completion_callback.h" | 11 #include "net/base/completion_callback.h" |
| 11 #include "url/gurl.h" | 12 #include "url/gurl.h" |
| 12 #include "webkit/browser/appcache/appcache_service.h" | |
| 13 | 13 |
| 14 class Profile; | 14 class Profile; |
| 15 | 15 |
| 16 namespace appcache { | 16 namespace content { |
| 17 class AppCacheService; | 17 class AppCacheService; |
| 18 } | 18 } |
| 19 | 19 |
| 20 // This class fetches appcache information on behalf of a caller | 20 // This class fetches appcache information on behalf of a caller |
| 21 // on the UI thread. | 21 // on the UI thread. |
| 22 class BrowsingDataAppCacheHelper | 22 class BrowsingDataAppCacheHelper |
| 23 : public base::RefCountedThreadSafe<BrowsingDataAppCacheHelper> { | 23 : public base::RefCountedThreadSafe<BrowsingDataAppCacheHelper> { |
| 24 public: | 24 public: |
| 25 typedef std::map<GURL, appcache::AppCacheInfoVector> OriginAppCacheInfoMap; | 25 typedef std::map<GURL, content::AppCacheInfoVector> OriginAppCacheInfoMap; |
| 26 | 26 |
| 27 explicit BrowsingDataAppCacheHelper(Profile* profile); | 27 explicit BrowsingDataAppCacheHelper(Profile* profile); |
| 28 | 28 |
| 29 virtual void StartFetching(const base::Closure& completion_callback); | 29 virtual void StartFetching(const base::Closure& completion_callback); |
| 30 virtual void DeleteAppCacheGroup(const GURL& manifest_url); | 30 virtual void DeleteAppCacheGroup(const GURL& manifest_url); |
| 31 | 31 |
| 32 appcache::AppCacheInfoCollection* info_collection() const { | 32 content::AppCacheInfoCollection* info_collection() const { |
| 33 DCHECK(!is_fetching_); | 33 DCHECK(!is_fetching_); |
| 34 return info_collection_.get(); | 34 return info_collection_.get(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 friend class base::RefCountedThreadSafe<BrowsingDataAppCacheHelper>; | 38 friend class base::RefCountedThreadSafe<BrowsingDataAppCacheHelper>; |
| 39 virtual ~BrowsingDataAppCacheHelper(); | 39 virtual ~BrowsingDataAppCacheHelper(); |
| 40 | 40 |
| 41 base::Closure completion_callback_; | 41 base::Closure completion_callback_; |
| 42 scoped_refptr<appcache::AppCacheInfoCollection> info_collection_; | 42 scoped_refptr<content::AppCacheInfoCollection> info_collection_; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 void OnFetchComplete(int rv); | 45 void OnFetchComplete(int rv); |
| 46 | 46 |
| 47 bool is_fetching_; | 47 bool is_fetching_; |
| 48 appcache::AppCacheService* appcache_service_; | 48 content::AppCacheService* appcache_service_; |
| 49 net::CancelableCompletionCallback appcache_info_callback_; | 49 net::CancelableCompletionCallback appcache_info_callback_; |
| 50 | 50 |
| 51 DISALLOW_COPY_AND_ASSIGN(BrowsingDataAppCacheHelper); | 51 DISALLOW_COPY_AND_ASSIGN(BrowsingDataAppCacheHelper); |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 // This class is a thin wrapper around BrowsingDataAppCacheHelper that does not | 54 // This class is a thin wrapper around BrowsingDataAppCacheHelper that does not |
| 55 // 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 |
| 56 // a parameter during construction. | 56 // a parameter during construction. |
| 57 class CannedBrowsingDataAppCacheHelper : public BrowsingDataAppCacheHelper { | 57 class CannedBrowsingDataAppCacheHelper : public BrowsingDataAppCacheHelper { |
| 58 public: | 58 public: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 85 | 85 |
| 86 private: | 86 private: |
| 87 virtual ~CannedBrowsingDataAppCacheHelper(); | 87 virtual ~CannedBrowsingDataAppCacheHelper(); |
| 88 | 88 |
| 89 Profile* profile_; | 89 Profile* profile_; |
| 90 | 90 |
| 91 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataAppCacheHelper); | 91 DISALLOW_COPY_AND_ASSIGN(CannedBrowsingDataAppCacheHelper); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_APPCACHE_HELPER_H_ | 94 #endif // CHROME_BROWSER_BROWSING_DATA_BROWSING_DATA_APPCACHE_HELPER_H_ |
| OLD | NEW |