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

Side by Side Diff: chrome/browser/content_settings/local_shared_objects_container.cc

Issue 13979002: Add support for split PSL list distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added const modifiers Created 7 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/content_settings/local_shared_objects_container.h" 5 #include "chrome/browser/content_settings/local_shared_objects_container.h"
6 6
7 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" 7 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h"
8 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 8 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" 9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
10 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 10 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 ++cookie) { 80 ++cookie) {
81 // Strip leading '.'s. 81 // Strip leading '.'s.
82 std::string cookie_domain = cookie->Domain(); 82 std::string cookie_domain = cookie->Domain();
83 if (cookie_domain[0] == '.') 83 if (cookie_domain[0] == '.')
84 cookie_domain = cookie_domain.substr(1); 84 cookie_domain = cookie_domain.substr(1);
85 // The |domain_url| is only created in order to use the SameDomainOrHost 85 // The |domain_url| is only created in order to use the SameDomainOrHost
86 // method below. It does not matter which scheme is used as the scheme is 86 // method below. It does not matter which scheme is used as the scheme is
87 // ignored by the SameDomainOrHost method. 87 // ignored by the SameDomainOrHost method.
88 GURL domain_url(std::string(chrome::kHttpScheme) + 88 GURL domain_url(std::string(chrome::kHttpScheme) +
89 content::kStandardSchemeSeparator + cookie_domain); 89 content::kStandardSchemeSeparator + cookie_domain);
90 if (net::RegistryControlledDomainService::SameDomainOrHost( 90 if (net::registry_controlled_domains::SameDomainOrHost(
91 origin, domain_url)) { 91 origin,
92 domain_url,
93 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
92 ++count; 94 ++count;
93 } 95 }
94 } 96 }
95 } 97 }
96 98
97 // Count local storages for the domain of the given |origin|. 99 // Count local storages for the domain of the given |origin|.
98 const std::set<GURL> local_storage_info = 100 const std::set<GURL> local_storage_info =
99 local_storages()->GetLocalStorageInfo(); 101 local_storages()->GetLocalStorageInfo();
100 for (std::set<GURL>::const_iterator it = local_storage_info.begin(); 102 for (std::set<GURL>::const_iterator it = local_storage_info.begin();
101 it != local_storage_info.end(); 103 it != local_storage_info.end();
102 ++it) { 104 ++it) {
103 if (net::RegistryControlledDomainService::SameDomainOrHost( 105 if (net::registry_controlled_domains::SameDomainOrHost(
104 origin, *it)) { 106 origin,
107 *it,
108 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
105 ++count; 109 ++count;
106 } 110 }
107 } 111 }
108 112
109 // Count session storages for the domain of the given |origin|. 113 // Count session storages for the domain of the given |origin|.
110 const std::set<GURL> urls = session_storages()->GetLocalStorageInfo(); 114 const std::set<GURL> urls = session_storages()->GetLocalStorageInfo();
111 for (std::set<GURL>::const_iterator it = urls.begin(); 115 for (std::set<GURL>::const_iterator it = urls.begin();
112 it != urls.end(); 116 it != urls.end();
113 ++it) { 117 ++it) {
114 if (net::RegistryControlledDomainService::SameDomainOrHost( 118 if (net::registry_controlled_domains::SameDomainOrHost(
115 origin, *it)) { 119 origin,
120 *it,
121 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
116 ++count; 122 ++count;
117 } 123 }
118 } 124 }
119 125
120 // Count indexed dbs for the domain of the given |origin|. 126 // Count indexed dbs for the domain of the given |origin|.
121 typedef CannedBrowsingDataIndexedDBHelper::PendingIndexedDBInfo IndexedDBInfo; 127 typedef CannedBrowsingDataIndexedDBHelper::PendingIndexedDBInfo IndexedDBInfo;
122 const std::set<IndexedDBInfo>& indexed_db_info = 128 const std::set<IndexedDBInfo>& indexed_db_info =
123 indexed_dbs()->GetIndexedDBInfo(); 129 indexed_dbs()->GetIndexedDBInfo();
124 for (std::set<IndexedDBInfo>::const_iterator it = 130 for (std::set<IndexedDBInfo>::const_iterator it =
125 indexed_db_info.begin(); 131 indexed_db_info.begin();
126 it != indexed_db_info.end(); 132 it != indexed_db_info.end();
127 ++it) { 133 ++it) {
128 if (net::RegistryControlledDomainService::SameDomainOrHost( 134 if (net::registry_controlled_domains::SameDomainOrHost(
129 origin, it->origin)) { 135 origin,
136 it->origin,
137 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
130 ++count; 138 ++count;
131 } 139 }
132 } 140 }
133 141
134 // Count filesystems for the domain of the given |origin|. 142 // Count filesystems for the domain of the given |origin|.
135 typedef BrowsingDataFileSystemHelper::FileSystemInfo FileSystemInfo; 143 typedef BrowsingDataFileSystemHelper::FileSystemInfo FileSystemInfo;
136 typedef std::list<FileSystemInfo> FileSystemInfoList; 144 typedef std::list<FileSystemInfo> FileSystemInfoList;
137 const FileSystemInfoList& file_system_info = 145 const FileSystemInfoList& file_system_info =
138 file_systems()->GetFileSystemInfo(); 146 file_systems()->GetFileSystemInfo();
139 for (FileSystemInfoList::const_iterator it = file_system_info.begin(); 147 for (FileSystemInfoList::const_iterator it = file_system_info.begin();
140 it != file_system_info.end(); 148 it != file_system_info.end();
141 ++it) { 149 ++it) {
142 if (net::RegistryControlledDomainService::SameDomainOrHost( 150 if (net::registry_controlled_domains::SameDomainOrHost(
143 origin, it->origin)) { 151 origin,
152 it->origin,
153 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
144 ++count; 154 ++count;
145 } 155 }
146 } 156 }
147 157
148 // Count databases for the domain of the given |origin|. 158 // Count databases for the domain of the given |origin|.
149 typedef CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo DatabaseInfo; 159 typedef CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo DatabaseInfo;
150 const std::set<DatabaseInfo>& database_list = 160 const std::set<DatabaseInfo>& database_list =
151 databases()->GetPendingDatabaseInfo(); 161 databases()->GetPendingDatabaseInfo();
152 for (std::set<DatabaseInfo>::const_iterator it = 162 for (std::set<DatabaseInfo>::const_iterator it =
153 database_list.begin(); 163 database_list.begin();
154 it != database_list.end(); 164 it != database_list.end();
155 ++it) { 165 ++it) {
156 if (net::RegistryControlledDomainService::SameDomainOrHost( 166 if (net::registry_controlled_domains::SameDomainOrHost(
157 origin, it->origin)) { 167 origin,
168 it->origin,
169 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
158 ++count; 170 ++count;
159 } 171 }
160 } 172 }
161 173
162 // Count the AppCache manifest files for the domain of the given |origin|. 174 // Count the AppCache manifest files for the domain of the given |origin|.
163 typedef BrowsingDataAppCacheHelper::OriginAppCacheInfoMap 175 typedef BrowsingDataAppCacheHelper::OriginAppCacheInfoMap
164 OriginAppCacheInfoMap; 176 OriginAppCacheInfoMap;
165 const OriginAppCacheInfoMap& map = appcaches()->GetOriginAppCacheInfoMap(); 177 const OriginAppCacheInfoMap& map = appcaches()->GetOriginAppCacheInfoMap();
166 for (OriginAppCacheInfoMap::const_iterator it = map.begin(); 178 for (OriginAppCacheInfoMap::const_iterator it = map.begin();
167 it != map.end(); 179 it != map.end();
168 ++it) { 180 ++it) {
169 const appcache::AppCacheInfoVector& info_vector = it->second; 181 const appcache::AppCacheInfoVector& info_vector = it->second;
170 for (appcache::AppCacheInfoVector::const_iterator info = 182 for (appcache::AppCacheInfoVector::const_iterator info =
171 info_vector.begin(); 183 info_vector.begin();
172 info != info_vector.end(); 184 info != info_vector.end();
173 ++info) { 185 ++info) {
174 if (net::RegistryControlledDomainService::SameDomainOrHost( 186 if (net::registry_controlled_domains::SameDomainOrHost(
175 origin, info->manifest_url)) { 187 origin,
188 info->manifest_url,
189 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
176 ++count; 190 ++count;
177 } 191 }
178 } 192 }
179 } 193 }
180 194
181 return count; 195 return count;
182 } 196 }
183 197
184 scoped_ptr<CookiesTreeModel> 198 scoped_ptr<CookiesTreeModel>
185 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { 199 LocalSharedObjectsContainer::CreateCookiesTreeModel() const {
186 LocalDataContainer* container = new LocalDataContainer( 200 LocalDataContainer* container = new LocalDataContainer(
187 cookies()->Clone(), 201 cookies()->Clone(),
188 databases()->Clone(), 202 databases()->Clone(),
189 local_storages()->Clone(), 203 local_storages()->Clone(),
190 session_storages()->Clone(), 204 session_storages()->Clone(),
191 appcaches()->Clone(), 205 appcaches()->Clone(),
192 indexed_dbs()->Clone(), 206 indexed_dbs()->Clone(),
193 file_systems()->Clone(), 207 file_systems()->Clone(),
194 NULL, 208 NULL,
195 server_bound_certs()->Clone(), 209 server_bound_certs()->Clone(),
196 NULL); 210 NULL);
197 211
198 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); 212 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true));
199 } 213 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698