OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/browsing_data_appcache_helper.h" | 5 #include "chrome/browser/browsing_data_appcache_helper.h" |
6 | 6 |
7 #include "chrome/browser/net/chrome_url_request_context.h" | 7 #include "chrome/browser/net/chrome_url_request_context.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "content/browser/browser_thread.h" | 10 #include "content/browser/browser_thread.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 96 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
97 ChromeURLRequestContext* request_context = | 97 ChromeURLRequestContext* request_context = |
98 reinterpret_cast<ChromeURLRequestContext*>( | 98 reinterpret_cast<ChromeURLRequestContext*>( |
99 request_context_getter_->GetURLRequestContext()); | 99 request_context_getter_->GetURLRequestContext()); |
100 return request_context ? request_context->appcache_service() | 100 return request_context ? request_context->appcache_service() |
101 : NULL; | 101 : NULL; |
102 } | 102 } |
103 | 103 |
104 CannedBrowsingDataAppCacheHelper::CannedBrowsingDataAppCacheHelper( | 104 CannedBrowsingDataAppCacheHelper::CannedBrowsingDataAppCacheHelper( |
105 Profile* profile) | 105 Profile* profile) |
106 : BrowsingDataAppCacheHelper(profile) { | 106 : BrowsingDataAppCacheHelper(profile), |
| 107 profile_(profile) { |
107 info_collection_ = new appcache::AppCacheInfoCollection; | 108 info_collection_ = new appcache::AppCacheInfoCollection; |
108 } | 109 } |
109 | 110 |
| 111 CannedBrowsingDataAppCacheHelper* CannedBrowsingDataAppCacheHelper::Clone() { |
| 112 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 113 CannedBrowsingDataAppCacheHelper* clone = |
| 114 new CannedBrowsingDataAppCacheHelper(profile_); |
| 115 |
| 116 clone->info_collection_->infos_by_origin = info_collection_->infos_by_origin; |
| 117 return clone; |
| 118 } |
| 119 |
110 void CannedBrowsingDataAppCacheHelper::AddAppCache(const GURL& manifest_url) { | 120 void CannedBrowsingDataAppCacheHelper::AddAppCache(const GURL& manifest_url) { |
111 typedef std::map<GURL, appcache::AppCacheInfoVector> InfoByOrigin; | 121 typedef std::map<GURL, appcache::AppCacheInfoVector> InfoByOrigin; |
112 InfoByOrigin& origin_map = info_collection_->infos_by_origin; | 122 InfoByOrigin& origin_map = info_collection_->infos_by_origin; |
113 appcache::AppCacheInfoVector& appcache_infos_ = | 123 appcache::AppCacheInfoVector& appcache_infos_ = |
114 origin_map[manifest_url.GetOrigin()]; | 124 origin_map[manifest_url.GetOrigin()]; |
115 | 125 |
116 for (appcache::AppCacheInfoVector::iterator | 126 for (appcache::AppCacheInfoVector::iterator |
117 appcache = appcache_infos_.begin(); appcache != appcache_infos_.end(); | 127 appcache = appcache_infos_.begin(); appcache != appcache_infos_.end(); |
118 ++appcache) { | 128 ++appcache) { |
119 if (appcache->manifest_url == manifest_url) | 129 if (appcache->manifest_url == manifest_url) |
(...skipping 13 matching lines...) Expand all Loading... |
133 return info_collection_->infos_by_origin.empty(); | 143 return info_collection_->infos_by_origin.empty(); |
134 } | 144 } |
135 | 145 |
136 void CannedBrowsingDataAppCacheHelper::StartFetching( | 146 void CannedBrowsingDataAppCacheHelper::StartFetching( |
137 Callback0::Type* completion_callback) { | 147 Callback0::Type* completion_callback) { |
138 completion_callback->Run(); | 148 completion_callback->Run(); |
139 delete completion_callback; | 149 delete completion_callback; |
140 } | 150 } |
141 | 151 |
142 CannedBrowsingDataAppCacheHelper::~CannedBrowsingDataAppCacheHelper() {} | 152 CannedBrowsingDataAppCacheHelper::~CannedBrowsingDataAppCacheHelper() {} |
OLD | NEW |