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 #ifndef CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/strings/string16.h" | 15 #include "base/strings/string16.h" |
16 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" | 16 #include "chrome/browser/browsing_data/browsing_data_appcache_helper.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" |
17 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h" |
18 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
19 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
20 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
21 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
22 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
23 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" | 24 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" |
24 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" | 25 #include "chrome/browser/browsing_data/browsing_data_service_worker_helper.h" |
25 #include "net/ssl/channel_id_store.h" | 26 #include "net/ssl/channel_id_store.h" |
26 | 27 |
(...skipping 14 matching lines...) Expand all Loading... |
41 LocalStorageInfoList; | 42 LocalStorageInfoList; |
42 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 43 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
43 SessionStorageInfoList; | 44 SessionStorageInfoList; |
44 typedef std::list<content::IndexedDBInfo> | 45 typedef std::list<content::IndexedDBInfo> |
45 IndexedDBInfoList; | 46 IndexedDBInfoList; |
46 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo> | 47 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo> |
47 FileSystemInfoList; | 48 FileSystemInfoList; |
48 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoList; | 49 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoList; |
49 typedef net::ChannelIDStore::ChannelIDList ChannelIDList; | 50 typedef net::ChannelIDStore::ChannelIDList ChannelIDList; |
50 typedef std::list<content::ServiceWorkerUsageInfo> ServiceWorkerUsageInfoList; | 51 typedef std::list<content::ServiceWorkerUsageInfo> ServiceWorkerUsageInfoList; |
| 52 typedef std::list<content::CacheStorageUsageInfo> CacheStorageUsageInfoList; |
51 typedef std::map<GURL, std::list<content::AppCacheInfo> > AppCacheInfoMap; | 53 typedef std::map<GURL, std::list<content::AppCacheInfo> > AppCacheInfoMap; |
52 typedef std::vector<std::string> FlashLSODomainList; | 54 typedef std::vector<std::string> FlashLSODomainList; |
53 | 55 |
54 } // namespace | 56 } // namespace |
55 | 57 |
56 // LocalDataContainer --------------------------------------------------------- | 58 // LocalDataContainer --------------------------------------------------------- |
57 // This class is a wrapper around all the BrowsingData*Helper classes. Because | 59 // This class is a wrapper around all the BrowsingData*Helper classes. Because |
58 // isolated applications have separate storage, we need different helper | 60 // isolated applications have separate storage, we need different helper |
59 // instances. As such, this class contains the app name and id, along with the | 61 // instances. As such, this class contains the app name and id, along with the |
60 // helpers for all of the data types we need. The browser-wide "app id" will be | 62 // helpers for all of the data types we need. The browser-wide "app id" will be |
61 // the empty string, as no app can have an empty id. | 63 // the empty string, as no app can have an empty id. |
62 class LocalDataContainer { | 64 class LocalDataContainer { |
63 public: | 65 public: |
64 LocalDataContainer( | 66 LocalDataContainer(BrowsingDataCookieHelper* cookie_helper, |
65 BrowsingDataCookieHelper* cookie_helper, | 67 BrowsingDataDatabaseHelper* database_helper, |
66 BrowsingDataDatabaseHelper* database_helper, | 68 BrowsingDataLocalStorageHelper* local_storage_helper, |
67 BrowsingDataLocalStorageHelper* local_storage_helper, | 69 BrowsingDataLocalStorageHelper* session_storage_helper, |
68 BrowsingDataLocalStorageHelper* session_storage_helper, | 70 BrowsingDataAppCacheHelper* appcache_helper, |
69 BrowsingDataAppCacheHelper* appcache_helper, | 71 BrowsingDataIndexedDBHelper* indexed_db_helper, |
70 BrowsingDataIndexedDBHelper* indexed_db_helper, | 72 BrowsingDataFileSystemHelper* file_system_helper, |
71 BrowsingDataFileSystemHelper* file_system_helper, | 73 BrowsingDataQuotaHelper* quota_helper, |
72 BrowsingDataQuotaHelper* quota_helper, | 74 BrowsingDataChannelIDHelper* channel_id_helper, |
73 BrowsingDataChannelIDHelper* channel_id_helper, | 75 BrowsingDataServiceWorkerHelper* service_worker_helper, |
74 BrowsingDataServiceWorkerHelper* service_worker_helper, | 76 BrowsingDataCacheStorageHelper* cache_storage_helper, |
75 BrowsingDataFlashLSOHelper* flash_data_helper); | 77 BrowsingDataFlashLSOHelper* flash_data_helper); |
76 virtual ~LocalDataContainer(); | 78 virtual ~LocalDataContainer(); |
77 | 79 |
78 // This method must be called to start the process of fetching the resources. | 80 // This method must be called to start the process of fetching the resources. |
79 // The delegate passed in is called back to deliver the updates. | 81 // The delegate passed in is called back to deliver the updates. |
80 void Init(CookiesTreeModel* delegate); | 82 void Init(CookiesTreeModel* delegate); |
81 | 83 |
82 private: | 84 private: |
83 friend class CookiesTreeModel; | 85 friend class CookiesTreeModel; |
84 friend class CookieTreeAppCacheNode; | 86 friend class CookieTreeAppCacheNode; |
85 friend class CookieTreeCookieNode; | 87 friend class CookieTreeCookieNode; |
86 friend class CookieTreeDatabaseNode; | 88 friend class CookieTreeDatabaseNode; |
87 friend class CookieTreeLocalStorageNode; | 89 friend class CookieTreeLocalStorageNode; |
88 friend class CookieTreeSessionStorageNode; | 90 friend class CookieTreeSessionStorageNode; |
89 friend class CookieTreeIndexedDBNode; | 91 friend class CookieTreeIndexedDBNode; |
90 friend class CookieTreeFileSystemNode; | 92 friend class CookieTreeFileSystemNode; |
91 friend class CookieTreeQuotaNode; | 93 friend class CookieTreeQuotaNode; |
92 friend class CookieTreeChannelIDNode; | 94 friend class CookieTreeChannelIDNode; |
93 friend class CookieTreeServiceWorkerNode; | 95 friend class CookieTreeServiceWorkerNode; |
| 96 friend class CookieTreeCacheStorageNode; |
94 friend class CookieTreeFlashLSONode; | 97 friend class CookieTreeFlashLSONode; |
95 | 98 |
96 // Callback methods to be invoked when fetching the data is complete. | 99 // Callback methods to be invoked when fetching the data is complete. |
97 void OnAppCacheModelInfoLoaded(); | 100 void OnAppCacheModelInfoLoaded(); |
98 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list); | 101 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list); |
99 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); | 102 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); |
100 void OnLocalStorageModelInfoLoaded( | 103 void OnLocalStorageModelInfoLoaded( |
101 const LocalStorageInfoList& local_storage_info); | 104 const LocalStorageInfoList& local_storage_info); |
102 void OnSessionStorageModelInfoLoaded( | 105 void OnSessionStorageModelInfoLoaded( |
103 const LocalStorageInfoList& local_storage_info); | 106 const LocalStorageInfoList& local_storage_info); |
104 void OnIndexedDBModelInfoLoaded( | 107 void OnIndexedDBModelInfoLoaded( |
105 const IndexedDBInfoList& indexed_db_info); | 108 const IndexedDBInfoList& indexed_db_info); |
106 void OnFileSystemModelInfoLoaded( | 109 void OnFileSystemModelInfoLoaded( |
107 const FileSystemInfoList& file_system_info); | 110 const FileSystemInfoList& file_system_info); |
108 void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info); | 111 void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info); |
109 void OnChannelIDModelInfoLoaded(const ChannelIDList& channel_id_list); | 112 void OnChannelIDModelInfoLoaded(const ChannelIDList& channel_id_list); |
110 void OnServiceWorkerModelInfoLoaded( | 113 void OnServiceWorkerModelInfoLoaded( |
111 const ServiceWorkerUsageInfoList& service_worker_info); | 114 const ServiceWorkerUsageInfoList& service_worker_info); |
| 115 void OnCacheStorageModelInfoLoaded( |
| 116 const CacheStorageUsageInfoList& cache_storage_info); |
112 void OnFlashLSOInfoLoaded(const FlashLSODomainList& domains); | 117 void OnFlashLSOInfoLoaded(const FlashLSODomainList& domains); |
113 | 118 |
114 // Pointers to the helper objects, needed to retreive all the types of locally | 119 // Pointers to the helper objects, needed to retreive all the types of locally |
115 // stored data. | 120 // stored data. |
116 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 121 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
117 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; | 122 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
118 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 123 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
119 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 124 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
120 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 125 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
121 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 126 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
122 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 127 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
123 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; | 128 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
124 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper_; | 129 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper_; |
125 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper_; | 130 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper_; |
| 131 scoped_refptr<BrowsingDataCacheStorageHelper> cache_storage_helper_; |
126 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; | 132 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; |
127 | 133 |
128 // Storage for all the data that was retrieved through the helper objects. | 134 // Storage for all the data that was retrieved through the helper objects. |
129 // The collected data is used for (re)creating the CookiesTreeModel. | 135 // The collected data is used for (re)creating the CookiesTreeModel. |
130 AppCacheInfoMap appcache_info_; | 136 AppCacheInfoMap appcache_info_; |
131 CookieList cookie_list_; | 137 CookieList cookie_list_; |
132 DatabaseInfoList database_info_list_; | 138 DatabaseInfoList database_info_list_; |
133 LocalStorageInfoList local_storage_info_list_; | 139 LocalStorageInfoList local_storage_info_list_; |
134 LocalStorageInfoList session_storage_info_list_; | 140 LocalStorageInfoList session_storage_info_list_; |
135 IndexedDBInfoList indexed_db_info_list_; | 141 IndexedDBInfoList indexed_db_info_list_; |
136 FileSystemInfoList file_system_info_list_; | 142 FileSystemInfoList file_system_info_list_; |
137 QuotaInfoList quota_info_list_; | 143 QuotaInfoList quota_info_list_; |
138 ChannelIDList channel_id_list_; | 144 ChannelIDList channel_id_list_; |
139 ServiceWorkerUsageInfoList service_worker_info_list_; | 145 ServiceWorkerUsageInfoList service_worker_info_list_; |
| 146 CacheStorageUsageInfoList cache_storage_info_list_; |
140 FlashLSODomainList flash_lso_domain_list_; | 147 FlashLSODomainList flash_lso_domain_list_; |
141 | 148 |
142 // A delegate, which must outlive this object. The update callbacks use the | 149 // A delegate, which must outlive this object. The update callbacks use the |
143 // delegate to deliver the updated data to the CookieTreeModel. | 150 // delegate to deliver the updated data to the CookieTreeModel. |
144 CookiesTreeModel* model_ = nullptr; | 151 CookiesTreeModel* model_ = nullptr; |
145 | 152 |
146 // Keeps track of how many batches are expected to start. | 153 // Keeps track of how many batches are expected to start. |
147 int batches_started_ = 0; | 154 int batches_started_ = 0; |
148 | 155 |
149 base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_; | 156 base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_; |
150 | 157 |
151 DISALLOW_COPY_AND_ASSIGN(LocalDataContainer); | 158 DISALLOW_COPY_AND_ASSIGN(LocalDataContainer); |
152 }; | 159 }; |
153 | 160 |
154 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ | 161 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ |
OLD | NEW |