OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/string16.h" | 17 #include "base/string16.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/browsing_data_appcache_helper.h" | 19 #include "chrome/browser/browsing_data_appcache_helper.h" |
20 #include "chrome/browser/browsing_data_database_helper.h" | 20 #include "chrome/browser/browsing_data_database_helper.h" |
21 #include "chrome/browser/browsing_data_file_system_helper.h" | 21 #include "chrome/browser/browsing_data_file_system_helper.h" |
22 #include "chrome/browser/browsing_data_indexed_db_helper.h" | 22 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
23 #include "chrome/browser/browsing_data_local_storage_helper.h" | 23 #include "chrome/browser/browsing_data_local_storage_helper.h" |
| 24 #include "chrome/browser/browsing_data_quota_helper.h" |
24 #include "chrome/common/content_settings.h" | 25 #include "chrome/common/content_settings.h" |
25 #include "net/base/cookie_monster.h" | 26 #include "net/base/cookie_monster.h" |
26 #include "ui/base/models/tree_node_model.h" | 27 #include "ui/base/models/tree_node_model.h" |
27 | 28 |
28 class CookiesTreeModel; | 29 class CookiesTreeModel; |
29 class CookieTreeAppCacheNode; | 30 class CookieTreeAppCacheNode; |
30 class CookieTreeAppCachesNode; | 31 class CookieTreeAppCachesNode; |
31 class CookieTreeCookieNode; | 32 class CookieTreeCookieNode; |
32 class CookieTreeCookiesNode; | 33 class CookieTreeCookiesNode; |
33 class CookieTreeDatabaseNode; | 34 class CookieTreeDatabaseNode; |
34 class CookieTreeDatabasesNode; | 35 class CookieTreeDatabasesNode; |
35 class CookieTreeFileSystemsNode; | 36 class CookieTreeFileSystemsNode; |
36 class CookieTreeFileSystemNode; | 37 class CookieTreeFileSystemNode; |
37 class CookieTreeLocalStorageNode; | 38 class CookieTreeLocalStorageNode; |
38 class CookieTreeLocalStoragesNode; | 39 class CookieTreeLocalStoragesNode; |
| 40 class CookieTreeQuotaNode; |
39 class CookieTreeSessionStorageNode; | 41 class CookieTreeSessionStorageNode; |
40 class CookieTreeSessionStoragesNode; | 42 class CookieTreeSessionStoragesNode; |
41 class CookieTreeIndexedDBNode; | 43 class CookieTreeIndexedDBNode; |
42 class CookieTreeIndexedDBsNode; | 44 class CookieTreeIndexedDBsNode; |
43 class CookieTreeOriginNode; | 45 class CookieTreeOriginNode; |
44 class HostContentSettingsMap; | 46 class HostContentSettingsMap; |
45 | 47 |
46 // CookieTreeNode ------------------------------------------------------------- | 48 // CookieTreeNode ------------------------------------------------------------- |
47 // The base node type in the Cookies, Databases, and Local Storage options | 49 // The base node type in the Cookies, Databases, and Local Storage options |
48 // view, from which all other types are derived. Specialized from TreeNode in | 50 // view, from which all other types are derived. Specialized from TreeNode in |
(...skipping 13 matching lines...) Expand all Loading... |
62 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. | 64 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. |
63 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. | 65 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. |
64 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. | 66 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. |
65 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. | 67 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. |
66 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. | 68 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. |
67 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. | 69 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. |
68 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. | 70 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. |
69 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. | 71 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. |
70 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. | 72 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. |
71 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. | 73 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. |
72 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. | 74 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. |
73 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. | 75 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. |
| 76 TYPE_QUOTA, // This is used for CookieTreeQuotaNode. |
74 }; | 77 }; |
75 | 78 |
76 // TODO(viettrungluu): Figure out whether we want to store |origin| as a | 79 // TODO(viettrungluu): Figure out whether we want to store |origin| as a |
77 // |string16| or a (UTF-8) |std::string|, and convert. Remove constructor | 80 // |string16| or a (UTF-8) |std::string|, and convert. Remove constructor |
78 // taking an |std::wstring|. | 81 // taking an |std::wstring|. |
79 DetailedInfo(const string16& origin, NodeType node_type, | 82 DetailedInfo(const string16& origin, NodeType node_type, |
80 const net::CookieMonster::CanonicalCookie* cookie, | 83 const net::CookieMonster::CanonicalCookie* cookie, |
81 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, | 84 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, |
82 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 85 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
83 local_storage_info, | 86 local_storage_info, |
84 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 87 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
85 session_storage_info, | 88 session_storage_info, |
86 const appcache::AppCacheInfo* appcache_info, | 89 const appcache::AppCacheInfo* appcache_info, |
87 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, | 90 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, |
88 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) | 91 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info, |
| 92 const BrowsingDataQuotaHelper::QuotaInfo* quota_info) |
89 : origin(UTF16ToWideHack(origin)), | 93 : origin(UTF16ToWideHack(origin)), |
90 node_type(node_type), | 94 node_type(node_type), |
91 cookie(cookie), | 95 cookie(cookie), |
92 database_info(database_info), | 96 database_info(database_info), |
93 local_storage_info(local_storage_info), | 97 local_storage_info(local_storage_info), |
94 session_storage_info(session_storage_info), | 98 session_storage_info(session_storage_info), |
95 appcache_info(appcache_info), | 99 appcache_info(appcache_info), |
96 indexed_db_info(indexed_db_info), | 100 indexed_db_info(indexed_db_info), |
97 file_system_info(file_system_info) { | 101 file_system_info(file_system_info), |
| 102 quota_info(quota_info) { |
98 DCHECK((node_type != TYPE_DATABASE) || database_info); | 103 DCHECK((node_type != TYPE_DATABASE) || database_info); |
99 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); | 104 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); |
100 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); | 105 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); |
101 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); | 106 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); |
102 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); | 107 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); |
103 DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); | 108 DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); |
| 109 DCHECK((node_type != TYPE_QUOTA) || quota_info); |
104 } | 110 } |
105 #if !defined(WCHAR_T_IS_UTF16) | 111 #if !defined(WCHAR_T_IS_UTF16) |
106 DetailedInfo(const std::wstring& origin, NodeType node_type, | 112 DetailedInfo(const std::wstring& origin, NodeType node_type, |
107 const net::CookieMonster::CanonicalCookie* cookie, | 113 const net::CookieMonster::CanonicalCookie* cookie, |
108 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, | 114 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, |
109 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 115 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
110 local_storage_info, | 116 local_storage_info, |
111 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 117 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
112 session_storage_info, | 118 session_storage_info, |
113 const appcache::AppCacheInfo* appcache_info, | 119 const appcache::AppCacheInfo* appcache_info, |
114 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, | 120 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, |
115 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) | 121 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info, |
| 122 const BrowsingDataQuotaHelper::QuotaInfo* quota_info) |
116 : origin(origin), | 123 : origin(origin), |
117 node_type(node_type), | 124 node_type(node_type), |
118 cookie(cookie), | 125 cookie(cookie), |
119 database_info(database_info), | 126 database_info(database_info), |
120 local_storage_info(local_storage_info), | 127 local_storage_info(local_storage_info), |
121 session_storage_info(session_storage_info), | 128 session_storage_info(session_storage_info), |
122 appcache_info(appcache_info), | 129 appcache_info(appcache_info), |
123 indexed_db_info(indexed_db_info), | 130 indexed_db_info(indexed_db_info), |
124 file_system_info(file_system_info) { | 131 file_system_info(file_system_info), |
| 132 quota_info(quota_info) { |
125 DCHECK((node_type != TYPE_DATABASE) || database_info); | 133 DCHECK((node_type != TYPE_DATABASE) || database_info); |
126 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); | 134 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); |
127 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); | 135 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); |
128 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); | 136 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); |
129 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); | 137 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); |
130 DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); | 138 DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); |
| 139 DCHECK((node_type != TYPE_QUOTA) || quota_info); |
131 } | 140 } |
132 #endif | 141 #endif |
133 | 142 |
134 std::wstring origin; | 143 std::wstring origin; |
135 NodeType node_type; | 144 NodeType node_type; |
136 const net::CookieMonster::CanonicalCookie* cookie; | 145 const net::CookieMonster::CanonicalCookie* cookie; |
137 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; | 146 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; |
138 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; | 147 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; |
139 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 148 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
140 session_storage_info; | 149 session_storage_info; |
141 const appcache::AppCacheInfo* appcache_info; | 150 const appcache::AppCacheInfo* appcache_info; |
142 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; | 151 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; |
143 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; | 152 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; |
| 153 const BrowsingDataQuotaHelper::QuotaInfo* quota_info; |
144 }; | 154 }; |
145 | 155 |
146 CookieTreeNode() {} | 156 CookieTreeNode() {} |
147 explicit CookieTreeNode(const string16& title) | 157 explicit CookieTreeNode(const string16& title) |
148 : ui::TreeNode<CookieTreeNode>(title) {} | 158 : ui::TreeNode<CookieTreeNode>(title) {} |
149 virtual ~CookieTreeNode() {} | 159 virtual ~CookieTreeNode() {} |
150 | 160 |
151 // Delete backend storage for this node, and any children nodes. (E.g. delete | 161 // Delete backend storage for this node, and any children nodes. (E.g. delete |
152 // the cookie from CookieMonster, clear the database, and so forth.) | 162 // the cookie from CookieMonster, clear the database, and so forth.) |
153 virtual void DeleteStoredObjects(); | 163 virtual void DeleteStoredObjects(); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 virtual DetailedInfo GetDetailedInfo() const; | 214 virtual DetailedInfo GetDetailedInfo() const; |
205 | 215 |
206 // CookieTreeOriginNode methods: | 216 // CookieTreeOriginNode methods: |
207 CookieTreeCookiesNode* GetOrCreateCookiesNode(); | 217 CookieTreeCookiesNode* GetOrCreateCookiesNode(); |
208 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); | 218 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); |
209 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); | 219 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); |
210 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); | 220 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); |
211 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); | 221 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); |
212 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); | 222 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); |
213 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); | 223 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); |
| 224 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( |
| 225 BrowsingDataQuotaHelper::QuotaInfo* quota_info); |
214 | 226 |
215 // Creates an content exception for this origin of type | 227 // Creates an content exception for this origin of type |
216 // CONTENT_SETTINGS_TYPE_COOKIES. | 228 // CONTENT_SETTINGS_TYPE_COOKIES. |
217 void CreateContentException(HostContentSettingsMap* content_settings, | 229 void CreateContentException(HostContentSettingsMap* content_settings, |
218 ContentSetting setting) const; | 230 ContentSetting setting) const; |
219 | 231 |
220 // True if a content exception can be created for this origin. | 232 // True if a content exception can be created for this origin. |
221 bool CanCreateContentException() const; | 233 bool CanCreateContentException() const; |
222 | 234 |
223 private: | 235 private: |
224 // Pointers to the cookies, databases, local and session storage and appcache | 236 // Pointers to the cookies, databases, local and session storage and appcache |
225 // nodes. When we build up the tree we need to quickly get a reference to | 237 // nodes. When we build up the tree we need to quickly get a reference to |
226 // the COOKIES node to add children. Checking each child and interrogating | 238 // the COOKIES node to add children. Checking each child and interrogating |
227 // them to see if they are a COOKIES, APPCACHES, DATABASES etc node seems | 239 // them to see if they are a COOKIES, APPCACHES, DATABASES etc node seems |
228 // less preferable than storing an extra pointer per origin. | 240 // less preferable than storing an extra pointer per origin. |
229 CookieTreeCookiesNode* cookies_child_; | 241 CookieTreeCookiesNode* cookies_child_; |
230 CookieTreeDatabasesNode* databases_child_; | 242 CookieTreeDatabasesNode* databases_child_; |
231 CookieTreeLocalStoragesNode* local_storages_child_; | 243 CookieTreeLocalStoragesNode* local_storages_child_; |
232 CookieTreeSessionStoragesNode* session_storages_child_; | 244 CookieTreeSessionStoragesNode* session_storages_child_; |
233 CookieTreeAppCachesNode* appcaches_child_; | 245 CookieTreeAppCachesNode* appcaches_child_; |
234 CookieTreeIndexedDBsNode* indexed_dbs_child_; | 246 CookieTreeIndexedDBsNode* indexed_dbs_child_; |
235 CookieTreeFileSystemsNode* file_systems_child_; | 247 CookieTreeFileSystemsNode* file_systems_child_; |
| 248 CookieTreeQuotaNode* quota_child_; |
236 | 249 |
237 // The URL for which this node was initially created. | 250 // The URL for which this node was initially created. |
238 GURL url_; | 251 GURL url_; |
239 | 252 |
240 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); | 253 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); |
241 }; | 254 }; |
242 | 255 |
243 // CookieTreeCookieNode ------------------------------------------------------ | 256 // CookieTreeCookieNode ------------------------------------------------------ |
244 class CookieTreeCookieNode : public CookieTreeNode { | 257 class CookieTreeCookieNode : public CookieTreeNode { |
245 public: | 258 public: |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 virtual DetailedInfo GetDetailedInfo() const; | 504 virtual DetailedInfo GetDetailedInfo() const; |
492 | 505 |
493 void AddIndexedDBNode(CookieTreeIndexedDBNode* child) { | 506 void AddIndexedDBNode(CookieTreeIndexedDBNode* child) { |
494 AddChildSortedByTitle(child); | 507 AddChildSortedByTitle(child); |
495 } | 508 } |
496 | 509 |
497 private: | 510 private: |
498 DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBsNode); | 511 DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBsNode); |
499 }; | 512 }; |
500 | 513 |
| 514 // CookieTreeQuotaNode -------------------------------------------------- |
| 515 class CookieTreeQuotaNode : public CookieTreeNode { |
| 516 public: |
| 517 // Does not take ownership of quota_info, and quota_info should remain valid |
| 518 // at least as long as the CookieTreeQuotaNode is valid. |
| 519 explicit CookieTreeQuotaNode(BrowsingDataQuotaHelper::QuotaInfo* quota_info); |
| 520 virtual ~CookieTreeQuotaNode(); |
| 521 |
| 522 virtual void DeleteStoredObjects(); |
| 523 virtual DetailedInfo GetDetailedInfo() const; |
| 524 |
| 525 private: |
| 526 // quota_info_ is not owned by the node, and is expected to remain valid as |
| 527 // long as the CookieTreeQuotaNode is valid. |
| 528 BrowsingDataQuotaHelper::QuotaInfo* quota_info_; |
| 529 |
| 530 DISALLOW_COPY_AND_ASSIGN(CookieTreeQuotaNode); |
| 531 }; |
501 | 532 |
502 // CookiesTreeModel ----------------------------------------------------------- | 533 // CookiesTreeModel ----------------------------------------------------------- |
503 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { | 534 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { |
504 public: | 535 public: |
505 // Because non-cookie nodes are fetched in a background thread, they are not | 536 // Because non-cookie nodes are fetched in a background thread, they are not |
506 // present at the time the Model is created. The Model then notifies its | 537 // present at the time the Model is created. The Model then notifies its |
507 // observers for every item added from databases, local storage, and | 538 // observers for every item added from databases, local storage, and |
508 // appcache. We extend the Observer interface to add notifications before and | 539 // appcache. We extend the Observer interface to add notifications before and |
509 // after these batch inserts. | 540 // after these batch inserts. |
510 class Observer : public ui::TreeModelObserver { | 541 class Observer : public ui::TreeModelObserver { |
511 public: | 542 public: |
512 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {} | 543 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {} |
513 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} | 544 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} |
514 }; | 545 }; |
515 | 546 |
516 CookiesTreeModel( | 547 CookiesTreeModel( |
517 net::CookieMonster* cookie_monster_, | 548 net::CookieMonster* cookie_monster_, |
518 BrowsingDataDatabaseHelper* database_helper, | 549 BrowsingDataDatabaseHelper* database_helper, |
519 BrowsingDataLocalStorageHelper* local_storage_helper, | 550 BrowsingDataLocalStorageHelper* local_storage_helper, |
520 BrowsingDataLocalStorageHelper* session_storage_helper, | 551 BrowsingDataLocalStorageHelper* session_storage_helper, |
521 BrowsingDataAppCacheHelper* appcache_helper, | 552 BrowsingDataAppCacheHelper* appcache_helper, |
522 BrowsingDataIndexedDBHelper* indexed_db_helper, | 553 BrowsingDataIndexedDBHelper* indexed_db_helper, |
523 BrowsingDataFileSystemHelper* file_system_helper, | 554 BrowsingDataFileSystemHelper* file_system_helper, |
| 555 BrowsingDataQuotaHelper* quota_helper, |
524 bool use_cookie_source); | 556 bool use_cookie_source); |
525 virtual ~CookiesTreeModel(); | 557 virtual ~CookiesTreeModel(); |
526 | 558 |
527 // ui::TreeModel methods: | 559 // ui::TreeModel methods: |
528 // Returns the set of icons for the nodes in the tree. You only need override | 560 // Returns the set of icons for the nodes in the tree. You only need override |
529 // this if you don't want to use the default folder icons. | 561 // this if you don't want to use the default folder icons. |
530 virtual void GetIcons(std::vector<SkBitmap>* icons); | 562 virtual void GetIcons(std::vector<SkBitmap>* icons); |
531 | 563 |
532 // Returns the index of the icon to use for |node|. Return -1 to use the | 564 // Returns the index of the icon to use for |node|. Return -1 to use the |
533 // default icon. The index is relative to the list of icons returned from | 565 // default icon. The index is relative to the list of icons returned from |
(...skipping 24 matching lines...) Expand all Loading... |
558 typedef std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> | 590 typedef std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> |
559 DatabaseInfoList; | 591 DatabaseInfoList; |
560 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 592 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
561 LocalStorageInfoList; | 593 LocalStorageInfoList; |
562 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 594 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
563 SessionStorageInfoList; | 595 SessionStorageInfoList; |
564 typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> | 596 typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> |
565 IndexedDBInfoList; | 597 IndexedDBInfoList; |
566 typedef std::vector<BrowsingDataFileSystemHelper::FileSystemInfo> | 598 typedef std::vector<BrowsingDataFileSystemHelper::FileSystemInfo> |
567 FileSystemInfoList; | 599 FileSystemInfoList; |
| 600 typedef std::vector<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray; |
568 | 601 |
569 void LoadCookies(); | 602 void LoadCookies(); |
570 void LoadCookiesWithFilter(const std::wstring& filter); | 603 void LoadCookiesWithFilter(const std::wstring& filter); |
571 | 604 |
572 void OnAppCacheModelInfoLoaded(); | 605 void OnAppCacheModelInfoLoaded(); |
573 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); | 606 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); |
574 void OnLocalStorageModelInfoLoaded( | 607 void OnLocalStorageModelInfoLoaded( |
575 const LocalStorageInfoList& local_storage_info); | 608 const LocalStorageInfoList& local_storage_info); |
576 void OnSessionStorageModelInfoLoaded( | 609 void OnSessionStorageModelInfoLoaded( |
577 const LocalStorageInfoList& local_storage_info); | 610 const LocalStorageInfoList& local_storage_info); |
578 void OnIndexedDBModelInfoLoaded( | 611 void OnIndexedDBModelInfoLoaded( |
579 const IndexedDBInfoList& indexed_db_info); | 612 const IndexedDBInfoList& indexed_db_info); |
580 void OnFileSystemModelInfoLoaded( | 613 void OnFileSystemModelInfoLoaded( |
581 const FileSystemInfoList& file_system_info); | 614 const FileSystemInfoList& file_system_info); |
| 615 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); |
582 | 616 |
583 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); | 617 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); |
584 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); | 618 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); |
585 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); | 619 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); |
586 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); | 620 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); |
587 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); | 621 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); |
588 void PopulateFileSystemInfoWithFilter(const std::wstring& filter); | 622 void PopulateFileSystemInfoWithFilter(const std::wstring& filter); |
| 623 void PopulateQuotaInfoWithFilter(const std::wstring& filter); |
589 | 624 |
590 void NotifyObserverBeginBatch(); | 625 void NotifyObserverBeginBatch(); |
591 void NotifyObserverEndBatch(); | 626 void NotifyObserverEndBatch(); |
592 | 627 |
593 scoped_refptr<net::CookieMonster> cookie_monster_; | 628 scoped_refptr<net::CookieMonster> cookie_monster_; |
594 CookieList all_cookies_; | 629 CookieList all_cookies_; |
595 | 630 |
596 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 631 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
597 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 632 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
598 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; | 633 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; |
599 DatabaseInfoList database_info_list_; | 634 DatabaseInfoList database_info_list_; |
600 | 635 |
601 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 636 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
602 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 637 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
603 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 638 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
604 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 639 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
| 640 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
605 LocalStorageInfoList local_storage_info_list_; | 641 LocalStorageInfoList local_storage_info_list_; |
606 LocalStorageInfoList session_storage_info_list_; | 642 LocalStorageInfoList session_storage_info_list_; |
607 IndexedDBInfoList indexed_db_info_list_; | 643 IndexedDBInfoList indexed_db_info_list_; |
608 FileSystemInfoList file_system_info_list_; | 644 FileSystemInfoList file_system_info_list_; |
| 645 QuotaInfoArray quota_info_list_; |
609 | 646 |
610 // The CookiesTreeModel maintains a separate list of observers that are | 647 // The CookiesTreeModel maintains a separate list of observers that are |
611 // specifically of the type CookiesTreeModel::Observer. | 648 // specifically of the type CookiesTreeModel::Observer. |
612 ObserverList<Observer> cookies_observer_list_; | 649 ObserverList<Observer> cookies_observer_list_; |
613 | 650 |
614 // If this is non-zero, then this model is batching updates (there's a lot of | 651 // If this is non-zero, then this model is batching updates (there's a lot of |
615 // notifications coming down the pipe). This is an integer is used to balance | 652 // notifications coming down the pipe). This is an integer is used to balance |
616 // calls to Begin/EndBatch() if they're called in a nested manner. | 653 // calls to Begin/EndBatch() if they're called in a nested manner. |
617 int batch_update_; | 654 int batch_update_; |
618 | 655 |
619 // If true, use the CanonicalCookie::Source attribute to group cookies. | 656 // If true, use the CanonicalCookie::Source attribute to group cookies. |
620 // Otherwise, use the CanonicalCookie::Domain attribute. | 657 // Otherwise, use the CanonicalCookie::Domain attribute. |
621 bool use_cookie_source_; | 658 bool use_cookie_source_; |
622 | 659 |
623 friend class CookieTreeAppCacheNode; | 660 friend class CookieTreeAppCacheNode; |
624 friend class CookieTreeCookieNode; | 661 friend class CookieTreeCookieNode; |
625 friend class CookieTreeDatabaseNode; | 662 friend class CookieTreeDatabaseNode; |
626 friend class CookieTreeLocalStorageNode; | 663 friend class CookieTreeLocalStorageNode; |
627 friend class CookieTreeIndexedDBNode; | 664 friend class CookieTreeIndexedDBNode; |
628 friend class CookieTreeFileSystemNode; | 665 friend class CookieTreeFileSystemNode; |
| 666 friend class CookieTreeQuotaNode; |
629 | 667 |
630 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); | 668 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); |
631 }; | 669 }; |
632 | 670 |
633 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 671 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
OLD | NEW |