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