Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/browser/browsing_data_appcache_helper.cc

Issue 10092013: Display third party cookies and site data counts in the WebsiteSettings UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Fix CannedBrowsingDataDatabaseHelperTest.*" Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_appcache_helper.h" 5 #include "chrome/browser/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_helper.h" 9 #include "chrome/browser/browsing_data_helper.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 new CannedBrowsingDataAppCacheHelper(profile_); 101 new CannedBrowsingDataAppCacheHelper(profile_);
102 102
103 clone->info_collection_->infos_by_origin = info_collection_->infos_by_origin; 103 clone->info_collection_->infos_by_origin = info_collection_->infos_by_origin;
104 return clone; 104 return clone;
105 } 105 }
106 106
107 void CannedBrowsingDataAppCacheHelper::AddAppCache(const GURL& manifest_url) { 107 void CannedBrowsingDataAppCacheHelper::AddAppCache(const GURL& manifest_url) {
108 if (!BrowsingDataHelper::HasValidScheme(manifest_url)) 108 if (!BrowsingDataHelper::HasValidScheme(manifest_url))
109 return; // Ignore non-websafe schemes. 109 return; // Ignore non-websafe schemes.
110 110
111 typedef std::map<GURL, appcache::AppCacheInfoVector> InfoByOrigin; 111 OriginAppCacheInfoMap& origin_map = info_collection_->infos_by_origin;
112 InfoByOrigin& origin_map = info_collection_->infos_by_origin;
113 appcache::AppCacheInfoVector& appcache_infos_ = 112 appcache::AppCacheInfoVector& appcache_infos_ =
114 origin_map[manifest_url.GetOrigin()]; 113 origin_map[manifest_url.GetOrigin()];
115 114
116 for (appcache::AppCacheInfoVector::iterator 115 for (appcache::AppCacheInfoVector::iterator
117 appcache = appcache_infos_.begin(); appcache != appcache_infos_.end(); 116 appcache = appcache_infos_.begin(); appcache != appcache_infos_.end();
118 ++appcache) { 117 ++appcache) {
119 if (appcache->manifest_url == manifest_url) 118 if (appcache->manifest_url == manifest_url)
120 return; 119 return;
121 } 120 }
122 121
123 appcache::AppCacheInfo info; 122 appcache::AppCacheInfo info;
124 info.manifest_url = manifest_url; 123 info.manifest_url = manifest_url;
125 appcache_infos_.push_back(info); 124 appcache_infos_.push_back(info);
126 } 125 }
127 126
128 void CannedBrowsingDataAppCacheHelper::Reset() { 127 void CannedBrowsingDataAppCacheHelper::Reset() {
129 info_collection_->infos_by_origin.clear(); 128 info_collection_->infos_by_origin.clear();
130 } 129 }
131 130
132 bool CannedBrowsingDataAppCacheHelper::empty() const { 131 bool CannedBrowsingDataAppCacheHelper::empty() const {
133 return info_collection_->infos_by_origin.empty(); 132 return info_collection_->infos_by_origin.empty();
134 } 133 }
135 134
135 size_t CannedBrowsingDataAppCacheHelper::GetAppCacheCount() const {
136 size_t count = 0;
137 const OriginAppCacheInfoMap& map = info_collection_->infos_by_origin;
138 for (OriginAppCacheInfoMap::const_iterator it = map.begin();
139 it != map.end();
140 ++it) {
141 count += it->second.size();
142 }
143 return count;
144 }
145
146 const BrowsingDataAppCacheHelper::OriginAppCacheInfoMap&
147 CannedBrowsingDataAppCacheHelper::GetOriginAppCacheInfoMap() const {
148 return info_collection_->infos_by_origin;
149 }
150
136 void CannedBrowsingDataAppCacheHelper::StartFetching( 151 void CannedBrowsingDataAppCacheHelper::StartFetching(
137 const base::Closure& completion_callback) { 152 const base::Closure& completion_callback) {
138 completion_callback.Run(); 153 completion_callback.Run();
139 } 154 }
140 155
141 CannedBrowsingDataAppCacheHelper::~CannedBrowsingDataAppCacheHelper() {} 156 CannedBrowsingDataAppCacheHelper::~CannedBrowsingDataAppCacheHelper() {}
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_appcache_helper.h ('k') | chrome/browser/browsing_data_cookie_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698