Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: chrome/browser/cookies_tree_model.h

Issue 10536017: Refactoring CookiesTreeModel to support multiple data sources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed all comments by Evan. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/browser/local_data_container.h"
27 #include "chrome/common/content_settings.h" 28 #include "chrome/common/content_settings.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;
39 class CookieTreeAppNode;
38 class CookieTreeCookieNode; 40 class CookieTreeCookieNode;
39 class CookieTreeCookiesNode; 41 class CookieTreeCookiesNode;
40 class CookieTreeDatabaseNode; 42 class CookieTreeDatabaseNode;
41 class CookieTreeDatabasesNode; 43 class CookieTreeDatabasesNode;
44 class CookieTreeFileSystemNode;
42 class CookieTreeFileSystemsNode; 45 class CookieTreeFileSystemsNode;
43 class CookieTreeFileSystemNode; 46 class CookieTreeIndexedDBNode;
47 class CookieTreeIndexedDBsNode;
44 class CookieTreeLocalStorageNode; 48 class CookieTreeLocalStorageNode;
45 class CookieTreeLocalStoragesNode; 49 class CookieTreeLocalStoragesNode;
50 class CookieTreeOriginNode;
51 class CookieTreeQuotaNode;
46 class CookieTreeServerBoundCertNode; 52 class CookieTreeServerBoundCertNode;
47 class CookieTreeServerBoundCertsNode; 53 class CookieTreeServerBoundCertsNode;
48 class CookieTreeQuotaNode;
49 class CookieTreeSessionStorageNode; 54 class CookieTreeSessionStorageNode;
50 class CookieTreeSessionStoragesNode; 55 class CookieTreeSessionStoragesNode;
51 class CookieTreeIndexedDBNode; 56
52 class CookieTreeIndexedDBsNode;
53 class CookieTreeOriginNode;
54 57
55 // CookieTreeNode ------------------------------------------------------------- 58 // CookieTreeNode -------------------------------------------------------------
56 // The base node type in the Cookies, Databases, and Local Storage options 59 // 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 60 // 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 61 // that it has a notion of deleting objects stored in the profile, and being
59 // able to have its children do the same. 62 // able to have its children do the same.
60 class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { 63 class CookieTreeNode : public ui::TreeNode<CookieTreeNode> {
61 public: 64 public:
62 // Used to pull out information for the InfoView (the details display below 65 // Used to pull out information for the InfoView (the details display below
63 // the tree control.) 66 // the tree control.)
64 struct DetailedInfo { 67 struct DetailedInfo {
65 // NodeType corresponds to the various CookieTreeNode types. 68 // NodeType corresponds to the various CookieTreeNode types.
66 enum NodeType { 69 enum NodeType {
67 TYPE_NONE, 70 TYPE_NONE,
68 TYPE_ROOT, // This is used for CookieTreeRootNode nodes. 71 TYPE_ROOT, // This is used for CookieTreeRootNode nodes.
72 TYPE_APP, // This is used for CookieTreeAppNode nodes.
69 TYPE_ORIGIN, // This is used for CookieTreeOriginNode nodes. 73 TYPE_ORIGIN, // This is used for CookieTreeOriginNode nodes.
70 TYPE_COOKIES, // This is used for CookieTreeCookiesNode nodes. 74 TYPE_COOKIES, // This is used for CookieTreeCookiesNode nodes.
71 TYPE_COOKIE, // This is used for CookieTreeCookieNode nodes. 75 TYPE_COOKIE, // This is used for CookieTreeCookieNode nodes.
72 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. 76 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode.
73 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. 77 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode.
74 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. 78 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode.
75 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. 79 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode.
76 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. 80 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode.
77 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. 81 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode.
78 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. 82 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode.
(...skipping 21 matching lines...) Expand all
100 file_system_info(NULL), 104 file_system_info(NULL),
101 quota_info(NULL), 105 quota_info(NULL),
102 server_bound_cert(NULL) {} 106 server_bound_cert(NULL) {}
103 107
104 DetailedInfo& Init(NodeType type) { 108 DetailedInfo& Init(NodeType type) {
105 DCHECK_EQ(TYPE_NONE, node_type); 109 DCHECK_EQ(TYPE_NONE, node_type);
106 node_type = type; 110 node_type = type;
107 return *this; 111 return *this;
108 } 112 }
109 113
114 DetailedInfo& InitApp(const std::string& app_name,
115 const std::string& app_id) {
116 Init(TYPE_APP);
117 this->app_name = app_name;
118 this->app_id = app_id;
119 return *this;
120 }
121
110 DetailedInfo& InitCookie( 122 DetailedInfo& InitCookie(
111 const net::CookieMonster::CanonicalCookie* cookie) { 123 const net::CookieMonster::CanonicalCookie* cookie) {
112 Init(TYPE_COOKIE); 124 Init(TYPE_COOKIE);
113 this->cookie = cookie; 125 this->cookie = cookie;
114 return *this; 126 return *this;
115 } 127 }
116 128
117 DetailedInfo& InitDatabase( 129 DetailedInfo& InitDatabase(
118 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) { 130 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) {
119 Init(TYPE_DATABASE); 131 Init(TYPE_DATABASE);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return *this; 176 return *this;
165 } 177 }
166 178
167 DetailedInfo& InitServerBoundCert( 179 DetailedInfo& InitServerBoundCert(
168 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) { 180 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) {
169 Init(TYPE_SERVER_BOUND_CERT); 181 Init(TYPE_SERVER_BOUND_CERT);
170 this->server_bound_cert = server_bound_cert; 182 this->server_bound_cert = server_bound_cert;
171 return *this; 183 return *this;
172 } 184 }
173 185
186 std::string app_name;
187 std::string app_id;
174 string16 origin; 188 string16 origin;
175 NodeType node_type; 189 NodeType node_type;
176 const net::CookieMonster::CanonicalCookie* cookie; 190 const net::CookieMonster::CanonicalCookie* cookie;
177 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; 191 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info;
178 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; 192 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info;
179 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 193 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
180 session_storage_info; 194 session_storage_info;
181 const appcache::AppCacheInfo* appcache_info; 195 const appcache::AppCacheInfo* appcache_info;
182 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; 196 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info;
183 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; 197 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info;
(...skipping 11 matching lines...) Expand all
195 virtual void DeleteStoredObjects(); 209 virtual void DeleteStoredObjects();
196 210
197 // Gets a pointer back to the associated model for the tree we are in. 211 // Gets a pointer back to the associated model for the tree we are in.
198 virtual CookiesTreeModel* GetModel() const; 212 virtual CookiesTreeModel* GetModel() const;
199 213
200 // Returns a struct with detailed information used to populate the details 214 // Returns a struct with detailed information used to populate the details
201 // part of the view. 215 // part of the view.
202 virtual DetailedInfo GetDetailedInfo() const = 0; 216 virtual DetailedInfo GetDetailedInfo() const = 0;
203 217
204 protected: 218 protected:
205 class NodeTitleComparator { 219 class NodeTitleComparator {
James Hawkins 2012/06/21 00:04:12 nit: Document class.
nasko 2012/06/21 16:22:12 Done.
206 public: 220 public:
207 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs); 221 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs);
208 }; 222 };
209 223
224 class AppNodeComparator {
James Hawkins 2012/06/21 00:04:12 nit: Document class.
nasko 2012/06/21 16:22:12 Done.
225 public:
226 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs);
227 };
228
210 void AddChildSortedByTitle(CookieTreeNode* new_child); 229 void AddChildSortedByTitle(CookieTreeNode* new_child);
211 230
212 private: 231 private:
213 232
214 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode); 233 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode);
215 }; 234 };
216 235
217 // CookieTreeRootNode --------------------------------------------------------- 236 // CookieTreeRootNode ---------------------------------------------------------
218 // The node at the root of the CookieTree that gets inserted into the view. 237 // The node at the root of the CookieTree that gets inserted into the view.
219 class CookieTreeRootNode : public CookieTreeNode { 238 class CookieTreeRootNode : public CookieTreeNode {
220 public: 239 public:
221 explicit CookieTreeRootNode(CookiesTreeModel* model); 240 explicit CookieTreeRootNode(CookiesTreeModel* model);
222 virtual ~CookieTreeRootNode(); 241 virtual ~CookieTreeRootNode();
223 242
224 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url); 243 CookieTreeAppNode* GetOrCreateAppNode(const std::string& app_name,
James Hawkins 2012/06/21 00:04:12 nit: Document method.
nasko 2012/06/21 16:22:12 Done.
244 const std::string& app_id);
225 245
226 // CookieTreeNode methods: 246 // CookieTreeNode methods:
227 virtual CookiesTreeModel* GetModel() const OVERRIDE; 247 virtual CookiesTreeModel* GetModel() const OVERRIDE;
228 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 248 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
229 249
230 private: 250 private:
231 CookiesTreeModel* model_; 251 CookiesTreeModel* model_;
232 252
233 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode); 253 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode);
234 }; 254 };
235 255
256 // CookieTreeAppNode ----------------------------------------------------------
257 class CookieTreeAppNode : public CookieTreeNode {
James Hawkins 2012/06/21 00:04:12 Why not move the definition of this class above it
nasko 2012/06/21 16:22:12 Done.
258 public:
259 explicit CookieTreeAppNode(const std::string& app_name,
260 const std::string& app_id);
261 virtual ~CookieTreeAppNode();
262
263 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url);
264
265 // CookieTreeNode methods:
266 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
267
268 const std::string& app_id() const { return app_id_; }
269
270 private:
271 std::string app_name_;
272 std::string app_id_;
273
274 DISALLOW_COPY_AND_ASSIGN(CookieTreeAppNode);
275 };
276
236 // CookieTreeOriginNode ------------------------------------------------------- 277 // CookieTreeOriginNode -------------------------------------------------------
237 class CookieTreeOriginNode : public CookieTreeNode { 278 class CookieTreeOriginNode : public CookieTreeNode {
238 public: 279 public:
239 // Returns the origin node's title to use for a given URL. 280 // Returns the origin node's title to use for a given URL.
240 static std::wstring TitleForUrl(const GURL& url); 281 static string16 TitleForUrl(const GURL& url);
241 282
242 explicit CookieTreeOriginNode(const GURL& url); 283 explicit CookieTreeOriginNode(const GURL& url);
243 virtual ~CookieTreeOriginNode(); 284 virtual ~CookieTreeOriginNode();
244 285
245 // CookieTreeNode methods: 286 // CookieTreeNode methods:
246 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 287 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
247 288
248 // CookieTreeOriginNode methods: 289 // CookieTreeOriginNode methods:
249 CookieTreeCookiesNode* GetOrCreateCookiesNode(); 290 CookieTreeCookiesNode* GetOrCreateCookiesNode();
250 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); 291 CookieTreeDatabasesNode* GetOrCreateDatabasesNode();
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 648 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
608 649
609 void AddServerBoundCertNode(CookieTreeServerBoundCertNode* child) { 650 void AddServerBoundCertNode(CookieTreeServerBoundCertNode* child) {
610 AddChildSortedByTitle(child); 651 AddChildSortedByTitle(child);
611 } 652 }
612 653
613 private: 654 private:
614 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode); 655 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode);
615 }; 656 };
616 657
658 // CookiesTreeModelDelegate ---------------------------------------------------
659 // This is a delegate definition class. It is used by the CookiesTreeModel
660 // to pass a pointer to itself to each of the LocalDataContainer objects, so
661 // when resource fetching is complete, the objects can call back to the model
662 // and update it. The CookiesTreeModel instance must outlive the
663 // LocalDataContainer instances.
664 class CookiesTreeModelDelegate {
665 public:
666 virtual void PopulateAppCacheInfoWithFilter(const std::string* app_id,
667 const string16& filter) {}
James Hawkins 2012/06/21 00:04:12 Why not make the interface abstract?
nasko 2012/06/21 16:22:12 Done.
668 virtual void PopulateCookieInfoWithFilter(const std::string* app_id,
669 const string16& filter) {}
670 virtual void PopulateDatabaseInfoWithFilter(const std::string* app_id,
671 const string16& filter) {}
672 virtual void PopulateLocalStorageInfoWithFilter(const std::string* app_id,
673 const string16& filter) {}
674 virtual void PopulateSessionStorageInfoWithFilter(
675 const std::string* app_id, const string16& filter) {}
676 virtual void PopulateIndexedDBInfoWithFilter(const std::string* app_id,
677 const string16& filter) {}
678 virtual void PopulateFileSystemInfoWithFilter(const std::string* app_id,
679 const string16& filter) {}
680 virtual void PopulateQuotaInfoWithFilter(const std::string* app_id,
681 const string16& filter) {}
682 virtual void PopulateServerBoundCertInfoWithFilter(
683 const std::string* app_id, const string16& filter) {}
684 };
685
617 // CookiesTreeModel ----------------------------------------------------------- 686 // CookiesTreeModel -----------------------------------------------------------
618 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { 687 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode>,
688 public CookiesTreeModelDelegate {
619 public: 689 public:
690 CookiesTreeModel(const ContainerMap& apps_map, bool use_cookie_source);
691 virtual ~CookiesTreeModel();
692
620 // Because non-cookie nodes are fetched in a background thread, they are not 693 // Because non-cookie nodes are fetched in a background thread, they are not
621 // present at the time the Model is created. The Model then notifies its 694 // present at the time the Model is created. The Model then notifies its
622 // observers for every item added from databases, local storage, and 695 // observers for every item added from databases, local storage, and
623 // appcache. We extend the Observer interface to add notifications before and 696 // appcache. We extend the Observer interface to add notifications before and
624 // after these batch inserts. 697 // after these batch inserts.
625 class Observer : public ui::TreeModelObserver { 698 class Observer : public ui::TreeModelObserver {
626 public: 699 public:
627 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {} 700 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {}
628 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} 701 virtual void TreeModelEndBatch(CookiesTreeModel* model) {}
629 }; 702 };
630 703
631 CookiesTreeModel(
632 BrowsingDataCookieHelper* cookie_helper,
633 BrowsingDataDatabaseHelper* database_helper,
634 BrowsingDataLocalStorageHelper* local_storage_helper,
635 BrowsingDataLocalStorageHelper* session_storage_helper,
636 BrowsingDataAppCacheHelper* appcache_helper,
637 BrowsingDataIndexedDBHelper* indexed_db_helper,
638 BrowsingDataFileSystemHelper* file_system_helper,
639 BrowsingDataQuotaHelper* quota_helper,
640 BrowsingDataServerBoundCertHelper* server_bound_cert_helper,
641 bool use_cookie_source);
642 virtual ~CookiesTreeModel();
643
644 // ui::TreeModel methods: 704 // ui::TreeModel methods:
645 // Returns the set of icons for the nodes in the tree. You only need override 705 // 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. 706 // this if you don't want to use the default folder icons.
647 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; 707 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE;
648 708
649 // Returns the index of the icon to use for |node|. Return -1 to use the 709 // 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 710 // default icon. The index is relative to the list of icons returned from
651 // GetIcons. 711 // GetIcons.
652 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; 712 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE;
653 713
654 // CookiesTreeModel methods: 714 // CookiesTreeModel methods:
655 void DeleteAllStoredObjects(); 715 void DeleteAllStoredObjects();
716
717 // Deletes all the stored objects for a specific app, identified by |app_id|.
718 void DeleteStoredObjectsForApp(const std::string& app_id);
656 void DeleteCookieNode(CookieTreeNode* cookie_node); 719 void DeleteCookieNode(CookieTreeNode* cookie_node);
657 720
658 // Filter the origins to only display matched results. 721 // Filter the origins to only display matched results.
659 void UpdateSearchResults(const std::wstring& filter); 722 void UpdateSearchResults(const string16& filter);
660 723
661 // Manages CookiesTreeModel::Observers. This will also call 724 // Manages CookiesTreeModel::Observers. This will also call
662 // TreeNodeModel::AddObserver so that it gets all the proper notifications. 725 // TreeNodeModel::AddObserver so that it gets all the proper notifications.
663 // Note that the converse is not true: simply adding a TreeModelObserver will 726 // Note that the converse is not true: simply adding a TreeModelObserver will
664 // not get CookiesTreeModel::Observer notifications. 727 // not get CookiesTreeModel::Observer notifications.
665 virtual void AddCookiesTreeObserver(Observer* observer); 728 virtual void AddCookiesTreeObserver(Observer* observer);
666 virtual void RemoveCookiesTreeObserver(Observer* observer); 729 virtual void RemoveCookiesTreeObserver(Observer* observer);
667 730
731 // CookiesTreeModelDelegate methods:
732 virtual void PopulateAppCacheInfoWithFilter(
733 const std::string* app_id, const string16& filter) OVERRIDE;
734 virtual void PopulateCookieInfoWithFilter(
735 const std::string* app_id, const string16& filter) OVERRIDE;
736 virtual void PopulateDatabaseInfoWithFilter(
737 const std::string* app_id, const string16& filter) OVERRIDE;
738 virtual void PopulateLocalStorageInfoWithFilter(
739 const std::string* app_id, const string16& filter) OVERRIDE;
740 virtual void PopulateSessionStorageInfoWithFilter(
741 const std::string* app_id, const string16& filter) OVERRIDE;
742 virtual void PopulateIndexedDBInfoWithFilter(
743 const std::string* app_id, const string16& filter) OVERRIDE;
744 virtual void PopulateFileSystemInfoWithFilter(
745 const std::string* app_id, const string16& filter) OVERRIDE;
746 virtual void PopulateQuotaInfoWithFilter(
747 const std::string* app_id, const string16& filter) OVERRIDE;
748 virtual void PopulateServerBoundCertInfoWithFilter(
749 const std::string* app_id, const string16& filter) OVERRIDE;
750
751 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id);
752 LocalDataContainer* GetLocalDataContainer(const std::string& app_id);
753
668 private: 754 private:
669 enum CookieIconIndex { 755 enum CookieIconIndex {
670 ORIGIN = 0, 756 ORIGIN = 0,
671 COOKIE = 1, 757 COOKIE = 1,
672 DATABASE = 2 758 DATABASE = 2
673 }; 759 };
674 typedef std::list<net::CookieMonster::CanonicalCookie> CookieList;
675 typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo>
676 DatabaseInfoList;
677 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>
678 LocalStorageInfoList;
679 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>
680 SessionStorageInfoList;
681 typedef std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>
682 IndexedDBInfoList;
683 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo>
684 FileSystemInfoList;
685 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray;
686 typedef net::ServerBoundCertStore::ServerBoundCertList ServerBoundCertList;
687
688 void OnAppCacheModelInfoLoaded();
689 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list);
690 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info);
691 void OnLocalStorageModelInfoLoaded(
692 const LocalStorageInfoList& local_storage_info);
693 void OnSessionStorageModelInfoLoaded(
694 const LocalStorageInfoList& local_storage_info);
695 void OnIndexedDBModelInfoLoaded(
696 const IndexedDBInfoList& indexed_db_info);
697 void OnFileSystemModelInfoLoaded(
698 const FileSystemInfoList& file_system_info);
699 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info);
700 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list);
701
702 void PopulateAppCacheInfoWithFilter(const std::wstring& filter);
703 void PopulateCookieInfoWithFilter(const std::wstring& filter);
704 void PopulateDatabaseInfoWithFilter(const std::wstring& filter);
705 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter);
706 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter);
707 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter);
708 void PopulateFileSystemInfoWithFilter(const std::wstring& filter);
709 void PopulateQuotaInfoWithFilter(const std::wstring& filter);
710 void PopulateServerBoundCertInfoWithFilter(const std::wstring& filter);
711 760
712 void NotifyObserverBeginBatch(); 761 void NotifyObserverBeginBatch();
713 void NotifyObserverEndBatch(); 762 void NotifyObserverEndBatch();
714 763
715 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; 764 // Map of app ids to LocalDataContainer objects to use when retrieving
716 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; 765 // locally stored data.
717 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; 766 ContainerMap app_data_map_;
718 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_;
719 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_;
720 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_;
721 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_;
722 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_;
723 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_;
724
725 std::map<GURL, std::list<appcache::AppCacheInfo> > appcache_info_;
726 CookieList cookie_list_;
727 DatabaseInfoList database_info_list_;
728 LocalStorageInfoList local_storage_info_list_;
729 LocalStorageInfoList session_storage_info_list_;
730 IndexedDBInfoList indexed_db_info_list_;
731 FileSystemInfoList file_system_info_list_;
732 QuotaInfoArray quota_info_list_;
733 ServerBoundCertList server_bound_cert_list_;
734 767
735 // The CookiesTreeModel maintains a separate list of observers that are 768 // The CookiesTreeModel maintains a separate list of observers that are
736 // specifically of the type CookiesTreeModel::Observer. 769 // specifically of the type CookiesTreeModel::Observer.
737 ObserverList<Observer> cookies_observer_list_; 770 ObserverList<Observer> cookies_observer_list_;
738 771
772 // If true, use the CanonicalCookie::Source attribute to group cookies.
773 // Otherwise, use the CanonicalCookie::Domain attribute.
774 bool use_cookie_source_;
775
739 // If this is non-zero, then this model is batching updates (there's a lot of 776 // 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 777 // 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. 778 // calls to Begin/EndBatch() if they're called in a nested manner.
742 int batch_update_; 779 int batch_update_;
743
744 // If true, use the CanonicalCookie::Source attribute to group cookies.
745 // Otherwise, use the CanonicalCookie::Domain attribute.
746 bool use_cookie_source_;
747
748 base::WeakPtrFactory<CookiesTreeModel> weak_ptr_factory_;
749
750 friend class CookieTreeAppCacheNode;
751 friend class CookieTreeCookieNode;
752 friend class CookieTreeDatabaseNode;
753 friend class CookieTreeLocalStorageNode;
754 friend class CookieTreeSessionStorageNode;
755 friend class CookieTreeIndexedDBNode;
756 friend class CookieTreeFileSystemNode;
757 friend class CookieTreeQuotaNode;
758 friend class CookieTreeServerBoundCertNode;
759
760 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel);
761 }; 780 };
762 781
763 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ 782 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cookies_tree_model.cc » ('j') | chrome/browser/cookies_tree_model.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698