| 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_channel_id_helper.h" |
| 17 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" | 18 #include "chrome/browser/browsing_data/browsing_data_cookie_helper.h" |
| 18 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 19 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
| 19 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_file_system_helper.h" |
| 20 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" | 21 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h" |
| 21 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
| 22 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" |
| 23 #include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h" | 24 #include "net/ssl/channel_id_store.h" |
| 24 #include "net/ssl/server_bound_cert_store.h" | |
| 25 | 25 |
| 26 class BrowsingDataFlashLSOHelper; | 26 class BrowsingDataFlashLSOHelper; |
| 27 class CookiesTreeModel; | 27 class CookiesTreeModel; |
| 28 class LocalDataContainer; | 28 class LocalDataContainer; |
| 29 | 29 |
| 30 namespace net { | 30 namespace net { |
| 31 class CanonicalCookie; | 31 class CanonicalCookie; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Friendly typedefs for the multiple types of lists used in the model. | 34 // Friendly typedefs for the multiple types of lists used in the model. |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 typedef std::list<net::CanonicalCookie> CookieList; | 37 typedef std::list<net::CanonicalCookie> CookieList; |
| 38 typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo> DatabaseInfoList; | 38 typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo> DatabaseInfoList; |
| 39 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 39 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 40 LocalStorageInfoList; | 40 LocalStorageInfoList; |
| 41 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 41 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 42 SessionStorageInfoList; | 42 SessionStorageInfoList; |
| 43 typedef std::list<content::IndexedDBInfo> | 43 typedef std::list<content::IndexedDBInfo> |
| 44 IndexedDBInfoList; | 44 IndexedDBInfoList; |
| 45 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo> | 45 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo> |
| 46 FileSystemInfoList; | 46 FileSystemInfoList; |
| 47 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoList; | 47 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoList; |
| 48 typedef net::ServerBoundCertStore::ServerBoundCertList ServerBoundCertList; | 48 typedef net::ChannelIDStore::ChannelIDList ChannelIDList; |
| 49 typedef std::map<GURL, std::list<content::AppCacheInfo> > AppCacheInfoMap; | 49 typedef std::map<GURL, std::list<content::AppCacheInfo> > AppCacheInfoMap; |
| 50 typedef std::vector<std::string> FlashLSODomainList; | 50 typedef std::vector<std::string> FlashLSODomainList; |
| 51 | 51 |
| 52 } // namespace | 52 } // namespace |
| 53 | 53 |
| 54 // LocalDataContainer --------------------------------------------------------- | 54 // LocalDataContainer --------------------------------------------------------- |
| 55 // This class is a wrapper around all the BrowsingData*Helper classes. Because | 55 // This class is a wrapper around all the BrowsingData*Helper classes. Because |
| 56 // isolated applications have separate storage, we need different helper | 56 // isolated applications have separate storage, we need different helper |
| 57 // instances. As such, this class contains the app name and id, along with the | 57 // instances. As such, this class contains the app name and id, along with the |
| 58 // helpers for all of the data types we need. The browser-wide "app id" will be | 58 // helpers for all of the data types we need. The browser-wide "app id" will be |
| 59 // the empty string, as no app can have an empty id. | 59 // the empty string, as no app can have an empty id. |
| 60 class LocalDataContainer { | 60 class LocalDataContainer { |
| 61 public: | 61 public: |
| 62 LocalDataContainer( | 62 LocalDataContainer( |
| 63 BrowsingDataCookieHelper* cookie_helper, | 63 BrowsingDataCookieHelper* cookie_helper, |
| 64 BrowsingDataDatabaseHelper* database_helper, | 64 BrowsingDataDatabaseHelper* database_helper, |
| 65 BrowsingDataLocalStorageHelper* local_storage_helper, | 65 BrowsingDataLocalStorageHelper* local_storage_helper, |
| 66 BrowsingDataLocalStorageHelper* session_storage_helper, | 66 BrowsingDataLocalStorageHelper* session_storage_helper, |
| 67 BrowsingDataAppCacheHelper* appcache_helper, | 67 BrowsingDataAppCacheHelper* appcache_helper, |
| 68 BrowsingDataIndexedDBHelper* indexed_db_helper, | 68 BrowsingDataIndexedDBHelper* indexed_db_helper, |
| 69 BrowsingDataFileSystemHelper* file_system_helper, | 69 BrowsingDataFileSystemHelper* file_system_helper, |
| 70 BrowsingDataQuotaHelper* quota_helper, | 70 BrowsingDataQuotaHelper* quota_helper, |
| 71 BrowsingDataServerBoundCertHelper* server_bound_cert_helper, | 71 BrowsingDataChannelIDHelper* channel_id_helper, |
| 72 BrowsingDataFlashLSOHelper* flash_data_helper); | 72 BrowsingDataFlashLSOHelper* flash_data_helper); |
| 73 virtual ~LocalDataContainer(); | 73 virtual ~LocalDataContainer(); |
| 74 | 74 |
| 75 // This method must be called to start the process of fetching the resources. | 75 // This method must be called to start the process of fetching the resources. |
| 76 // The delegate passed in is called back to deliver the updates. | 76 // The delegate passed in is called back to deliver the updates. |
| 77 void Init(CookiesTreeModel* delegate); | 77 void Init(CookiesTreeModel* delegate); |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 friend class CookiesTreeModel; | 80 friend class CookiesTreeModel; |
| 81 friend class CookieTreeAppCacheNode; | 81 friend class CookieTreeAppCacheNode; |
| 82 friend class CookieTreeCookieNode; | 82 friend class CookieTreeCookieNode; |
| 83 friend class CookieTreeDatabaseNode; | 83 friend class CookieTreeDatabaseNode; |
| 84 friend class CookieTreeLocalStorageNode; | 84 friend class CookieTreeLocalStorageNode; |
| 85 friend class CookieTreeSessionStorageNode; | 85 friend class CookieTreeSessionStorageNode; |
| 86 friend class CookieTreeIndexedDBNode; | 86 friend class CookieTreeIndexedDBNode; |
| 87 friend class CookieTreeFileSystemNode; | 87 friend class CookieTreeFileSystemNode; |
| 88 friend class CookieTreeQuotaNode; | 88 friend class CookieTreeQuotaNode; |
| 89 friend class CookieTreeServerBoundCertNode; | 89 friend class CookieTreeChannelIDNode; |
| 90 friend class CookieTreeFlashLSONode; | 90 friend class CookieTreeFlashLSONode; |
| 91 | 91 |
| 92 // Callback methods to be invoked when fetching the data is complete. | 92 // Callback methods to be invoked when fetching the data is complete. |
| 93 void OnAppCacheModelInfoLoaded(); | 93 void OnAppCacheModelInfoLoaded(); |
| 94 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list); | 94 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list); |
| 95 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); | 95 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); |
| 96 void OnLocalStorageModelInfoLoaded( | 96 void OnLocalStorageModelInfoLoaded( |
| 97 const LocalStorageInfoList& local_storage_info); | 97 const LocalStorageInfoList& local_storage_info); |
| 98 void OnSessionStorageModelInfoLoaded( | 98 void OnSessionStorageModelInfoLoaded( |
| 99 const LocalStorageInfoList& local_storage_info); | 99 const LocalStorageInfoList& local_storage_info); |
| 100 void OnIndexedDBModelInfoLoaded( | 100 void OnIndexedDBModelInfoLoaded( |
| 101 const IndexedDBInfoList& indexed_db_info); | 101 const IndexedDBInfoList& indexed_db_info); |
| 102 void OnFileSystemModelInfoLoaded( | 102 void OnFileSystemModelInfoLoaded( |
| 103 const FileSystemInfoList& file_system_info); | 103 const FileSystemInfoList& file_system_info); |
| 104 void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info); | 104 void OnQuotaModelInfoLoaded(const QuotaInfoList& quota_info); |
| 105 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list); | 105 void OnChannelIDModelInfoLoaded(const ChannelIDList& channel_id_list); |
| 106 void OnFlashLSOInfoLoaded(const FlashLSODomainList& domains); | 106 void OnFlashLSOInfoLoaded(const FlashLSODomainList& domains); |
| 107 | 107 |
| 108 // Pointers to the helper objects, needed to retreive all the types of locally | 108 // Pointers to the helper objects, needed to retreive all the types of locally |
| 109 // stored data. | 109 // stored data. |
| 110 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 110 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
| 111 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; | 111 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
| 112 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 112 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
| 113 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 113 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
| 114 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 114 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
| 115 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 115 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
| 116 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 116 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
| 117 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; | 117 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
| 118 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_; | 118 scoped_refptr<BrowsingDataChannelIDHelper> channel_id_helper_; |
| 119 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; | 119 scoped_refptr<BrowsingDataFlashLSOHelper> flash_lso_helper_; |
| 120 | 120 |
| 121 // Storage for all the data that was retrieved through the helper objects. | 121 // Storage for all the data that was retrieved through the helper objects. |
| 122 // The collected data is used for (re)creating the CookiesTreeModel. | 122 // The collected data is used for (re)creating the CookiesTreeModel. |
| 123 AppCacheInfoMap appcache_info_; | 123 AppCacheInfoMap appcache_info_; |
| 124 CookieList cookie_list_; | 124 CookieList cookie_list_; |
| 125 DatabaseInfoList database_info_list_; | 125 DatabaseInfoList database_info_list_; |
| 126 LocalStorageInfoList local_storage_info_list_; | 126 LocalStorageInfoList local_storage_info_list_; |
| 127 LocalStorageInfoList session_storage_info_list_; | 127 LocalStorageInfoList session_storage_info_list_; |
| 128 IndexedDBInfoList indexed_db_info_list_; | 128 IndexedDBInfoList indexed_db_info_list_; |
| 129 FileSystemInfoList file_system_info_list_; | 129 FileSystemInfoList file_system_info_list_; |
| 130 QuotaInfoList quota_info_list_; | 130 QuotaInfoList quota_info_list_; |
| 131 ServerBoundCertList server_bound_cert_list_; | 131 ChannelIDList channel_id_list_; |
| 132 FlashLSODomainList flash_lso_domain_list_; | 132 FlashLSODomainList flash_lso_domain_list_; |
| 133 | 133 |
| 134 // A delegate, which must outlive this object. The update callbacks use the | 134 // A delegate, which must outlive this object. The update callbacks use the |
| 135 // delegate to deliver the updated data to the CookieTreeModel. | 135 // delegate to deliver the updated data to the CookieTreeModel. |
| 136 CookiesTreeModel* model_; | 136 CookiesTreeModel* model_; |
| 137 | 137 |
| 138 base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_; | 138 base::WeakPtrFactory<LocalDataContainer> weak_ptr_factory_; |
| 139 | 139 |
| 140 DISALLOW_COPY_AND_ASSIGN(LocalDataContainer); | 140 DISALLOW_COPY_AND_ASSIGN(LocalDataContainer); |
| 141 }; | 141 }; |
| 142 | 142 |
| 143 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ | 143 #endif // CHROME_BROWSER_BROWSING_DATA_LOCAL_DATA_CONTAINER_H_ |
| OLD | NEW |