| 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 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 5 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 82 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 83 DCHECK(is_fetching_); | 83 DCHECK(is_fetching_); |
| 84 is_fetching_ = false; | 84 is_fetching_ = false; |
| 85 completion_callback_.Run(); | 85 completion_callback_.Run(); |
| 86 completion_callback_.Reset(); | 86 completion_callback_.Reset(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 CannedBrowsingDataAppCacheHelper::CannedBrowsingDataAppCacheHelper( | 89 CannedBrowsingDataAppCacheHelper::CannedBrowsingDataAppCacheHelper( |
| 90 Profile* profile) | 90 Profile* profile) |
| 91 : BrowsingDataAppCacheHelper(profile), | 91 : BrowsingDataAppCacheHelper(profile) { |
| 92 profile_(profile) { | |
| 93 info_collection_ = new content::AppCacheInfoCollection; | 92 info_collection_ = new content::AppCacheInfoCollection; |
| 94 } | 93 } |
| 95 | 94 |
| 96 CannedBrowsingDataAppCacheHelper* CannedBrowsingDataAppCacheHelper::Clone() { | |
| 97 DCHECK_CURRENTLY_ON(BrowserThread::UI); | |
| 98 CannedBrowsingDataAppCacheHelper* clone = | |
| 99 new CannedBrowsingDataAppCacheHelper(profile_); | |
| 100 | |
| 101 clone->info_collection_->infos_by_origin = info_collection_->infos_by_origin; | |
| 102 return clone; | |
| 103 } | |
| 104 | |
| 105 void CannedBrowsingDataAppCacheHelper::AddAppCache(const GURL& manifest_url) { | 95 void CannedBrowsingDataAppCacheHelper::AddAppCache(const GURL& manifest_url) { |
| 106 if (!BrowsingDataHelper::HasWebScheme(manifest_url)) | 96 if (!BrowsingDataHelper::HasWebScheme(manifest_url)) |
| 107 return; // Ignore non-websafe schemes. | 97 return; // Ignore non-websafe schemes. |
| 108 | 98 |
| 109 OriginAppCacheInfoMap& origin_map = info_collection_->infos_by_origin; | 99 OriginAppCacheInfoMap& origin_map = info_collection_->infos_by_origin; |
| 110 content::AppCacheInfoVector& appcache_infos_ = | 100 content::AppCacheInfoVector& appcache_infos_ = |
| 111 origin_map[manifest_url.GetOrigin()]; | 101 origin_map[manifest_url.GetOrigin()]; |
| 112 | 102 |
| 113 for (content::AppCacheInfoVector::iterator | 103 for (content::AppCacheInfoVector::iterator |
| 114 appcache = appcache_infos_.begin(); appcache != appcache_infos_.end(); | 104 appcache = appcache_infos_.begin(); appcache != appcache_infos_.end(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 completion_callback.Run(); | 141 completion_callback.Run(); |
| 152 } | 142 } |
| 153 | 143 |
| 154 void CannedBrowsingDataAppCacheHelper::DeleteAppCacheGroup( | 144 void CannedBrowsingDataAppCacheHelper::DeleteAppCacheGroup( |
| 155 const GURL& manifest_url) { | 145 const GURL& manifest_url) { |
| 156 info_collection_->infos_by_origin.erase(manifest_url.GetOrigin()); | 146 info_collection_->infos_by_origin.erase(manifest_url.GetOrigin()); |
| 157 BrowsingDataAppCacheHelper::DeleteAppCacheGroup(manifest_url); | 147 BrowsingDataAppCacheHelper::DeleteAppCacheGroup(manifest_url); |
| 158 } | 148 } |
| 159 | 149 |
| 160 CannedBrowsingDataAppCacheHelper::~CannedBrowsingDataAppCacheHelper() {} | 150 CannedBrowsingDataAppCacheHelper::~CannedBrowsingDataAppCacheHelper() {} |
| OLD | NEW |