| 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" |
| 11 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 11 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
| 12 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 12 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
| 13 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" |
| 14 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 14 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
| 15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "content/public/browser/storage_partition.h" |
| 16 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
| 17 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 18 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 18 #include "net/cookies/canonical_cookie.h" | 19 #include "net/cookies/canonical_cookie.h" |
| 19 #include "url/gurl.h" | 20 #include "url/gurl.h" |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 // Helper wrapper for net::registry_controlled_domains::SameDomainOrHost | 24 // Helper wrapper for net::registry_controlled_domains::SameDomainOrHost |
| 24 // which always excludes private registries. | 25 // which always excludes private registries. |
| 25 bool SamePublicDomainOrHost(const GURL& gurl1, const GURL& gurl2) { | 26 bool SamePublicDomainOrHost(const GURL& gurl1, const GURL& gurl2) { |
| 26 return net::registry_controlled_domains::SameDomainOrHost( | 27 return net::registry_controlled_domains::SameDomainOrHost( |
| 27 gurl1, | 28 gurl1, |
| 28 gurl2, | 29 gurl2, |
| 29 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 30 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 30 } | 31 } |
| 31 | 32 |
| 32 } | 33 } // namespace |
| 33 | 34 |
| 34 LocalSharedObjectsContainer::LocalSharedObjectsContainer(Profile* profile) | 35 LocalSharedObjectsContainer::LocalSharedObjectsContainer(Profile* profile) |
| 35 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), | 36 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), |
| 36 cookies_(new CannedBrowsingDataCookieHelper( | 37 cookies_(new CannedBrowsingDataCookieHelper( |
| 37 profile->GetRequestContext())), | 38 profile->GetRequestContext())), |
| 38 databases_(new CannedBrowsingDataDatabaseHelper(profile)), | 39 databases_(new CannedBrowsingDataDatabaseHelper(profile)), |
| 39 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), | 40 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), |
| 40 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper()), | 41 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper( |
| 42 content::BrowserContext::GetDefaultStoragePartition(profile)-> |
| 43 GetIndexedDBContext())), |
| 41 local_storages_(new CannedBrowsingDataLocalStorageHelper(profile)), | 44 local_storages_(new CannedBrowsingDataLocalStorageHelper(profile)), |
| 42 server_bound_certs_(new CannedBrowsingDataServerBoundCertHelper()), | 45 server_bound_certs_(new CannedBrowsingDataServerBoundCertHelper()), |
| 43 session_storages_(new CannedBrowsingDataLocalStorageHelper(profile)) { | 46 session_storages_(new CannedBrowsingDataLocalStorageHelper(profile)) { |
| 44 } | 47 } |
| 45 | 48 |
| 46 LocalSharedObjectsContainer::~LocalSharedObjectsContainer() { | 49 LocalSharedObjectsContainer::~LocalSharedObjectsContainer() { |
| 47 } | 50 } |
| 48 | 51 |
| 49 void LocalSharedObjectsContainer::Reset() { | 52 void LocalSharedObjectsContainer::Reset() { |
| 50 appcaches_->Reset(); | 53 appcaches_->Reset(); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 ++count; | 179 ++count; |
| 177 } | 180 } |
| 178 } | 181 } |
| 179 | 182 |
| 180 return count; | 183 return count; |
| 181 } | 184 } |
| 182 | 185 |
| 183 scoped_ptr<CookiesTreeModel> | 186 scoped_ptr<CookiesTreeModel> |
| 184 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { | 187 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { |
| 185 LocalDataContainer* container = new LocalDataContainer( | 188 LocalDataContainer* container = new LocalDataContainer( |
| 186 cookies()->Clone(), | 189 cookies(), |
| 187 databases()->Clone(), | 190 databases(), |
| 188 local_storages()->Clone(), | 191 local_storages(), |
| 189 session_storages()->Clone(), | 192 session_storages(), |
| 190 appcaches()->Clone(), | 193 appcaches(), |
| 191 indexed_dbs()->Clone(), | 194 indexed_dbs(), |
| 192 file_systems()->Clone(), | 195 file_systems(), |
| 193 NULL, | 196 NULL, |
| 194 server_bound_certs()->Clone(), | 197 server_bound_certs(), |
| 195 NULL); | 198 NULL); |
| 196 | 199 |
| 197 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); | 200 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); |
| 198 } | 201 } |
| OLD | NEW |