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