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_channel_id_helper.h" | |
8 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
9 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
10 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 11 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
11 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 12 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
12 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_local_storage_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/cookies/canonical_cookie.h" | 19 #include "net/cookies/canonical_cookie.h" |
20 #include "url/gurl.h" | 20 #include "url/gurl.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2) { | 24 bool SameDomainOrHost(const GURL& gurl1, const GURL& gurl2) { |
25 return net::registry_controlled_domains::SameDomainOrHost( | 25 return net::registry_controlled_domains::SameDomainOrHost( |
26 gurl1, | 26 gurl1, |
27 gurl2, | 27 gurl2, |
28 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); | 28 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
29 } | 29 } |
30 | 30 |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 LocalSharedObjectsContainer::LocalSharedObjectsContainer(Profile* profile) | 33 LocalSharedObjectsContainer::LocalSharedObjectsContainer(Profile* profile) |
34 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), | 34 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), |
35 channel_ids_(new CannedBrowsingDataChannelIDHelper()), | |
35 cookies_(new CannedBrowsingDataCookieHelper( | 36 cookies_(new CannedBrowsingDataCookieHelper( |
36 profile->GetRequestContext())), | 37 profile->GetRequestContext())), |
37 databases_(new CannedBrowsingDataDatabaseHelper(profile)), | 38 databases_(new CannedBrowsingDataDatabaseHelper(profile)), |
38 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), | 39 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), |
39 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper( | 40 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper( |
40 content::BrowserContext::GetDefaultStoragePartition(profile)-> | 41 content::BrowserContext::GetDefaultStoragePartition(profile)-> |
41 GetIndexedDBContext())), | 42 GetIndexedDBContext())), |
42 local_storages_(new CannedBrowsingDataLocalStorageHelper(profile)), | 43 local_storages_(new CannedBrowsingDataLocalStorageHelper(profile)), |
43 server_bound_certs_(new CannedBrowsingDataServerBoundCertHelper()), | |
44 session_storages_(new CannedBrowsingDataLocalStorageHelper(profile)) { | 44 session_storages_(new CannedBrowsingDataLocalStorageHelper(profile)) { |
45 } | 45 } |
46 | 46 |
47 LocalSharedObjectsContainer::~LocalSharedObjectsContainer() { | 47 LocalSharedObjectsContainer::~LocalSharedObjectsContainer() { |
48 } | 48 } |
49 | 49 |
50 void LocalSharedObjectsContainer::Reset() { | 50 void LocalSharedObjectsContainer::Reset() { |
51 appcaches_->Reset(); | 51 appcaches_->Reset(); |
52 cookies_->Reset(); | 52 cookies_->Reset(); |
53 databases_->Reset(); | 53 databases_->Reset(); |
54 file_systems_->Reset(); | 54 file_systems_->Reset(); |
55 indexed_dbs_->Reset(); | 55 indexed_dbs_->Reset(); |
56 local_storages_->Reset(); | 56 local_storages_->Reset(); |
57 server_bound_certs_->Reset(); | 57 channel_ids_->Reset(); |
wtc
2014/07/22 22:49:31
Nit: sort in alphabetical order.
Ryan Hamilton
2014/07/22 23:32:53
Done.
| |
58 session_storages_->Reset(); | 58 session_storages_->Reset(); |
59 } | 59 } |
60 | 60 |
61 size_t LocalSharedObjectsContainer::GetObjectCount() const { | 61 size_t LocalSharedObjectsContainer::GetObjectCount() const { |
62 size_t count = 0; | 62 size_t count = 0; |
63 count += appcaches()->GetAppCacheCount(); | 63 count += appcaches()->GetAppCacheCount(); |
64 count += cookies()->GetCookieCount(); | 64 count += cookies()->GetCookieCount(); |
65 count += databases()->GetDatabaseCount(); | 65 count += databases()->GetDatabaseCount(); |
66 count += file_systems()->GetFileSystemCount(); | 66 count += file_systems()->GetFileSystemCount(); |
67 count += indexed_dbs()->GetIndexedDBCount(); | 67 count += indexed_dbs()->GetIndexedDBCount(); |
68 count += local_storages()->GetLocalStorageCount(); | 68 count += local_storages()->GetLocalStorageCount(); |
69 count += server_bound_certs()->GetCertCount(); | 69 count += channel_ids()->GetChannelIDCount(); |
wtc
2014/07/22 22:49:32
Nit: sort in alphabetical order.
Ryan Hamilton
2014/07/22 23:32:53
Done.
| |
70 count += session_storages()->GetLocalStorageCount(); | 70 count += session_storages()->GetLocalStorageCount(); |
71 return count; | 71 return count; |
72 } | 72 } |
73 | 73 |
74 size_t LocalSharedObjectsContainer::GetObjectCountForDomain( | 74 size_t LocalSharedObjectsContainer::GetObjectCountForDomain( |
75 const GURL& origin) const { | 75 const GURL& origin) const { |
76 size_t count = 0; | 76 size_t count = 0; |
77 | 77 |
78 // Count all cookies that have the same domain as the provided |origin|. This | 78 // Count all cookies that have the same domain as the provided |origin|. This |
79 // means count all cookies that has been set by a host that is not considered | 79 // means count all cookies that has been set by a host that is not considered |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { | 185 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { |
186 LocalDataContainer* container = new LocalDataContainer( | 186 LocalDataContainer* container = new LocalDataContainer( |
187 cookies(), | 187 cookies(), |
188 databases(), | 188 databases(), |
189 local_storages(), | 189 local_storages(), |
190 session_storages(), | 190 session_storages(), |
191 appcaches(), | 191 appcaches(), |
192 indexed_dbs(), | 192 indexed_dbs(), |
193 file_systems(), | 193 file_systems(), |
194 NULL, | 194 NULL, |
195 server_bound_certs(), | 195 channel_ids(), |
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 |