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 17 matching lines...) Expand all Loading... |
203 | 145 |
204 protected: | 146 protected: |
205 class NodeTitleComparator { | 147 class NodeTitleComparator { |
206 public: | 148 public: |
207 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs); | 149 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs); |
208 }; | 150 }; |
209 | 151 |
210 void AddChildSortedByTitle(CookieTreeNode* new_child); | 152 void AddChildSortedByTitle(CookieTreeNode* new_child); |
211 | 153 |
212 private: | 154 private: |
213 | |
214 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode); | 155 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode); |
215 }; | 156 }; |
216 | 157 |
217 // CookieTreeRootNode --------------------------------------------------------- | 158 // CookieTreeRootNode --------------------------------------------------------- |
218 // The node at the root of the CookieTree that gets inserted into the view. | 159 // The node at the root of the CookieTree that gets inserted into the view. |
219 class CookieTreeRootNode : public CookieTreeNode { | 160 class CookieTreeRootNode : public CookieTreeNode { |
220 public: | 161 public: |
221 explicit CookieTreeRootNode(CookiesTreeModel* model); | 162 explicit CookieTreeRootNode(CookiesTreeModel* model); |
222 virtual ~CookieTreeRootNode(); | 163 virtual ~CookieTreeRootNode(); |
223 | 164 |
224 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url); | 165 CookieTreeHostNode* GetOrCreateHostNode(const GURL& url); |
225 | 166 |
226 // CookieTreeNode methods: | 167 // CookieTreeNode methods: |
227 virtual CookiesTreeModel* GetModel() const OVERRIDE; | 168 virtual CookiesTreeModel* GetModel() const OVERRIDE; |
228 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; | 169 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; |
229 | 170 |
230 private: | 171 private: |
231 CookiesTreeModel* model_; | 172 CookiesTreeModel* model_; |
232 | 173 |
233 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode); | 174 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode); |
234 }; | 175 }; |
235 | 176 |
236 // CookieTreeOriginNode ------------------------------------------------------- | 177 // CookieTreeHostNode ------------------------------------------------------- |
237 class CookieTreeOriginNode : public CookieTreeNode { | 178 class CookieTreeHostNode : public CookieTreeNode { |
238 public: | 179 public: |
239 // Returns the origin node's title to use for a given URL. | 180 // Returns the host node's title to use for a given URL. |
240 static std::wstring TitleForUrl(const GURL& url); | 181 static string16 TitleForUrl(const GURL& url); |
241 | 182 |
242 explicit CookieTreeOriginNode(const GURL& url); | 183 explicit CookieTreeHostNode(const GURL& url); |
243 virtual ~CookieTreeOriginNode(); | 184 virtual ~CookieTreeHostNode(); |
244 | 185 |
245 // CookieTreeNode methods: | 186 // CookieTreeNode methods: |
246 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; | 187 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; |
247 | 188 |
248 // CookieTreeOriginNode methods: | 189 // CookieTreeHostNode methods: |
249 CookieTreeCookiesNode* GetOrCreateCookiesNode(); | 190 CookieTreeCookiesNode* GetOrCreateCookiesNode(); |
250 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); | 191 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); |
251 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); | 192 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); |
252 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); | 193 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); |
253 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); | 194 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); |
254 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); | 195 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); |
255 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); | 196 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); |
256 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode(); | 197 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode(); |
257 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( | 198 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( |
258 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); | 199 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); |
(...skipping 18 matching lines...) Expand all Loading... |
277 CookieTreeSessionStoragesNode* session_storages_child_; | 218 CookieTreeSessionStoragesNode* session_storages_child_; |
278 CookieTreeAppCachesNode* appcaches_child_; | 219 CookieTreeAppCachesNode* appcaches_child_; |
279 CookieTreeIndexedDBsNode* indexed_dbs_child_; | 220 CookieTreeIndexedDBsNode* indexed_dbs_child_; |
280 CookieTreeFileSystemsNode* file_systems_child_; | 221 CookieTreeFileSystemsNode* file_systems_child_; |
281 CookieTreeQuotaNode* quota_child_; | 222 CookieTreeQuotaNode* quota_child_; |
282 CookieTreeServerBoundCertsNode* server_bound_certs_child_; | 223 CookieTreeServerBoundCertsNode* server_bound_certs_child_; |
283 | 224 |
284 // The URL for which this node was initially created. | 225 // The URL for which this node was initially created. |
285 GURL url_; | 226 GURL url_; |
286 | 227 |
287 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); | 228 DISALLOW_COPY_AND_ASSIGN(CookieTreeHostNode); |
288 }; | 229 }; |
289 | 230 |
290 // CookieTreeCookieNode ------------------------------------------------------ | 231 // CookieTreeCookieNode ------------------------------------------------------ |
291 class CookieTreeCookieNode : public CookieTreeNode { | 232 class CookieTreeCookieNode : public CookieTreeNode { |
292 public: | 233 public: |
293 friend class CookieTreeCookiesNode; | 234 friend class CookieTreeCookiesNode; |
294 | 235 |
295 // The cookie should remain valid at least as long as the | 236 // The cookie should remain valid at least as long as the |
296 // CookieTreeCookieNode is valid. | 237 // CookieTreeCookieNode is valid. |
297 explicit CookieTreeCookieNode( | 238 explicit CookieTreeCookieNode( |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 CookiesTreeModel( | 572 CookiesTreeModel( |
632 BrowsingDataCookieHelper* cookie_helper, | 573 BrowsingDataCookieHelper* cookie_helper, |
633 BrowsingDataDatabaseHelper* database_helper, | 574 BrowsingDataDatabaseHelper* database_helper, |
634 BrowsingDataLocalStorageHelper* local_storage_helper, | 575 BrowsingDataLocalStorageHelper* local_storage_helper, |
635 BrowsingDataLocalStorageHelper* session_storage_helper, | 576 BrowsingDataLocalStorageHelper* session_storage_helper, |
636 BrowsingDataAppCacheHelper* appcache_helper, | 577 BrowsingDataAppCacheHelper* appcache_helper, |
637 BrowsingDataIndexedDBHelper* indexed_db_helper, | 578 BrowsingDataIndexedDBHelper* indexed_db_helper, |
638 BrowsingDataFileSystemHelper* file_system_helper, | 579 BrowsingDataFileSystemHelper* file_system_helper, |
639 BrowsingDataQuotaHelper* quota_helper, | 580 BrowsingDataQuotaHelper* quota_helper, |
640 BrowsingDataServerBoundCertHelper* server_bound_cert_helper, | 581 BrowsingDataServerBoundCertHelper* server_bound_cert_helper, |
| 582 ExtensionSpecialStoragePolicy* special_storage_policy, |
641 bool use_cookie_source); | 583 bool use_cookie_source); |
642 virtual ~CookiesTreeModel(); | 584 virtual ~CookiesTreeModel(); |
643 | 585 |
644 // ui::TreeModel methods: | 586 // ui::TreeModel methods: |
645 // Returns the set of icons for the nodes in the tree. You only need override | 587 // Returns the set of icons for the nodes in the tree. You only need override |
646 // this if you don't want to use the default folder icons. | 588 // this if you don't want to use the default folder icons. |
647 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; | 589 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; |
648 | 590 |
649 // Returns the index of the icon to use for |node|. Return -1 to use the | 591 // Returns the index of the icon to use for |node|. Return -1 to use the |
650 // default icon. The index is relative to the list of icons returned from | 592 // default icon. The index is relative to the list of icons returned from |
651 // GetIcons. | 593 // GetIcons. |
652 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; | 594 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; |
653 | 595 |
654 // CookiesTreeModel methods: | 596 // CookiesTreeModel methods: |
655 void DeleteAllStoredObjects(); | 597 void DeleteAllStoredObjects(); |
656 void DeleteCookieNode(CookieTreeNode* cookie_node); | 598 void DeleteCookieNode(CookieTreeNode* cookie_node); |
657 | 599 |
658 // Filter the origins to only display matched results. | 600 // Filter the origins to only display matched results. |
659 void UpdateSearchResults(const std::wstring& filter); | 601 void UpdateSearchResults(const string16& filter); |
| 602 |
| 603 // Returns the set of extensions which protect the data item represented by |
| 604 // this node from deletion. |
| 605 // Returns NULL if the node doesn't represent a protected data item or the |
| 606 // special storage policy is NULL. |
| 607 const ExtensionSet* ExtensionsProtectingNode( |
| 608 const CookieTreeNode& cookie_node); |
660 | 609 |
661 // Manages CookiesTreeModel::Observers. This will also call | 610 // Manages CookiesTreeModel::Observers. This will also call |
662 // TreeNodeModel::AddObserver so that it gets all the proper notifications. | 611 // TreeNodeModel::AddObserver so that it gets all the proper notifications. |
663 // Note that the converse is not true: simply adding a TreeModelObserver will | 612 // Note that the converse is not true: simply adding a TreeModelObserver will |
664 // not get CookiesTreeModel::Observer notifications. | 613 // not get CookiesTreeModel::Observer notifications. |
665 virtual void AddCookiesTreeObserver(Observer* observer); | 614 virtual void AddCookiesTreeObserver(Observer* observer); |
666 virtual void RemoveCookiesTreeObserver(Observer* observer); | 615 virtual void RemoveCookiesTreeObserver(Observer* observer); |
667 | 616 |
668 private: | 617 private: |
669 enum CookieIconIndex { | 618 enum CookieIconIndex { |
(...skipping 22 matching lines...) Expand all Loading... |
692 const LocalStorageInfoList& local_storage_info); | 641 const LocalStorageInfoList& local_storage_info); |
693 void OnSessionStorageModelInfoLoaded( | 642 void OnSessionStorageModelInfoLoaded( |
694 const LocalStorageInfoList& local_storage_info); | 643 const LocalStorageInfoList& local_storage_info); |
695 void OnIndexedDBModelInfoLoaded( | 644 void OnIndexedDBModelInfoLoaded( |
696 const IndexedDBInfoList& indexed_db_info); | 645 const IndexedDBInfoList& indexed_db_info); |
697 void OnFileSystemModelInfoLoaded( | 646 void OnFileSystemModelInfoLoaded( |
698 const FileSystemInfoList& file_system_info); | 647 const FileSystemInfoList& file_system_info); |
699 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); | 648 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); |
700 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list); | 649 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list); |
701 | 650 |
702 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); | 651 void PopulateAppCacheInfoWithFilter(const string16& filter); |
703 void PopulateCookieInfoWithFilter(const std::wstring& filter); | 652 void PopulateCookieInfoWithFilter(const string16& filter); |
704 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); | 653 void PopulateDatabaseInfoWithFilter(const string16& filter); |
705 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); | 654 void PopulateLocalStorageInfoWithFilter(const string16& filter); |
706 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); | 655 void PopulateSessionStorageInfoWithFilter(const string16& filter); |
707 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); | 656 void PopulateIndexedDBInfoWithFilter(const string16& filter); |
708 void PopulateFileSystemInfoWithFilter(const std::wstring& filter); | 657 void PopulateFileSystemInfoWithFilter(const string16& filter); |
709 void PopulateQuotaInfoWithFilter(const std::wstring& filter); | 658 void PopulateQuotaInfoWithFilter(const string16& filter); |
710 void PopulateServerBoundCertInfoWithFilter(const std::wstring& filter); | 659 void PopulateServerBoundCertInfoWithFilter(const string16& filter); |
711 | 660 |
712 void NotifyObserverBeginBatch(); | 661 void NotifyObserverBeginBatch(); |
713 void NotifyObserverEndBatch(); | 662 void NotifyObserverEndBatch(); |
714 | 663 |
715 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 664 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
716 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; | 665 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
717 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 666 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
718 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 667 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
719 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 668 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
720 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 669 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
721 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 670 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
722 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; | 671 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
723 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_; | 672 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_; |
724 | 673 |
725 std::map<GURL, std::list<appcache::AppCacheInfo> > appcache_info_; | 674 std::map<GURL, std::list<appcache::AppCacheInfo> > appcache_info_; |
726 CookieList cookie_list_; | 675 CookieList cookie_list_; |
727 DatabaseInfoList database_info_list_; | 676 DatabaseInfoList database_info_list_; |
728 LocalStorageInfoList local_storage_info_list_; | 677 LocalStorageInfoList local_storage_info_list_; |
729 LocalStorageInfoList session_storage_info_list_; | 678 LocalStorageInfoList session_storage_info_list_; |
730 IndexedDBInfoList indexed_db_info_list_; | 679 IndexedDBInfoList indexed_db_info_list_; |
731 FileSystemInfoList file_system_info_list_; | 680 FileSystemInfoList file_system_info_list_; |
732 QuotaInfoArray quota_info_list_; | 681 QuotaInfoArray quota_info_list_; |
733 ServerBoundCertList server_bound_cert_list_; | 682 ServerBoundCertList server_bound_cert_list_; |
| 683 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; |
734 | 684 |
735 // The CookiesTreeModel maintains a separate list of observers that are | 685 // The CookiesTreeModel maintains a separate list of observers that are |
736 // specifically of the type CookiesTreeModel::Observer. | 686 // specifically of the type CookiesTreeModel::Observer. |
737 ObserverList<Observer> cookies_observer_list_; | 687 ObserverList<Observer> cookies_observer_list_; |
738 | 688 |
739 // If this is non-zero, then this model is batching updates (there's a lot of | 689 // If this is non-zero, then this model is batching updates (there's a lot of |
740 // notifications coming down the pipe). This is an integer is used to balance | 690 // notifications coming down the pipe). This is an integer is used to balance |
741 // calls to Begin/EndBatch() if they're called in a nested manner. | 691 // calls to Begin/EndBatch() if they're called in a nested manner. |
742 int batch_update_; | 692 int batch_update_; |
743 | 693 |
(...skipping 10 matching lines...) Expand all Loading... |
754 friend class CookieTreeSessionStorageNode; | 704 friend class CookieTreeSessionStorageNode; |
755 friend class CookieTreeIndexedDBNode; | 705 friend class CookieTreeIndexedDBNode; |
756 friend class CookieTreeFileSystemNode; | 706 friend class CookieTreeFileSystemNode; |
757 friend class CookieTreeQuotaNode; | 707 friend class CookieTreeQuotaNode; |
758 friend class CookieTreeServerBoundCertNode; | 708 friend class CookieTreeServerBoundCertNode; |
759 | 709 |
760 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); | 710 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); |
761 }; | 711 }; |
762 | 712 |
763 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 713 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
OLD | NEW |