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