Chromium Code Reviews| 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_indexed_db_helper.h" | 22 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
| 22 #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_file_system_helper.h" | |
|
jochen (gone - plz use gerrit)
2011/05/25 15:54:09
duplicate
Mike West
2011/05/25 16:55:16
Done.
| |
| 23 #include "chrome/common/content_settings.h" | 25 #include "chrome/common/content_settings.h" |
| 24 #include "net/base/cookie_monster.h" | 26 #include "net/base/cookie_monster.h" |
| 25 #include "ui/base/models/tree_node_model.h" | 27 #include "ui/base/models/tree_node_model.h" |
| 26 | 28 |
| 27 class CookiesTreeModel; | 29 class CookiesTreeModel; |
| 28 class CookieTreeAppCacheNode; | 30 class CookieTreeAppCacheNode; |
| 29 class CookieTreeAppCachesNode; | 31 class CookieTreeAppCachesNode; |
| 30 class CookieTreeCookieNode; | 32 class CookieTreeCookieNode; |
| 31 class CookieTreeCookiesNode; | 33 class CookieTreeCookiesNode; |
| 32 class CookieTreeDatabaseNode; | 34 class CookieTreeDatabaseNode; |
| 33 class CookieTreeDatabasesNode; | 35 class CookieTreeDatabasesNode; |
| 36 class CookieTreeFileSystemsNode; | |
| 37 class CookieTreeFileSystemNode; | |
| 34 class CookieTreeLocalStorageNode; | 38 class CookieTreeLocalStorageNode; |
| 35 class CookieTreeLocalStoragesNode; | 39 class CookieTreeLocalStoragesNode; |
| 36 class CookieTreeSessionStorageNode; | 40 class CookieTreeSessionStorageNode; |
| 37 class CookieTreeSessionStoragesNode; | 41 class CookieTreeSessionStoragesNode; |
| 38 class CookieTreeIndexedDBNode; | 42 class CookieTreeIndexedDBNode; |
| 39 class CookieTreeIndexedDBsNode; | 43 class CookieTreeIndexedDBsNode; |
| 40 class CookieTreeOriginNode; | 44 class CookieTreeOriginNode; |
| 41 class HostContentSettingsMap; | 45 class HostContentSettingsMap; |
| 42 | 46 |
| 43 // CookieTreeNode ------------------------------------------------------------- | 47 // CookieTreeNode ------------------------------------------------------------- |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 59 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. | 63 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. |
| 60 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. | 64 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. |
| 61 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. | 65 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. |
| 62 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. | 66 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. |
| 63 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. | 67 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. |
| 64 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. | 68 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. |
| 65 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. | 69 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. |
| 66 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. | 70 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. |
| 67 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. | 71 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. |
| 68 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. | 72 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. |
| 73 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. | |
| 74 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. | |
| 69 }; | 75 }; |
| 70 | 76 |
| 71 // TODO(viettrungluu): Figure out whether we want to store |origin| as a | 77 // TODO(viettrungluu): Figure out whether we want to store |origin| as a |
| 72 // |string16| or a (UTF-8) |std::string|, and convert. Remove constructor | 78 // |string16| or a (UTF-8) |std::string|, and convert. Remove constructor |
| 73 // taking an |std::wstring|. | 79 // taking an |std::wstring|. |
| 74 DetailedInfo(const string16& origin, NodeType node_type, | 80 DetailedInfo(const string16& origin, NodeType node_type, |
| 75 const net::CookieMonster::CanonicalCookie* cookie, | 81 const net::CookieMonster::CanonicalCookie* cookie, |
| 76 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, | 82 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, |
| 77 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 83 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
| 78 local_storage_info, | 84 local_storage_info, |
| 79 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 85 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
| 80 session_storage_info, | 86 session_storage_info, |
| 81 const appcache::AppCacheInfo* appcache_info, | 87 const appcache::AppCacheInfo* appcache_info, |
| 82 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info) | 88 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, |
| 89 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) | |
| 83 : origin(UTF16ToWideHack(origin)), | 90 : origin(UTF16ToWideHack(origin)), |
| 84 node_type(node_type), | 91 node_type(node_type), |
| 85 cookie(cookie), | 92 cookie(cookie), |
| 86 database_info(database_info), | 93 database_info(database_info), |
| 87 local_storage_info(local_storage_info), | 94 local_storage_info(local_storage_info), |
| 88 session_storage_info(session_storage_info), | 95 session_storage_info(session_storage_info), |
| 89 appcache_info(appcache_info), | 96 appcache_info(appcache_info), |
| 90 indexed_db_info(indexed_db_info) { | 97 indexed_db_info(indexed_db_info), |
| 98 file_system_info(file_system_info) { | |
| 91 DCHECK((node_type != TYPE_DATABASE) || database_info); | 99 DCHECK((node_type != TYPE_DATABASE) || database_info); |
| 92 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); | 100 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); |
| 93 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); | 101 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); |
| 94 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); | 102 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); |
| 95 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); | 103 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); |
| 104 DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); | |
| 96 } | 105 } |
| 97 #if !defined(WCHAR_T_IS_UTF16) | 106 #if !defined(WCHAR_T_IS_UTF16) |
| 98 DetailedInfo(const std::wstring& origin, NodeType node_type, | 107 DetailedInfo(const std::wstring& origin, NodeType node_type, |
| 99 const net::CookieMonster::CanonicalCookie* cookie, | 108 const net::CookieMonster::CanonicalCookie* cookie, |
| 100 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, | 109 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info, |
| 101 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 110 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
| 102 local_storage_info, | 111 local_storage_info, |
| 103 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 112 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
| 104 session_storage_info, | 113 session_storage_info, |
| 105 const appcache::AppCacheInfo* appcache_info, | 114 const appcache::AppCacheInfo* appcache_info, |
| 106 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info) | 115 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info, |
| 116 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info) | |
| 107 : origin(origin), | 117 : origin(origin), |
| 108 node_type(node_type), | 118 node_type(node_type), |
| 109 cookie(cookie), | 119 cookie(cookie), |
| 110 database_info(database_info), | 120 database_info(database_info), |
| 111 local_storage_info(local_storage_info), | 121 local_storage_info(local_storage_info), |
| 112 session_storage_info(session_storage_info), | 122 session_storage_info(session_storage_info), |
| 113 appcache_info(appcache_info), | 123 appcache_info(appcache_info), |
| 114 indexed_db_info(indexed_db_info) { | 124 indexed_db_info(indexed_db_info), |
| 125 file_system_info(file_system_info) { | |
| 115 DCHECK((node_type != TYPE_DATABASE) || database_info); | 126 DCHECK((node_type != TYPE_DATABASE) || database_info); |
| 116 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); | 127 DCHECK((node_type != TYPE_LOCAL_STORAGE) || local_storage_info); |
| 117 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); | 128 DCHECK((node_type != TYPE_SESSION_STORAGE) || session_storage_info); |
| 118 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); | 129 DCHECK((node_type != TYPE_APPCACHE) || appcache_info); |
| 119 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); | 130 DCHECK((node_type != TYPE_INDEXED_DB) || indexed_db_info); |
| 131 DCHECK((node_type != TYPE_FILE_SYSTEM) || file_system_info); | |
| 120 } | 132 } |
| 121 #endif | 133 #endif |
| 122 | 134 |
| 123 std::wstring origin; | 135 std::wstring origin; |
| 124 NodeType node_type; | 136 NodeType node_type; |
| 125 const net::CookieMonster::CanonicalCookie* cookie; | 137 const net::CookieMonster::CanonicalCookie* cookie; |
| 126 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; | 138 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; |
| 127 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; | 139 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; |
| 128 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 140 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
| 129 session_storage_info; | 141 session_storage_info; |
| 130 const appcache::AppCacheInfo* appcache_info; | 142 const appcache::AppCacheInfo* appcache_info; |
| 131 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; | 143 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; |
| 144 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; | |
| 132 }; | 145 }; |
| 133 | 146 |
| 134 CookieTreeNode() {} | 147 CookieTreeNode() {} |
| 135 explicit CookieTreeNode(const string16& title) | 148 explicit CookieTreeNode(const string16& title) |
| 136 : ui::TreeNode<CookieTreeNode>(title) {} | 149 : ui::TreeNode<CookieTreeNode>(title) {} |
| 137 virtual ~CookieTreeNode() {} | 150 virtual ~CookieTreeNode() {} |
| 138 | 151 |
| 139 // Delete backend storage for this node, and any children nodes. (E.g. delete | 152 // Delete backend storage for this node, and any children nodes. (E.g. delete |
| 140 // the cookie from CookieMonster, clear the database, and so forth.) | 153 // the cookie from CookieMonster, clear the database, and so forth.) |
| 141 virtual void DeleteStoredObjects(); | 154 virtual void DeleteStoredObjects(); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 191 // CookieTreeNode methods: | 204 // CookieTreeNode methods: |
| 192 virtual DetailedInfo GetDetailedInfo() const; | 205 virtual DetailedInfo GetDetailedInfo() const; |
| 193 | 206 |
| 194 // CookieTreeOriginNode methods: | 207 // CookieTreeOriginNode methods: |
| 195 CookieTreeCookiesNode* GetOrCreateCookiesNode(); | 208 CookieTreeCookiesNode* GetOrCreateCookiesNode(); |
| 196 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); | 209 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); |
| 197 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); | 210 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); |
| 198 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); | 211 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); |
| 199 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); | 212 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); |
| 200 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); | 213 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); |
| 214 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); | |
| 201 | 215 |
| 202 // Creates an content exception for this origin of type | 216 // Creates an content exception for this origin of type |
| 203 // CONTENT_SETTINGS_TYPE_COOKIES. | 217 // CONTENT_SETTINGS_TYPE_COOKIES. |
| 204 void CreateContentException(HostContentSettingsMap* content_settings, | 218 void CreateContentException(HostContentSettingsMap* content_settings, |
| 205 ContentSetting setting) const; | 219 ContentSetting setting) const; |
| 206 | 220 |
| 207 // True if a content exception can be created for this origin. | 221 // True if a content exception can be created for this origin. |
| 208 bool CanCreateContentException() const; | 222 bool CanCreateContentException() const; |
| 209 | 223 |
| 210 private: | 224 private: |
| 211 // Pointers to the cookies, databases, local and session storage and appcache | 225 // Pointers to the cookies, databases, local and session storage and appcache |
| 212 // nodes. When we build up the tree we need to quickly get a reference to | 226 // nodes. When we build up the tree we need to quickly get a reference to |
| 213 // the COOKIES node to add children. Checking each child and interrogating | 227 // the COOKIES node to add children. Checking each child and interrogating |
| 214 // them to see if they are a COOKIES, APPCACHES, DATABASES etc node seems | 228 // them to see if they are a COOKIES, APPCACHES, DATABASES etc node seems |
| 215 // less preferable than storing an extra pointer per origin. | 229 // less preferable than storing an extra pointer per origin. |
| 216 CookieTreeCookiesNode* cookies_child_; | 230 CookieTreeCookiesNode* cookies_child_; |
| 217 CookieTreeDatabasesNode* databases_child_; | 231 CookieTreeDatabasesNode* databases_child_; |
| 218 CookieTreeLocalStoragesNode* local_storages_child_; | 232 CookieTreeLocalStoragesNode* local_storages_child_; |
| 219 CookieTreeSessionStoragesNode* session_storages_child_; | 233 CookieTreeSessionStoragesNode* session_storages_child_; |
| 220 CookieTreeAppCachesNode* appcaches_child_; | 234 CookieTreeAppCachesNode* appcaches_child_; |
| 221 CookieTreeIndexedDBsNode* indexed_dbs_child_; | 235 CookieTreeIndexedDBsNode* indexed_dbs_child_; |
| 236 CookieTreeFileSystemsNode* file_systems_child_; | |
| 222 | 237 |
| 223 // The URL for which this node was initially created. | 238 // The URL for which this node was initially created. |
| 224 GURL url_; | 239 GURL url_; |
| 225 | 240 |
| 226 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); | 241 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); |
| 227 }; | 242 }; |
| 228 | 243 |
| 229 // CookieTreeCookieNode ------------------------------------------------------ | 244 // CookieTreeCookieNode ------------------------------------------------------ |
| 230 class CookieTreeCookieNode : public CookieTreeNode { | 245 class CookieTreeCookieNode : public CookieTreeNode { |
| 231 public: | 246 public: |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 virtual DetailedInfo GetDetailedInfo() const; | 342 virtual DetailedInfo GetDetailedInfo() const; |
| 328 | 343 |
| 329 void AddDatabaseNode(CookieTreeDatabaseNode* child) { | 344 void AddDatabaseNode(CookieTreeDatabaseNode* child) { |
| 330 AddChildSortedByTitle(child); | 345 AddChildSortedByTitle(child); |
| 331 } | 346 } |
| 332 | 347 |
| 333 private: | 348 private: |
| 334 DISALLOW_COPY_AND_ASSIGN(CookieTreeDatabasesNode); | 349 DISALLOW_COPY_AND_ASSIGN(CookieTreeDatabasesNode); |
| 335 }; | 350 }; |
| 336 | 351 |
| 352 // CookieTreeFileSystemNode -------------------------------------------------- | |
| 353 class CookieTreeFileSystemNode : public CookieTreeNode { | |
| 354 public: | |
| 355 friend class CookieTreeFileSystemsNode; | |
| 356 | |
| 357 // Does not take ownership of file_system_info, and file_system_info should | |
| 358 // remain valid at least as long as the CookieTreeFileSystemNode is valid. | |
| 359 explicit CookieTreeFileSystemNode( | |
| 360 BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info); | |
| 361 virtual ~CookieTreeFileSystemNode(); | |
| 362 | |
| 363 virtual void DeleteStoredObjects(); | |
| 364 virtual DetailedInfo GetDetailedInfo() const; | |
| 365 | |
| 366 private: | |
| 367 // file_system_info_ is not owned by the node, and is expected to remain | |
| 368 // valid as long as the CookieTreeFileSystemNode is valid. | |
| 369 BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info_; | |
| 370 | |
| 371 DISALLOW_COPY_AND_ASSIGN(CookieTreeFileSystemNode); | |
| 372 }; | |
| 373 | |
| 374 class CookieTreeFileSystemsNode : public CookieTreeNode { | |
| 375 public: | |
| 376 CookieTreeFileSystemsNode(); | |
| 377 virtual ~CookieTreeFileSystemsNode(); | |
| 378 | |
| 379 virtual DetailedInfo GetDetailedInfo() const; | |
| 380 | |
| 381 void AddFileSystemNode(CookieTreeFileSystemNode* child) { | |
| 382 AddChildSortedByTitle(child); | |
| 383 } | |
| 384 | |
| 385 private: | |
| 386 DISALLOW_COPY_AND_ASSIGN(CookieTreeFileSystemsNode); | |
| 387 }; | |
| 337 | 388 |
| 338 // CookieTreeLocalStorageNode ------------------------------------------------- | 389 // CookieTreeLocalStorageNode ------------------------------------------------- |
| 339 class CookieTreeLocalStorageNode : public CookieTreeNode { | 390 class CookieTreeLocalStorageNode : public CookieTreeNode { |
| 340 public: | 391 public: |
| 341 // Does not take ownership of local_storage_info, and local_storage_info | 392 // Does not take ownership of local_storage_info, and local_storage_info |
| 342 // should remain valid at least as long as the CookieTreeLocalStorageNode is | 393 // should remain valid at least as long as the CookieTreeLocalStorageNode is |
| 343 // valid. | 394 // valid. |
| 344 explicit CookieTreeLocalStorageNode( | 395 explicit CookieTreeLocalStorageNode( |
| 345 BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info); | 396 BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info); |
| 346 virtual ~CookieTreeLocalStorageNode(); | 397 virtual ~CookieTreeLocalStorageNode(); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 463 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} | 514 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} |
| 464 }; | 515 }; |
| 465 | 516 |
| 466 CookiesTreeModel( | 517 CookiesTreeModel( |
| 467 net::CookieMonster* cookie_monster_, | 518 net::CookieMonster* cookie_monster_, |
| 468 BrowsingDataDatabaseHelper* database_helper, | 519 BrowsingDataDatabaseHelper* database_helper, |
| 469 BrowsingDataLocalStorageHelper* local_storage_helper, | 520 BrowsingDataLocalStorageHelper* local_storage_helper, |
| 470 BrowsingDataLocalStorageHelper* session_storage_helper, | 521 BrowsingDataLocalStorageHelper* session_storage_helper, |
| 471 BrowsingDataAppCacheHelper* appcache_helper, | 522 BrowsingDataAppCacheHelper* appcache_helper, |
| 472 BrowsingDataIndexedDBHelper* indexed_db_helper, | 523 BrowsingDataIndexedDBHelper* indexed_db_helper, |
| 524 BrowsingDataFileSystemHelper* file_system_helper, | |
| 473 bool use_cookie_source); | 525 bool use_cookie_source); |
| 474 virtual ~CookiesTreeModel(); | 526 virtual ~CookiesTreeModel(); |
| 475 | 527 |
| 476 // ui::TreeModel methods: | 528 // ui::TreeModel methods: |
| 477 // Returns the set of icons for the nodes in the tree. You only need override | 529 // Returns the set of icons for the nodes in the tree. You only need override |
| 478 // this if you don't want to use the default folder icons. | 530 // this if you don't want to use the default folder icons. |
| 479 virtual void GetIcons(std::vector<SkBitmap>* icons); | 531 virtual void GetIcons(std::vector<SkBitmap>* icons); |
| 480 | 532 |
| 481 // Returns the index of the icon to use for |node|. Return -1 to use the | 533 // Returns the index of the icon to use for |node|. Return -1 to use the |
| 482 // default icon. The index is relative to the list of icons returned from | 534 // default icon. The index is relative to the list of icons returned from |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 505 }; | 557 }; |
| 506 typedef net::CookieList CookieList; | 558 typedef net::CookieList CookieList; |
| 507 typedef std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> | 559 typedef std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> |
| 508 DatabaseInfoList; | 560 DatabaseInfoList; |
| 509 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 561 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 510 LocalStorageInfoList; | 562 LocalStorageInfoList; |
| 511 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 563 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 512 SessionStorageInfoList; | 564 SessionStorageInfoList; |
| 513 typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> | 565 typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> |
| 514 IndexedDBInfoList; | 566 IndexedDBInfoList; |
| 567 typedef std::vector<BrowsingDataFileSystemHelper::FileSystemInfo> | |
| 568 FileSystemInfoList; | |
| 515 | 569 |
| 516 void LoadCookies(); | 570 void LoadCookies(); |
| 517 void LoadCookiesWithFilter(const std::wstring& filter); | 571 void LoadCookiesWithFilter(const std::wstring& filter); |
| 518 | 572 |
| 519 void OnAppCacheModelInfoLoaded(); | 573 void OnAppCacheModelInfoLoaded(); |
| 520 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); | 574 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); |
| 521 void OnLocalStorageModelInfoLoaded( | 575 void OnLocalStorageModelInfoLoaded( |
| 522 const LocalStorageInfoList& local_storage_info); | 576 const LocalStorageInfoList& local_storage_info); |
| 523 void OnSessionStorageModelInfoLoaded( | 577 void OnSessionStorageModelInfoLoaded( |
| 524 const LocalStorageInfoList& local_storage_info); | 578 const LocalStorageInfoList& local_storage_info); |
| 525 void OnIndexedDBModelInfoLoaded( | 579 void OnIndexedDBModelInfoLoaded( |
| 526 const IndexedDBInfoList& indexed_db_info); | 580 const IndexedDBInfoList& indexed_db_info); |
| 581 void OnFileSystemModelInfoLoaded( | |
| 582 const FileSystemInfoList& file_system_info); | |
| 527 | 583 |
| 528 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); | 584 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); |
| 529 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); | 585 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); |
| 530 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); | 586 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); |
| 531 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); | 587 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); |
| 532 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); | 588 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); |
| 589 void PopulateFileSystemInfoWithFilter(const std::wstring& filter); | |
| 533 | 590 |
| 534 void NotifyObserverBeginBatch(); | 591 void NotifyObserverBeginBatch(); |
| 535 void NotifyObserverEndBatch(); | 592 void NotifyObserverEndBatch(); |
| 536 | 593 |
| 537 scoped_refptr<net::CookieMonster> cookie_monster_; | 594 scoped_refptr<net::CookieMonster> cookie_monster_; |
| 538 CookieList all_cookies_; | 595 CookieList all_cookies_; |
| 539 | 596 |
| 540 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 597 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
| 541 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 598 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
| 542 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; | 599 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; |
| 543 DatabaseInfoList database_info_list_; | 600 DatabaseInfoList database_info_list_; |
| 544 | 601 |
| 545 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 602 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
| 546 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 603 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
| 547 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 604 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
| 605 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | |
| 548 LocalStorageInfoList local_storage_info_list_; | 606 LocalStorageInfoList local_storage_info_list_; |
| 549 LocalStorageInfoList session_storage_info_list_; | 607 LocalStorageInfoList session_storage_info_list_; |
| 550 IndexedDBInfoList indexed_db_info_list_; | 608 IndexedDBInfoList indexed_db_info_list_; |
| 609 FileSystemInfoList file_system_info_list_; | |
| 551 | 610 |
| 552 // The CookiesTreeModel maintains a separate list of observers that are | 611 // The CookiesTreeModel maintains a separate list of observers that are |
| 553 // specifically of the type CookiesTreeModel::Observer. | 612 // specifically of the type CookiesTreeModel::Observer. |
| 554 ObserverList<Observer> cookies_observer_list_; | 613 ObserverList<Observer> cookies_observer_list_; |
| 555 | 614 |
| 556 // If this is non-zero, then this model is batching updates (there's a lot of | 615 // If this is non-zero, then this model is batching updates (there's a lot of |
| 557 // notifications coming down the pipe). This is an integer is used to balance | 616 // notifications coming down the pipe). This is an integer is used to balance |
| 558 // calls to Begin/EndBatch() if they're called in a nested manner. | 617 // calls to Begin/EndBatch() if they're called in a nested manner. |
| 559 int batch_update_; | 618 int batch_update_; |
| 560 | 619 |
| 561 // If true, use the CanonicalCookie::Source attribute to group cookies. | 620 // If true, use the CanonicalCookie::Source attribute to group cookies. |
| 562 // Otherwise, use the CanonicalCookie::Domain attribute. | 621 // Otherwise, use the CanonicalCookie::Domain attribute. |
| 563 bool use_cookie_source_; | 622 bool use_cookie_source_; |
| 564 | 623 |
| 565 friend class CookieTreeAppCacheNode; | 624 friend class CookieTreeAppCacheNode; |
| 566 friend class CookieTreeCookieNode; | 625 friend class CookieTreeCookieNode; |
| 567 friend class CookieTreeDatabaseNode; | 626 friend class CookieTreeDatabaseNode; |
| 568 friend class CookieTreeLocalStorageNode; | 627 friend class CookieTreeLocalStorageNode; |
| 569 friend class CookieTreeIndexedDBNode; | 628 friend class CookieTreeIndexedDBNode; |
| 629 friend class CookieTreeFileSystemNode; | |
| 570 | 630 |
| 571 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); | 631 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); |
| 572 }; | 632 }; |
| 573 | 633 |
| 574 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 634 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
| OLD | NEW |