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