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

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

Issue 1297093002: Cache Storage API: Hook up to chrome://settings/cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto https://codereview.chromium.org/1297023004 Created 5 years, 4 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
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_cache_storage_helper.h"
8 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" 9 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"
9 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" 10 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h"
10 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" 11 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
11 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" 12 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h"
12 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" 13 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
13 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 14 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
14 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" 15 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h"
15 #include "chrome/browser/browsing_data/canonical_cookie_hash.h" 16 #include "chrome/browser/browsing_data/canonical_cookie_hash.h"
16 #include "chrome/browser/browsing_data/cookies_tree_model.h" 17 #include "chrome/browser/browsing_data/cookies_tree_model.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
(...skipping 10 matching lines...) Expand all
28 gurl1, 29 gurl1,
29 gurl2, 30 gurl2,
30 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); 31 net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
31 } 32 }
32 33
33 } // namespace 34 } // namespace
34 35
35 LocalSharedObjectsContainer::LocalSharedObjectsContainer(Profile* profile) 36 LocalSharedObjectsContainer::LocalSharedObjectsContainer(Profile* profile)
36 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)), 37 : appcaches_(new CannedBrowsingDataAppCacheHelper(profile)),
37 channel_ids_(new CannedBrowsingDataChannelIDHelper()), 38 channel_ids_(new CannedBrowsingDataChannelIDHelper()),
38 cookies_(new CannedBrowsingDataCookieHelper( 39 cookies_(
39 profile->GetRequestContext())), 40 new CannedBrowsingDataCookieHelper(profile->GetRequestContext())),
40 databases_(new CannedBrowsingDataDatabaseHelper(profile)), 41 databases_(new CannedBrowsingDataDatabaseHelper(profile)),
41 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)), 42 file_systems_(new CannedBrowsingDataFileSystemHelper(profile)),
42 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper( 43 indexed_dbs_(new CannedBrowsingDataIndexedDBHelper(
43 content::BrowserContext::GetDefaultStoragePartition(profile)-> 44 content::BrowserContext::GetDefaultStoragePartition(profile)
44 GetIndexedDBContext())), 45 ->GetIndexedDBContext())),
45 local_storages_(new CannedBrowsingDataLocalStorageHelper(profile)), 46 local_storages_(new CannedBrowsingDataLocalStorageHelper(profile)),
46 service_workers_(new CannedBrowsingDataServiceWorkerHelper( 47 service_workers_(new CannedBrowsingDataServiceWorkerHelper(
47 content::BrowserContext::GetDefaultStoragePartition(profile)-> 48 content::BrowserContext::GetDefaultStoragePartition(profile)
48 GetServiceWorkerContext())), 49 ->GetServiceWorkerContext())),
49 session_storages_(new CannedBrowsingDataLocalStorageHelper(profile)) { 50 cache_storages_(new CannedBrowsingDataCacheStorageHelper(
50 } 51 content::BrowserContext::GetDefaultStoragePartition(profile)
52 ->GetCacheStorageContext())),
53 session_storages_(new CannedBrowsingDataLocalStorageHelper(profile)) {}
51 54
52 LocalSharedObjectsContainer::~LocalSharedObjectsContainer() { 55 LocalSharedObjectsContainer::~LocalSharedObjectsContainer() {
53 } 56 }
54 57
55 size_t LocalSharedObjectsContainer::GetObjectCount() const { 58 size_t LocalSharedObjectsContainer::GetObjectCount() const {
56 size_t count = 0; 59 size_t count = 0;
57 count += appcaches()->GetAppCacheCount(); 60 count += appcaches()->GetAppCacheCount();
58 count += channel_ids()->GetChannelIDCount(); 61 count += channel_ids()->GetChannelIDCount();
59 count += cookies()->GetCookieCount(); 62 count += cookies()->GetCookieCount();
60 count += databases()->GetDatabaseCount(); 63 count += databases()->GetDatabaseCount();
61 count += file_systems()->GetFileSystemCount(); 64 count += file_systems()->GetFileSystemCount();
62 count += indexed_dbs()->GetIndexedDBCount(); 65 count += indexed_dbs()->GetIndexedDBCount();
63 count += local_storages()->GetLocalStorageCount(); 66 count += local_storages()->GetLocalStorageCount();
64 count += service_workers()->GetServiceWorkerCount(); 67 count += service_workers()->GetServiceWorkerCount();
68 count += cache_storages()->GetCacheStorageCount();
65 count += session_storages()->GetLocalStorageCount(); 69 count += session_storages()->GetLocalStorageCount();
66 return count; 70 return count;
67 } 71 }
68 72
69 size_t LocalSharedObjectsContainer::GetObjectCountForDomain( 73 size_t LocalSharedObjectsContainer::GetObjectCountForDomain(
70 const GURL& origin) const { 74 const GURL& origin) const {
71 size_t count = 0; 75 size_t count = 0;
72 76
73 // Count all cookies that have the same domain as the provided |origin|. This 77 // Count all cookies that have the same domain as the provided |origin|. This
74 // means count all cookies that has been set by a host that is not considered 78 // means count all cookies that has been set by a host that is not considered
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 const std::set<ServiceWorkerInfo>& service_worker_info = 141 const std::set<ServiceWorkerInfo>& service_worker_info =
138 service_workers()->GetServiceWorkerUsageInfo(); 142 service_workers()->GetServiceWorkerUsageInfo();
139 for (std::set<ServiceWorkerInfo>::const_iterator it = 143 for (std::set<ServiceWorkerInfo>::const_iterator it =
140 service_worker_info.begin(); 144 service_worker_info.begin();
141 it != service_worker_info.end(); 145 it != service_worker_info.end();
142 ++it) { 146 ++it) {
143 if (SameDomainOrHost(origin, it->origin)) 147 if (SameDomainOrHost(origin, it->origin))
144 ++count; 148 ++count;
145 } 149 }
146 150
151 // Count cache storages for the domain of the given |origin|.
152 typedef CannedBrowsingDataCacheStorageHelper::PendingCacheStorageUsageInfo
153 CacheStorageInfo;
154 const std::set<CacheStorageInfo>& cache_storage_info =
155 cache_storages()->GetCacheStorageUsageInfo();
156 for (const CacheStorageInfo& it : cache_storage_info) {
157 if (SameDomainOrHost(origin, it.origin))
158 ++count;
159 }
160
147 // Count filesystems for the domain of the given |origin|. 161 // Count filesystems for the domain of the given |origin|.
148 typedef BrowsingDataFileSystemHelper::FileSystemInfo FileSystemInfo; 162 typedef BrowsingDataFileSystemHelper::FileSystemInfo FileSystemInfo;
149 typedef std::list<FileSystemInfo> FileSystemInfoList; 163 typedef std::list<FileSystemInfo> FileSystemInfoList;
150 const FileSystemInfoList& file_system_info = 164 const FileSystemInfoList& file_system_info =
151 file_systems()->GetFileSystemInfo(); 165 file_systems()->GetFileSystemInfo();
152 for (FileSystemInfoList::const_iterator it = file_system_info.begin(); 166 for (FileSystemInfoList::const_iterator it = file_system_info.begin();
153 it != file_system_info.end(); 167 it != file_system_info.end();
154 ++it) { 168 ++it) {
155 if (SameDomainOrHost(origin, it->origin)) 169 if (SameDomainOrHost(origin, it->origin))
156 ++count; 170 ++count;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 204
191 void LocalSharedObjectsContainer::Reset() { 205 void LocalSharedObjectsContainer::Reset() {
192 appcaches_->Reset(); 206 appcaches_->Reset();
193 channel_ids_->Reset(); 207 channel_ids_->Reset();
194 cookies_->Reset(); 208 cookies_->Reset();
195 databases_->Reset(); 209 databases_->Reset();
196 file_systems_->Reset(); 210 file_systems_->Reset();
197 indexed_dbs_->Reset(); 211 indexed_dbs_->Reset();
198 local_storages_->Reset(); 212 local_storages_->Reset();
199 service_workers_->Reset(); 213 service_workers_->Reset();
214 cache_storages_->Reset();
200 session_storages_->Reset(); 215 session_storages_->Reset();
201 } 216 }
202 217
203 scoped_ptr<CookiesTreeModel> 218 scoped_ptr<CookiesTreeModel>
204 LocalSharedObjectsContainer::CreateCookiesTreeModel() const { 219 LocalSharedObjectsContainer::CreateCookiesTreeModel() const {
205 LocalDataContainer* container = new LocalDataContainer( 220 LocalDataContainer* container = new LocalDataContainer(
206 cookies(), 221 cookies(), databases(), local_storages(), session_storages(), appcaches(),
207 databases(), 222 indexed_dbs(), file_systems(), NULL, channel_ids(), service_workers(),
208 local_storages(), 223 cache_storages(), NULL);
209 session_storages(),
210 appcaches(),
211 indexed_dbs(),
212 file_systems(),
213 NULL,
214 channel_ids(),
215 service_workers(),
216 NULL);
217 224
218 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true)); 225 return make_scoped_ptr(new CookiesTreeModel(container, NULL, true));
219 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698