| 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/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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::RegistryControlledDomainService::SameDomainOrHost( |
| 91 origin, domain_url)) { | 91 origin, domain_url, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) { |
| 92 ++count; | 92 ++count; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 // Count local storages for the domain of the given |origin|. | 97 // Count local storages for the domain of the given |origin|. |
| 98 const std::set<GURL> local_storage_info = | 98 const std::set<GURL> local_storage_info = |
| 99 local_storages()->GetLocalStorageInfo(); | 99 local_storages()->GetLocalStorageInfo(); |
| 100 for (std::set<GURL>::const_iterator it = local_storage_info.begin(); | 100 for (std::set<GURL>::const_iterator it = local_storage_info.begin(); |
| 101 it != local_storage_info.end(); | 101 it != local_storage_info.end(); |
| 102 ++it) { | 102 ++it) { |
| 103 if (net::RegistryControlledDomainService::SameDomainOrHost( | 103 if (net::RegistryControlledDomainService::SameDomainOrHost( |
| 104 origin, *it)) { | 104 origin, *it, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) { |
| 105 ++count; | 105 ++count; |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Count session storages for the domain of the given |origin|. | 109 // Count session storages for the domain of the given |origin|. |
| 110 const std::set<GURL> urls = session_storages()->GetLocalStorageInfo(); | 110 const std::set<GURL> urls = session_storages()->GetLocalStorageInfo(); |
| 111 for (std::set<GURL>::const_iterator it = urls.begin(); | 111 for (std::set<GURL>::const_iterator it = urls.begin(); |
| 112 it != urls.end(); | 112 it != urls.end(); |
| 113 ++it) { | 113 ++it) { |
| 114 if (net::RegistryControlledDomainService::SameDomainOrHost( | 114 if (net::RegistryControlledDomainService::SameDomainOrHost( |
| 115 origin, *it)) { | 115 origin, *it, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) { |
| 116 ++count; | 116 ++count; |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 // Count indexed dbs for the domain of the given |origin|. | 120 // Count indexed dbs for the domain of the given |origin|. |
| 121 typedef CannedBrowsingDataIndexedDBHelper::PendingIndexedDBInfo IndexedDBInfo; | 121 typedef CannedBrowsingDataIndexedDBHelper::PendingIndexedDBInfo IndexedDBInfo; |
| 122 const std::set<IndexedDBInfo>& indexed_db_info = | 122 const std::set<IndexedDBInfo>& indexed_db_info = |
| 123 indexed_dbs()->GetIndexedDBInfo(); | 123 indexed_dbs()->GetIndexedDBInfo(); |
| 124 for (std::set<IndexedDBInfo>::const_iterator it = | 124 for (std::set<IndexedDBInfo>::const_iterator it = |
| 125 indexed_db_info.begin(); | 125 indexed_db_info.begin(); |
| 126 it != indexed_db_info.end(); | 126 it != indexed_db_info.end(); |
| 127 ++it) { | 127 ++it) { |
| 128 if (net::RegistryControlledDomainService::SameDomainOrHost( | 128 if (net::RegistryControlledDomainService::SameDomainOrHost( |
| 129 origin, it->origin)) { | 129 origin, it->origin, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) { |
| 130 ++count; | 130 ++count; |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 // Count filesystems for the domain of the given |origin|. | 134 // Count filesystems for the domain of the given |origin|. |
| 135 typedef BrowsingDataFileSystemHelper::FileSystemInfo FileSystemInfo; | 135 typedef BrowsingDataFileSystemHelper::FileSystemInfo FileSystemInfo; |
| 136 typedef std::list<FileSystemInfo> FileSystemInfoList; | 136 typedef std::list<FileSystemInfo> FileSystemInfoList; |
| 137 const FileSystemInfoList& file_system_info = | 137 const FileSystemInfoList& file_system_info = |
| 138 file_systems()->GetFileSystemInfo(); | 138 file_systems()->GetFileSystemInfo(); |
| 139 for (FileSystemInfoList::const_iterator it = file_system_info.begin(); | 139 for (FileSystemInfoList::const_iterator it = file_system_info.begin(); |
| 140 it != file_system_info.end(); | 140 it != file_system_info.end(); |
| 141 ++it) { | 141 ++it) { |
| 142 if (net::RegistryControlledDomainService::SameDomainOrHost( | 142 if (net::RegistryControlledDomainService::SameDomainOrHost( |
| 143 origin, it->origin)) { | 143 origin, it->origin, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) { |
| 144 ++count; | 144 ++count; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 | 147 |
| 148 // Count databases for the domain of the given |origin|. | 148 // Count databases for the domain of the given |origin|. |
| 149 typedef CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo DatabaseInfo; | 149 typedef CannedBrowsingDataDatabaseHelper::PendingDatabaseInfo DatabaseInfo; |
| 150 const std::set<DatabaseInfo>& database_list = | 150 const std::set<DatabaseInfo>& database_list = |
| 151 databases()->GetPendingDatabaseInfo(); | 151 databases()->GetPendingDatabaseInfo(); |
| 152 for (std::set<DatabaseInfo>::const_iterator it = | 152 for (std::set<DatabaseInfo>::const_iterator it = |
| 153 database_list.begin(); | 153 database_list.begin(); |
| 154 it != database_list.end(); | 154 it != database_list.end(); |
| 155 ++it) { | 155 ++it) { |
| 156 if (net::RegistryControlledDomainService::SameDomainOrHost( | 156 if (net::RegistryControlledDomainService::SameDomainOrHost( |
| 157 origin, it->origin)) { | 157 origin, it->origin, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) { |
| 158 ++count; | 158 ++count; |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Count the AppCache manifest files for the domain of the given |origin|. | 162 // Count the AppCache manifest files for the domain of the given |origin|. |
| 163 typedef BrowsingDataAppCacheHelper::OriginAppCacheInfoMap | 163 typedef BrowsingDataAppCacheHelper::OriginAppCacheInfoMap |
| 164 OriginAppCacheInfoMap; | 164 OriginAppCacheInfoMap; |
| 165 const OriginAppCacheInfoMap& map = appcaches()->GetOriginAppCacheInfoMap(); | 165 const OriginAppCacheInfoMap& map = appcaches()->GetOriginAppCacheInfoMap(); |
| 166 for (OriginAppCacheInfoMap::const_iterator it = map.begin(); | 166 for (OriginAppCacheInfoMap::const_iterator it = map.begin(); |
| 167 it != map.end(); | 167 it != map.end(); |
| 168 ++it) { | 168 ++it) { |
| 169 const appcache::AppCacheInfoVector& info_vector = it->second; | 169 const appcache::AppCacheInfoVector& info_vector = it->second; |
| 170 for (appcache::AppCacheInfoVector::const_iterator info = | 170 for (appcache::AppCacheInfoVector::const_iterator info = |
| 171 info_vector.begin(); | 171 info_vector.begin(); |
| 172 info != info_vector.end(); | 172 info != info_vector.end(); |
| 173 ++info) { | 173 ++info) { |
| 174 if (net::RegistryControlledDomainService::SameDomainOrHost( | 174 if (net::RegistryControlledDomainService::SameDomainOrHost( |
| 175 origin, info->manifest_url)) { | 175 origin, info->manifest_url, net::RCDS::EXCLUDE_PRIVATE_REGISTRIES)) { |
| 176 ++count; | 176 ++count; |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 } | 179 } |
| 180 | 180 |
| 181 return count; | 181 return count; |
| 182 } | 182 } |
| 183 | 183 |
| 184 scoped_ptr<CookiesTreeModel> | 184 scoped_ptr<CookiesTreeModel> |
| 185 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { | 185 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { |
| 186 LocalDataContainer* container = new LocalDataContainer( | 186 LocalDataContainer* container = new LocalDataContainer( |
| 187 cookies()->Clone(), | 187 cookies()->Clone(), |
| 188 databases()->Clone(), | 188 databases()->Clone(), |
| 189 local_storages()->Clone(), | 189 local_storages()->Clone(), |
| 190 session_storages()->Clone(), | 190 session_storages()->Clone(), |
| 191 appcaches()->Clone(), | 191 appcaches()->Clone(), |
| 192 indexed_dbs()->Clone(), | 192 indexed_dbs()->Clone(), |
| 193 file_systems()->Clone(), | 193 file_systems()->Clone(), |
| 194 NULL, | 194 NULL, |
| 195 server_bound_certs()->Clone(), | 195 server_bound_certs()->Clone(), |
| 196 NULL); | 196 NULL); |
| 197 | 197 |
| 198 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); | 198 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); |
| 199 } | 199 } |
| OLD | NEW |