| 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/browser/storage_partition.h" |
| 17 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
| 18 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 18 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 19 #include "net/base/url_constants.h" |
| 19 #include "net/cookies/canonical_cookie.h" | 20 #include "net/cookies/canonical_cookie.h" |
| 20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
| 21 | 22 |
| 22 namespace { | 23 namespace { |
| 23 | 24 |
| 24 bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2) { | 25 bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2) { |
| 25 return net::registry_controlled_domains::SameDomainOrHost( | 26 return net::registry_controlled_domains::SameDomainOrHost( |
| 26 gurl1, | 27 gurl1, |
| 27 gurl2, | 28 gurl2, |
| 28 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 29 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 for (net::CookieList::const_iterator cookie = cookie_list->begin(); | 93 for (net::CookieList::const_iterator cookie = cookie_list->begin(); |
| 93 cookie != cookie_list->end(); | 94 cookie != cookie_list->end(); |
| 94 ++cookie) { | 95 ++cookie) { |
| 95 // Strip leading '.'s. | 96 // Strip leading '.'s. |
| 96 std::string cookie_domain = cookie->Domain(); | 97 std::string cookie_domain = cookie->Domain(); |
| 97 if (cookie_domain[0] == '.') | 98 if (cookie_domain[0] == '.') |
| 98 cookie_domain = cookie_domain.substr(1); | 99 cookie_domain = cookie_domain.substr(1); |
| 99 // The |domain_url| is only created in order to use the | 100 // The |domain_url| is only created in order to use the |
| 100 // SameDomainOrHost method below. It does not matter which scheme is | 101 // SameDomainOrHost method below. It does not matter which scheme is |
| 101 // used as the scheme is ignored by the SameDomainOrHost method. | 102 // used as the scheme is ignored by the SameDomainOrHost method. |
| 102 GURL domain_url(std::string(content::kHttpScheme) + | 103 GURL domain_url(std::string(net::kHttpScheme) + |
| 103 content::kStandardSchemeSeparator + cookie_domain); | 104 content::kStandardSchemeSeparator + cookie_domain); |
| 104 if (SameDomainOrHost(origin, domain_url)) | 105 if (SameDomainOrHost(origin, domain_url)) |
| 105 ++count; | 106 ++count; |
| 106 } | 107 } |
| 107 } | 108 } |
| 108 | 109 |
| 109 // Count local storages for the domain of the given |origin|. | 110 // Count local storages for the domain of the given |origin|. |
| 110 const std::set<GURL> local_storage_info = | 111 const std::set<GURL> local_storage_info = |
| 111 local_storages()->GetLocalStorageInfo(); | 112 local_storages()->GetLocalStorageInfo(); |
| 112 for (std::set<GURL>::const_iterator it = local_storage_info.begin(); | 113 for (std::set<GURL>::const_iterator it = local_storage_info.begin(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 session_storages(), | 191 session_storages(), |
| 191 appcaches(), | 192 appcaches(), |
| 192 indexed_dbs(), | 193 indexed_dbs(), |
| 193 file_systems(), | 194 file_systems(), |
| 194 NULL, | 195 NULL, |
| 195 server_bound_certs(), | 196 server_bound_certs(), |
| 196 NULL); | 197 NULL); |
| 197 | 198 |
| 198 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); | 199 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); |
| 199 } | 200 } |
| OLD | NEW |