| 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( | 70 LocalDataContainer( |
| 68 scoped_refptr<BrowsingDataCookieHelper> cookie_helper, | 71 scoped_refptr<BrowsingDataCookieHelper> cookie_helper, |
| 69 scoped_refptr<BrowsingDataDatabaseHelper> database_helper, | 72 scoped_refptr<BrowsingDataDatabaseHelper> database_helper, |
| 70 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper, | 73 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper, |
| 71 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper, | 74 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper, |
| 72 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper, | 75 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper, |
| 73 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper, | 76 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper, |
| 74 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper, | 77 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper, |
| 75 scoped_refptr<BrowsingDataQuotaHelper> quota_helper, | 78 scoped_refptr<BrowsingDataQuotaHelper> quota_helper, |
| 76 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper, | 79 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper, |
| 77 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper, | 80 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper, |
| 78 scoped_refptr<BrowsingDataCacheStorageHelper> cache_storage_helper, | 81 scoped_refptr<BrowsingDataCacheStorageHelper> cache_storage_helper, |
| 79 scoped_refptr<BrowsingDataFlashLSOHelper> flash_data_helper); | 82 scoped_refptr<BrowsingDataFlashLSOHelper> flash_data_helper, |
| 83 scoped_refptr<BrowsingDataMediaLicenseHelper> media_license_helper); |
| 80 virtual ~LocalDataContainer(); | 84 virtual ~LocalDataContainer(); |
| 81 | 85 |
| 82 // This method must be called to start the process of fetching the resources. | 86 // This method must be called to start the process of fetching the resources. |
| 83 // The delegate passed in is called back to deliver the updates. | 87 // The delegate passed in is called back to deliver the updates. |
| 84 void Init(CookiesTreeModel* delegate); | 88 void Init(CookiesTreeModel* delegate); |
| 85 | 89 |
| 86 private: | 90 private: |
| 87 friend class CookiesTreeModel; | 91 friend class CookiesTreeModel; |
| 88 friend class CookieTreeAppCacheNode; | 92 friend class CookieTreeAppCacheNode; |
| 93 friend class CookieTreeMediaLicenseNode; |
| 89 friend class CookieTreeCookieNode; | 94 friend class CookieTreeCookieNode; |
| 90 friend class CookieTreeDatabaseNode; | 95 friend class CookieTreeDatabaseNode; |
| 91 friend class CookieTreeLocalStorageNode; | 96 friend class CookieTreeLocalStorageNode; |
| 92 friend class CookieTreeSessionStorageNode; | 97 friend class CookieTreeSessionStorageNode; |
| 93 friend class CookieTreeIndexedDBNode; | 98 friend class CookieTreeIndexedDBNode; |
| 94 friend class CookieTreeFileSystemNode; | 99 friend class CookieTreeFileSystemNode; |
| 95 friend class CookieTreeQuotaNode; | 100 friend class CookieTreeQuotaNode; |
| 96 friend class CookieTreeChannelIDNode; | 101 friend class CookieTreeChannelIDNode; |
| 97 friend class CookieTreeServiceWorkerNode; | 102 friend class CookieTreeServiceWorkerNode; |
| 98 friend class CookieTreeCacheStorageNode; | 103 friend class CookieTreeCacheStorageNode; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 111 const IndexedDBInfoList& indexed_db_info); | 116 const IndexedDBInfoList& indexed_db_info); |
| 112 void OnFileSystemModelInfoLoaded( | 117 void OnFileSystemModelInfoLoaded( |
| 113 const FileSystemInfoList& file_system_info); | 118 const FileSystemInfoList& file_system_info); |
| 114 void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info); | 119 void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info); |
| 115 void OnChannelIDModelInfoLoaded(const ChannelIDList& channel_id_list); | 120 void OnChannelIDModelInfoLoaded(const ChannelIDList& channel_id_list); |
| 116 void OnServiceWorkerModelInfoLoaded( | 121 void OnServiceWorkerModelInfoLoaded( |
| 117 const ServiceWorkerUsageInfoList& service_worker_info); | 122 const ServiceWorkerUsageInfoList& service_worker_info); |
| 118 void OnCacheStorageModelInfoLoaded( | 123 void OnCacheStorageModelInfoLoaded( |
| 119 const CacheStorageUsageInfoList& cache_storage_info); | 124 const CacheStorageUsageInfoList& cache_storage_info); |
| 120 void OnFlashLSOInfoLoaded(const FlashLSODomainList& domains); | 125 void OnFlashLSOInfoLoaded(const FlashLSODomainList& domains); |
| 126 void OnMediaLicenseInfoLoaded(const MediaLicenseInfoList& media_license_info); |
| 121 | 127 |
| 122 // Pointers to the helper objects, needed to retreive all the types of locally | 128 // Pointers to the helper objects, needed to retreive all the types of locally |
| 123 // stored data. | 129 // stored data. |
| 124 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 130 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
| 125 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; | 131 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
| 126 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 132 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
| 127 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 133 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
| 128 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 134 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
| 129 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 135 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
| 130 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 136 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
| 131 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; | 137 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
| 132 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper_; | 138 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper_; |
| 133 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper_; | 139 scoped_refptr<BrowsingDataServiceWorkerHelper> service_worker_helper_; |
| 134 scoped_refptr<BrowsingDataCacheStorageHelper> cache_storage_helper_; | 140 scoped_refptr<BrowsingDataCacheStorageHelper> cache_storage_helper_; |
| 135 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; | 141 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; |
| 142 scoped_refptr<BrowsingDataMediaLicenseHelper> media_license_helper_; |
| 136 | 143 |
| 137 // Storage for all the data that was retrieved through the helper objects. | 144 // Storage for all the data that was retrieved through the helper objects. |
| 138 // The collected data is used for (re)creating the CookiesTreeModel. | 145 // The collected data is used for (re)creating the CookiesTreeModel. |
| 139 AppCacheInfoMap appcache_info_; | 146 AppCacheInfoMap appcache_info_; |
| 140 CookieList cookie_list_; | 147 CookieList cookie_list_; |
| 141 DatabaseInfoList database_info_list_; | 148 DatabaseInfoList database_info_list_; |
| 142 LocalStorageInfoList local_storage_info_list_; | 149 LocalStorageInfoList local_storage_info_list_; |
| 143 LocalStorageInfoList session_storage_info_list_; | 150 LocalStorageInfoList session_storage_info_list_; |
| 144 IndexedDBInfoList indexed_db_info_list_; | 151 IndexedDBInfoList indexed_db_info_list_; |
| 145 FileSystemInfoList file_system_info_list_; | 152 FileSystemInfoList file_system_info_list_; |
| 146 QuotaInfoList quota_info_list_; | 153 QuotaInfoList quota_info_list_; |
| 147 ChannelIDList channel_id_list_; | 154 ChannelIDList channel_id_list_; |
| 148 ServiceWorkerUsageInfoList service_worker_info_list_; | 155 ServiceWorkerUsageInfoList service_worker_info_list_; |
| 149 CacheStorageUsageInfoList cache_storage_info_list_; | 156 CacheStorageUsageInfoList cache_storage_info_list_; |
| 150 FlashLSODomainList flash_lso_domain_list_; | 157 FlashLSODomainList flash_lso_domain_list_; |
| 158 MediaLicenseInfoList media_license_info_list_; |
| 151 | 159 |
| 152 // A delegate, which must outlive this object. The update callbacks use the | 160 // A delegate, which must outlive this object. The update callbacks use the |
| 153 // delegate to deliver the updated data to the CookieTreeModel. | 161 // delegate to deliver the updated data to the CookieTreeModel. |
| 154 CookiesTreeModel* model_ = nullptr; | 162 CookiesTreeModel* model_ = nullptr; |
| 155 | 163 |
| 156 // Keeps track of how many batches are expected to start. | 164 // Keeps track of how many batches are expected to start. |
| 157 int batches_started_ = 0; | 165 int batches_started_ = 0; |
| 158 | 166 |
| 159 base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_; | 167 base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_; |
| 160 | 168 |
| 161 DISALLOW_COPY_AND_ASSIGN(LocalDataContainer); | 169 DISALLOW_COPY_AND_ASSIGN(LocalDataContainer); |
| 162 }; | 170 }; |
| 163 | 171 |
| 164 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ | 172 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ |
| OLD | NEW |