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_COOKIES_TREE_MODEL_H_ | 5 #ifndef CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
6 #define CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 6 #define CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 // TODO(viettrungluu): This header file #includes far too much and has too much | 9 // TODO(viettrungluu): This header file #includes far too much and has too much |
10 // inline code (which shouldn't be inline). | 10 // inline code (which shouldn't be inline). |
11 | 11 |
12 #include <list> | 12 #include <list> |
13 #include <string> | 13 #include <string> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
19 #include "base/string16.h" | 19 #include "base/string16.h" |
20 #include "base/utf_string_conversions.h" | 20 #include "base/utf_string_conversions.h" |
21 #include "chrome/browser/browsing_data_appcache_helper.h" | 21 #include "chrome/browser/browsing_data_appcache_helper.h" |
22 #include "chrome/browser/browsing_data_database_helper.h" | 22 #include "chrome/browser/browsing_data_database_helper.h" |
23 #include "chrome/browser/browsing_data_file_system_helper.h" | 23 #include "chrome/browser/browsing_data_file_system_helper.h" |
24 #include "chrome/browser/browsing_data_indexed_db_helper.h" | 24 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
25 #include "chrome/browser/browsing_data_local_storage_helper.h" | 25 #include "chrome/browser/browsing_data_local_storage_helper.h" |
26 #include "chrome/browser/browsing_data_quota_helper.h" | 26 #include "chrome/browser/browsing_data_quota_helper.h" |
27 #include "chrome/common/content_settings.h" | 27 #include "chrome/common/content_settings.h" |
| 28 #include "chrome/common/extensions/extension_set.h" |
28 #include "net/base/server_bound_cert_store.h" | 29 #include "net/base/server_bound_cert_store.h" |
29 #include "net/cookies/cookie_monster.h" | 30 #include "net/cookies/cookie_monster.h" |
30 #include "ui/base/models/tree_node_model.h" | 31 #include "ui/base/models/tree_node_model.h" |
31 | 32 |
32 class BrowsingDataCookieHelper; | 33 class BrowsingDataCookieHelper; |
33 class BrowsingDataServerBoundCertHelper; | 34 class BrowsingDataServerBoundCertHelper; |
34 class CookieSettings; | 35 class CookieSettings; |
35 class CookiesTreeModel; | 36 class CookiesTreeModel; |
36 class CookieTreeAppCacheNode; | 37 class CookieTreeAppCacheNode; |
37 class CookieTreeAppCachesNode; | 38 class CookieTreeAppCachesNode; |
38 class CookieTreeCookieNode; | 39 class CookieTreeCookieNode; |
39 class CookieTreeCookiesNode; | 40 class CookieTreeCookiesNode; |
40 class CookieTreeDatabaseNode; | 41 class CookieTreeDatabaseNode; |
41 class CookieTreeDatabasesNode; | 42 class CookieTreeDatabasesNode; |
42 class CookieTreeFileSystemsNode; | 43 class CookieTreeFileSystemsNode; |
43 class CookieTreeFileSystemNode; | 44 class CookieTreeFileSystemNode; |
44 class CookieTreeLocalStorageNode; | 45 class CookieTreeLocalStorageNode; |
45 class CookieTreeLocalStoragesNode; | 46 class CookieTreeLocalStoragesNode; |
46 class CookieTreeServerBoundCertNode; | 47 class CookieTreeServerBoundCertNode; |
47 class CookieTreeServerBoundCertsNode; | 48 class CookieTreeServerBoundCertsNode; |
48 class CookieTreeQuotaNode; | 49 class CookieTreeQuotaNode; |
49 class CookieTreeSessionStorageNode; | 50 class CookieTreeSessionStorageNode; |
50 class CookieTreeSessionStoragesNode; | 51 class CookieTreeSessionStoragesNode; |
51 class CookieTreeIndexedDBNode; | 52 class CookieTreeIndexedDBNode; |
52 class CookieTreeIndexedDBsNode; | 53 class CookieTreeIndexedDBsNode; |
53 class CookieTreeOriginNode; | 54 class CookieTreeHostNode; |
| 55 class ExtensionSpecialStoragePolicy; |
54 | 56 |
55 // CookieTreeNode ------------------------------------------------------------- | 57 // CookieTreeNode ------------------------------------------------------------- |
56 // The base node type in the Cookies, Databases, and Local Storage options | 58 // The base node type in the Cookies, Databases, and Local Storage options |
57 // view, from which all other types are derived. Specialized from TreeNode in | 59 // view, from which all other types are derived. Specialized from TreeNode in |
58 // that it has a notion of deleting objects stored in the profile, and being | 60 // that it has a notion of deleting objects stored in the profile, and being |
59 // able to have its children do the same. | 61 // able to have its children do the same. |
60 class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { | 62 class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { |
61 public: | 63 public: |
62 // Used to pull out information for the InfoView (the details display below | 64 // Used to pull out information for the InfoView (the details display below |
63 // the tree control.) | 65 // the tree control.) |
64 struct DetailedInfo { | 66 struct DetailedInfo { |
65 // NodeType corresponds to the various CookieTreeNode types. | 67 // NodeType corresponds to the various CookieTreeNode types. |
66 enum NodeType { | 68 enum NodeType { |
67 TYPE_NONE, | 69 TYPE_NONE, |
68 TYPE_ROOT, // This is used for CookieTreeRootNode nodes. | 70 TYPE_ROOT, // This is used for CookieTreeRootNode nodes. |
69 TYPE_ORIGIN, // This is used for CookieTreeOriginNode nodes. | 71 TYPE_HOST, // This is used for CookieTreeHostNode nodes. |
70 TYPE_COOKIES, // This is used for CookieTreeCookiesNode nodes. | 72 TYPE_COOKIES, // This is used for CookieTreeCookiesNode nodes. |
71 TYPE_COOKIE, // This is used for CookieTreeCookieNode nodes. | 73 TYPE_COOKIE, // This is used for CookieTreeCookieNode nodes. |
72 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. | 74 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. |
73 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. | 75 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. |
74 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. | 76 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. |
75 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. | 77 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. |
76 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. | 78 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. |
77 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. | 79 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. |
78 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. | 80 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. |
79 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. | 81 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. |
80 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. | 82 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. |
81 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. | 83 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. |
82 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. | 84 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. |
83 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. | 85 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. |
84 TYPE_QUOTA, // This is used for CookieTreeQuotaNode. | 86 TYPE_QUOTA, // This is used for CookieTreeQuotaNode. |
85 TYPE_SERVER_BOUND_CERTS, // Used for CookieTreeServerBoundCertsNode. | 87 TYPE_SERVER_BOUND_CERTS, // Used for CookieTreeServerBoundCertsNode. |
86 TYPE_SERVER_BOUND_CERT, // Used for CookieTreeServerBoundCertNode. | 88 TYPE_SERVER_BOUND_CERT, // Used for CookieTreeServerBoundCertNode. |
87 }; | 89 }; |
88 | 90 |
89 // TODO(viettrungluu): Figure out whether we want to store |origin| as a | 91 DetailedInfo(); |
90 // |string16| or a (UTF-8) |std::string|, and convert. | 92 ~DetailedInfo(); |
91 explicit DetailedInfo(const string16& origin) | |
92 : origin(origin), | |
93 node_type(TYPE_NONE), | |
94 cookie(NULL), | |
95 database_info(NULL), | |
96 local_storage_info(NULL), | |
97 session_storage_info(NULL), | |
98 appcache_info(NULL), | |
99 indexed_db_info(NULL), | |
100 file_system_info(NULL), | |
101 quota_info(NULL), | |
102 server_bound_cert(NULL) {} | |
103 | 93 |
104 DetailedInfo& Init(NodeType type) { | 94 DetailedInfo& Init(NodeType type); |
105 DCHECK_EQ(TYPE_NONE, node_type); | |
106 node_type = type; | |
107 return *this; | |
108 } | |
109 | |
110 DetailedInfo& InitCookie( | 95 DetailedInfo& InitCookie( |
111 const net::CookieMonster::CanonicalCookie* cookie) { | 96 const net::CookieMonster::CanonicalCookie* cookie); |
112 Init(TYPE_COOKIE); | |
113 this->cookie = cookie; | |
114 return *this; | |
115 } | |
116 | |
117 DetailedInfo& InitDatabase( | 97 DetailedInfo& InitDatabase( |
118 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) { | 98 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info); |
119 Init(TYPE_DATABASE); | |
120 this->database_info = database_info; | |
121 return *this; | |
122 } | |
123 | |
124 DetailedInfo& InitLocalStorage( | 99 DetailedInfo& InitLocalStorage( |
125 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 100 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
126 local_storage_info) { | 101 local_storage_info); |
127 Init(TYPE_LOCAL_STORAGE); | |
128 this->local_storage_info = local_storage_info; | |
129 return *this; | |
130 } | |
131 | |
132 DetailedInfo& InitSessionStorage( | 102 DetailedInfo& InitSessionStorage( |
133 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 103 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
134 session_storage_info) { | 104 session_storage_info); |
135 Init(TYPE_SESSION_STORAGE); | 105 DetailedInfo& InitAppCache(const GURL& origin, |
136 this->session_storage_info = session_storage_info; | 106 const appcache::AppCacheInfo* appcache_info); |
137 return *this; | 107 DetailedInfo& InitIndexedDB( |
138 } | 108 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info); |
| 109 DetailedInfo& InitFileSystem( |
| 110 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info); |
| 111 DetailedInfo& InitQuota( |
| 112 const BrowsingDataQuotaHelper::QuotaInfo* quota_info); |
| 113 DetailedInfo& InitServerBoundCert( |
| 114 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert); |
139 | 115 |
140 DetailedInfo& InitAppCache(const appcache::AppCacheInfo* appcache_info) { | |
141 Init(TYPE_APPCACHE); | |
142 this->appcache_info = appcache_info; | |
143 return *this; | |
144 } | |
145 | |
146 DetailedInfo& InitIndexedDB( | |
147 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info) { | |
148 Init(TYPE_INDEXED_DB); | |
149 this->indexed_db_info = indexed_db_info; | |
150 return *this; | |
151 } | |
152 | |
153 DetailedInfo& InitFileSystem( | |
154 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) { | |
155 Init(TYPE_FILE_SYSTEM); | |
156 this->file_system_info = file_system_info; | |
157 return *this; | |
158 } | |
159 | |
160 DetailedInfo& InitQuota( | |
161 const BrowsingDataQuotaHelper::QuotaInfo* quota_info) { | |
162 Init(TYPE_QUOTA); | |
163 this->quota_info = quota_info; | |
164 return *this; | |
165 } | |
166 | |
167 DetailedInfo& InitServerBoundCert( | |
168 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) { | |
169 Init(TYPE_SERVER_BOUND_CERT); | |
170 this->server_bound_cert = server_bound_cert; | |
171 return *this; | |
172 } | |
173 | |
174 string16 origin; | |
175 NodeType node_type; | 116 NodeType node_type; |
| 117 GURL origin; |
176 const net::CookieMonster::CanonicalCookie* cookie; | 118 const net::CookieMonster::CanonicalCookie* cookie; |
177 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; | 119 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; |
178 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; | 120 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; |
179 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 121 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
180 session_storage_info; | 122 session_storage_info; |
181 const appcache::AppCacheInfo* appcache_info; | 123 const appcache::AppCacheInfo* appcache_info; |
182 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; | 124 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; |
183 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; | 125 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; |
184 const BrowsingDataQuotaHelper::QuotaInfo* quota_info; | 126 const BrowsingDataQuotaHelper::QuotaInfo* quota_info; |
185 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert; | 127 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert; |
(...skipping 12 matching lines...) Expand all Loading... |
198 virtual CookiesTreeModel* GetModel() const; | 140 virtual CookiesTreeModel* GetModel() const; |
199 | 141 |
200 // Returns a struct with detailed information used to populate the details | 142 // Returns a struct with detailed information used to populate the details |
201 // part of the view. | 143 // part of the view. |
202 virtual DetailedInfo GetDetailedInfo() const = 0; | 144 virtual DetailedInfo GetDetailedInfo() const = 0; |
203 | 145 |
204 protected: | 146 protected: |
205 void AddChildSortedByTitle(CookieTreeNode* new_child); | 147 void AddChildSortedByTitle(CookieTreeNode* new_child); |
206 | 148 |
207 private: | 149 private: |
208 | |
209 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode); | 150 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode); |
210 }; | 151 }; |
211 | 152 |
212 // CookieTreeRootNode --------------------------------------------------------- | 153 // CookieTreeRootNode --------------------------------------------------------- |
213 // The node at the root of the CookieTree that gets inserted into the view. | 154 // The node at the root of the CookieTree that gets inserted into the view. |
214 class CookieTreeRootNode : public CookieTreeNode { | 155 class CookieTreeRootNode : public CookieTreeNode { |
215 public: | 156 public: |
216 explicit CookieTreeRootNode(CookiesTreeModel* model); | 157 explicit CookieTreeRootNode(CookiesTreeModel* model); |
217 virtual ~CookieTreeRootNode(); | 158 virtual ~CookieTreeRootNode(); |
218 | 159 |
219 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url); | 160 CookieTreeHostNode* GetOrCreateHostNode(const GURL& url); |
220 | 161 |
221 // CookieTreeNode methods: | 162 // CookieTreeNode methods: |
222 virtual CookiesTreeModel* GetModel() const OVERRIDE; | 163 virtual CookiesTreeModel* GetModel() const OVERRIDE; |
223 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; | 164 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; |
224 | 165 |
225 private: | 166 private: |
226 CookiesTreeModel* model_; | 167 CookiesTreeModel* model_; |
227 | 168 |
228 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode); | 169 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode); |
229 }; | 170 }; |
230 | 171 |
231 // CookieTreeOriginNode ------------------------------------------------------- | 172 // CookieTreeHostNode ------------------------------------------------------- |
232 class CookieTreeOriginNode : public CookieTreeNode { | 173 class CookieTreeHostNode : public CookieTreeNode { |
233 public: | 174 public: |
234 // Returns the origin node's title to use for a given URL. | 175 // Returns the host node's title to use for a given URL. |
235 static std::wstring TitleForUrl(const GURL& url); | 176 static string16 TitleForUrl(const GURL& url); |
236 | 177 |
237 explicit CookieTreeOriginNode(const GURL& url); | 178 explicit CookieTreeHostNode(const GURL& url); |
238 virtual ~CookieTreeOriginNode(); | 179 virtual ~CookieTreeHostNode(); |
239 | 180 |
240 // CookieTreeNode methods: | 181 // CookieTreeNode methods: |
241 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; | 182 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; |
242 | 183 |
243 // CookieTreeOriginNode methods: | 184 // CookieTreeHostNode methods: |
244 CookieTreeCookiesNode* GetOrCreateCookiesNode(); | 185 CookieTreeCookiesNode* GetOrCreateCookiesNode(); |
245 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); | 186 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); |
246 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); | 187 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); |
247 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); | 188 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); |
248 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); | 189 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); |
249 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); | 190 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); |
250 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); | 191 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); |
251 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode(); | 192 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode(); |
252 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( | 193 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( |
253 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); | 194 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); |
(...skipping 18 matching lines...) Expand all Loading... |
272 CookieTreeSessionStoragesNode* session_storages_child_; | 213 CookieTreeSessionStoragesNode* session_storages_child_; |
273 CookieTreeAppCachesNode* appcaches_child_; | 214 CookieTreeAppCachesNode* appcaches_child_; |
274 CookieTreeIndexedDBsNode* indexed_dbs_child_; | 215 CookieTreeIndexedDBsNode* indexed_dbs_child_; |
275 CookieTreeFileSystemsNode* file_systems_child_; | 216 CookieTreeFileSystemsNode* file_systems_child_; |
276 CookieTreeQuotaNode* quota_child_; | 217 CookieTreeQuotaNode* quota_child_; |
277 CookieTreeServerBoundCertsNode* server_bound_certs_child_; | 218 CookieTreeServerBoundCertsNode* server_bound_certs_child_; |
278 | 219 |
279 // The URL for which this node was initially created. | 220 // The URL for which this node was initially created. |
280 GURL url_; | 221 GURL url_; |
281 | 222 |
282 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); | 223 DISALLOW_COPY_AND_ASSIGN(CookieTreeHostNode); |
283 }; | 224 }; |
284 | 225 |
285 // CookieTreeCookieNode ------------------------------------------------------ | 226 // CookieTreeCookieNode ------------------------------------------------------ |
286 class CookieTreeCookieNode : public CookieTreeNode { | 227 class CookieTreeCookieNode : public CookieTreeNode { |
287 public: | 228 public: |
288 friend class CookieTreeCookiesNode; | 229 friend class CookieTreeCookiesNode; |
289 | 230 |
290 // The cookie should remain valid at least as long as the | 231 // The cookie should remain valid at least as long as the |
291 // CookieTreeCookieNode is valid. | 232 // CookieTreeCookieNode is valid. |
292 explicit CookieTreeCookieNode( | 233 explicit CookieTreeCookieNode( |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 CookiesTreeModel( | 567 CookiesTreeModel( |
627 BrowsingDataCookieHelper* cookie_helper, | 568 BrowsingDataCookieHelper* cookie_helper, |
628 BrowsingDataDatabaseHelper* database_helper, | 569 BrowsingDataDatabaseHelper* database_helper, |
629 BrowsingDataLocalStorageHelper* local_storage_helper, | 570 BrowsingDataLocalStorageHelper* local_storage_helper, |
630 BrowsingDataLocalStorageHelper* session_storage_helper, | 571 BrowsingDataLocalStorageHelper* session_storage_helper, |
631 BrowsingDataAppCacheHelper* appcache_helper, | 572 BrowsingDataAppCacheHelper* appcache_helper, |
632 BrowsingDataIndexedDBHelper* indexed_db_helper, | 573 BrowsingDataIndexedDBHelper* indexed_db_helper, |
633 BrowsingDataFileSystemHelper* file_system_helper, | 574 BrowsingDataFileSystemHelper* file_system_helper, |
634 BrowsingDataQuotaHelper* quota_helper, | 575 BrowsingDataQuotaHelper* quota_helper, |
635 BrowsingDataServerBoundCertHelper* server_bound_cert_helper, | 576 BrowsingDataServerBoundCertHelper* server_bound_cert_helper, |
| 577 ExtensionSpecialStoragePolicy* special_storage_policy, |
636 bool use_cookie_source); | 578 bool use_cookie_source); |
637 virtual ~CookiesTreeModel(); | 579 virtual ~CookiesTreeModel(); |
638 | 580 |
639 // ui::TreeModel methods: | 581 // ui::TreeModel methods: |
640 // Returns the set of icons for the nodes in the tree. You only need override | 582 // Returns the set of icons for the nodes in the tree. You only need override |
641 // this if you don't want to use the default folder icons. | 583 // this if you don't want to use the default folder icons. |
642 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; | 584 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; |
643 | 585 |
644 // Returns the index of the icon to use for |node|. Return -1 to use the | 586 // Returns the index of the icon to use for |node|. Return -1 to use the |
645 // default icon. The index is relative to the list of icons returned from | 587 // default icon. The index is relative to the list of icons returned from |
646 // GetIcons. | 588 // GetIcons. |
647 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; | 589 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; |
648 | 590 |
649 // CookiesTreeModel methods: | 591 // CookiesTreeModel methods: |
650 void DeleteAllStoredObjects(); | 592 void DeleteAllStoredObjects(); |
651 void DeleteCookieNode(CookieTreeNode* cookie_node); | 593 void DeleteCookieNode(CookieTreeNode* cookie_node); |
652 | 594 |
653 // Filter the origins to only display matched results. | 595 // Filter the origins to only display matched results. |
654 void UpdateSearchResults(const std::wstring& filter); | 596 void UpdateSearchResults(const string16& filter); |
| 597 |
| 598 // Returns the set of extensions which protect the data item represented by |
| 599 // this node from deletion. |
| 600 // Returns NULL if the node doesn't represent a protected data item or the |
| 601 // special storage policy is NULL. |
| 602 const ExtensionSet* ExtensionsProtectingNode( |
| 603 const CookieTreeNode& cookie_node); |
655 | 604 |
656 // Manages CookiesTreeModel::Observers. This will also call | 605 // Manages CookiesTreeModel::Observers. This will also call |
657 // TreeNodeModel::AddObserver so that it gets all the proper notifications. | 606 // TreeNodeModel::AddObserver so that it gets all the proper notifications. |
658 // Note that the converse is not true: simply adding a TreeModelObserver will | 607 // Note that the converse is not true: simply adding a TreeModelObserver will |
659 // not get CookiesTreeModel::Observer notifications. | 608 // not get CookiesTreeModel::Observer notifications. |
660 virtual void AddCookiesTreeObserver(Observer* observer); | 609 virtual void AddCookiesTreeObserver(Observer* observer); |
661 virtual void RemoveCookiesTreeObserver(Observer* observer); | 610 virtual void RemoveCookiesTreeObserver(Observer* observer); |
662 | 611 |
663 private: | 612 private: |
664 enum CookieIconIndex { | 613 enum CookieIconIndex { |
(...skipping 22 matching lines...) Expand all Loading... |
687 const LocalStorageInfoList& local_storage_info); | 636 const LocalStorageInfoList& local_storage_info); |
688 void OnSessionStorageModelInfoLoaded( | 637 void OnSessionStorageModelInfoLoaded( |
689 const LocalStorageInfoList& local_storage_info); | 638 const LocalStorageInfoList& local_storage_info); |
690 void OnIndexedDBModelInfoLoaded( | 639 void OnIndexedDBModelInfoLoaded( |
691 const IndexedDBInfoList& indexed_db_info); | 640 const IndexedDBInfoList& indexed_db_info); |
692 void OnFileSystemModelInfoLoaded( | 641 void OnFileSystemModelInfoLoaded( |
693 const FileSystemInfoList& file_system_info); | 642 const FileSystemInfoList& file_system_info); |
694 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); | 643 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); |
695 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list); | 644 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list); |
696 | 645 |
697 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); | 646 void PopulateAppCacheInfoWithFilter(const string16& filter); |
698 void PopulateCookieInfoWithFilter(const std::wstring& filter); | 647 void PopulateCookieInfoWithFilter(const string16& filter); |
699 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); | 648 void PopulateDatabaseInfoWithFilter(const string16& filter); |
700 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); | 649 void PopulateLocalStorageInfoWithFilter(const string16& filter); |
701 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); | 650 void PopulateSessionStorageInfoWithFilter(const string16& filter); |
702 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); | 651 void PopulateIndexedDBInfoWithFilter(const string16& filter); |
703 void PopulateFileSystemInfoWithFilter(const std::wstring& filter); | 652 void PopulateFileSystemInfoWithFilter(const string16& filter); |
704 void PopulateQuotaInfoWithFilter(const std::wstring& filter); | 653 void PopulateQuotaInfoWithFilter(const string16& filter); |
705 void PopulateServerBoundCertInfoWithFilter(const std::wstring& filter); | 654 void PopulateServerBoundCertInfoWithFilter(const string16& filter); |
706 | 655 |
707 void NotifyObserverBeginBatch(); | 656 void NotifyObserverBeginBatch(); |
708 void NotifyObserverEndBatch(); | 657 void NotifyObserverEndBatch(); |
709 | 658 |
710 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 659 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
711 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; | 660 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
712 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 661 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
713 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 662 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
714 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 663 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
715 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 664 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
716 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 665 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
717 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; | 666 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
718 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_; | 667 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_; |
719 | 668 |
720 std::map<GURL, std::list<appcache::AppCacheInfo> > appcache_info_; | 669 std::map<GURL, std::list<appcache::AppCacheInfo> > appcache_info_; |
721 CookieList cookie_list_; | 670 CookieList cookie_list_; |
722 DatabaseInfoList database_info_list_; | 671 DatabaseInfoList database_info_list_; |
723 LocalStorageInfoList local_storage_info_list_; | 672 LocalStorageInfoList local_storage_info_list_; |
724 LocalStorageInfoList session_storage_info_list_; | 673 LocalStorageInfoList session_storage_info_list_; |
725 IndexedDBInfoList indexed_db_info_list_; | 674 IndexedDBInfoList indexed_db_info_list_; |
726 FileSystemInfoList file_system_info_list_; | 675 FileSystemInfoList file_system_info_list_; |
727 QuotaInfoArray quota_info_list_; | 676 QuotaInfoArray quota_info_list_; |
728 ServerBoundCertList server_bound_cert_list_; | 677 ServerBoundCertList server_bound_cert_list_; |
| 678 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
729 | 679 |
730 // The CookiesTreeModel maintains a separate list of observers that are | 680 // The CookiesTreeModel maintains a separate list of observers that are |
731 // specifically of the type CookiesTreeModel::Observer. | 681 // specifically of the type CookiesTreeModel::Observer. |
732 ObserverList<Observer> cookies_observer_list_; | 682 ObserverList<Observer> cookies_observer_list_; |
733 | 683 |
734 // If this is non-zero, then this model is batching updates (there's a lot of | 684 // If this is non-zero, then this model is batching updates (there's a lot of |
735 // notifications coming down the pipe). This is an integer is used to balance | 685 // notifications coming down the pipe). This is an integer is used to balance |
736 // calls to Begin/EndBatch() if they're called in a nested manner. | 686 // calls to Begin/EndBatch() if they're called in a nested manner. |
737 int batch_update_; | 687 int batch_update_; |
738 | 688 |
(...skipping 10 matching lines...) Expand all Loading... |
749 friend class CookieTreeSessionStorageNode; | 699 friend class CookieTreeSessionStorageNode; |
750 friend class CookieTreeIndexedDBNode; | 700 friend class CookieTreeIndexedDBNode; |
751 friend class CookieTreeFileSystemNode; | 701 friend class CookieTreeFileSystemNode; |
752 friend class CookieTreeQuotaNode; | 702 friend class CookieTreeQuotaNode; |
753 friend class CookieTreeServerBoundCertNode; | 703 friend class CookieTreeServerBoundCertNode; |
754 | 704 |
755 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); | 705 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); |
756 }; | 706 }; |
757 | 707 |
758 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 708 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
OLD | NEW |