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

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: Fixes for commes by James and 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
« no previous file with comments | « no previous file | chrome/browser/cookies_tree_model.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
38 class CookieTreeCookieNode; 39 class CookieTreeCookieNode;
39 class CookieTreeCookiesNode; 40 class CookieTreeCookiesNode;
40 class CookieTreeDatabaseNode; 41 class CookieTreeDatabaseNode;
41 class CookieTreeDatabasesNode; 42 class CookieTreeDatabasesNode;
43 class CookieTreeFileSystemNode;
42 class CookieTreeFileSystemsNode; 44 class CookieTreeFileSystemsNode;
43 class CookieTreeFileSystemNode; 45 class CookieTreeIndexedDBNode;
46 class CookieTreeIndexedDBsNode;
44 class CookieTreeLocalStorageNode; 47 class CookieTreeLocalStorageNode;
45 class CookieTreeLocalStoragesNode; 48 class CookieTreeLocalStoragesNode;
49 class CookieTreeOriginNode;
50 class CookieTreeQuotaNode;
46 class CookieTreeServerBoundCertNode; 51 class CookieTreeServerBoundCertNode;
47 class CookieTreeServerBoundCertsNode; 52 class CookieTreeServerBoundCertsNode;
48 class CookieTreeQuotaNode;
49 class CookieTreeSessionStorageNode; 53 class CookieTreeSessionStorageNode;
50 class CookieTreeSessionStoragesNode; 54 class CookieTreeSessionStoragesNode;
51 class CookieTreeIndexedDBNode; 55
52 class CookieTreeIndexedDBsNode;
53 class CookieTreeOriginNode;
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.
71 TYPE_APP, // This is used for CookieTreeAppNode nodes.
69 TYPE_ORIGIN, // This is used for CookieTreeOriginNode nodes. 72 TYPE_ORIGIN, // This is used for CookieTreeOriginNode nodes.
70 TYPE_COOKIES, // This is used for CookieTreeCookiesNode nodes. 73 TYPE_COOKIES, // This is used for CookieTreeCookiesNode nodes.
71 TYPE_COOKIE, // This is used for CookieTreeCookieNode nodes. 74 TYPE_COOKIE, // This is used for CookieTreeCookieNode nodes.
72 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode. 75 TYPE_DATABASES, // This is used for CookieTreeDatabasesNode.
73 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode. 76 TYPE_DATABASE, // This is used for CookieTreeDatabaseNode.
74 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode. 77 TYPE_LOCAL_STORAGES, // This is used for CookieTreeLocalStoragesNode.
75 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode. 78 TYPE_LOCAL_STORAGE, // This is used for CookieTreeLocalStorageNode.
76 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode. 79 TYPE_SESSION_STORAGES, // This is used for CookieTreeSessionStoragesNode.
77 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. 80 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode.
78 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. 81 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode.
(...skipping 21 matching lines...) Expand all
100 file_system_info(NULL), 103 file_system_info(NULL),
101 quota_info(NULL), 104 quota_info(NULL),
102 server_bound_cert(NULL) {} 105 server_bound_cert(NULL) {}
103 106
104 DetailedInfo& Init(NodeType type) { 107 DetailedInfo& Init(NodeType type) {
105 DCHECK_EQ(TYPE_NONE, node_type); 108 DCHECK_EQ(TYPE_NONE, node_type);
106 node_type = type; 109 node_type = type;
107 return *this; 110 return *this;
108 } 111 }
109 112
113 DetailedInfo& InitApp(const std::string& app_name,
114 const std::string& app_id) {
115 Init(TYPE_APP);
116 this->app_name = app_name;
117 this->app_id = app_id;
118 return *this;
119 }
120
110 DetailedInfo& InitCookie( 121 DetailedInfo& InitCookie(
111 const net::CookieMonster::CanonicalCookie* cookie) { 122 const net::CookieMonster::CanonicalCookie* cookie) {
112 Init(TYPE_COOKIE); 123 Init(TYPE_COOKIE);
113 this->cookie = cookie; 124 this->cookie = cookie;
114 return *this; 125 return *this;
115 } 126 }
116 127
117 DetailedInfo& InitDatabase( 128 DetailedInfo& InitDatabase(
118 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) { 129 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) {
119 Init(TYPE_DATABASE); 130 Init(TYPE_DATABASE);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return *this; 175 return *this;
165 } 176 }
166 177
167 DetailedInfo& InitServerBoundCert( 178 DetailedInfo& InitServerBoundCert(
168 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) { 179 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) {
169 Init(TYPE_SERVER_BOUND_CERT); 180 Init(TYPE_SERVER_BOUND_CERT);
170 this->server_bound_cert = server_bound_cert; 181 this->server_bound_cert = server_bound_cert;
171 return *this; 182 return *this;
172 } 183 }
173 184
185 std::string app_name;
186 std::string app_id;
174 string16 origin; 187 string16 origin;
175 NodeType node_type; 188 NodeType node_type;
176 const net::CookieMonster::CanonicalCookie* cookie; 189 const net::CookieMonster::CanonicalCookie* cookie;
177 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; 190 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info;
178 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; 191 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info;
179 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 192 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
180 session_storage_info; 193 session_storage_info;
181 const appcache::AppCacheInfo* appcache_info; 194 const appcache::AppCacheInfo* appcache_info;
182 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; 195 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info;
183 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; 196 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info;
(...skipping 11 matching lines...) Expand all
195 virtual void DeleteStoredObjects(); 208 virtual void DeleteStoredObjects();
196 209
197 // Gets a pointer back to the associated model for the tree we are in. 210 // Gets a pointer back to the associated model for the tree we are in.
198 virtual CookiesTreeModel* GetModel() const; 211 virtual CookiesTreeModel* GetModel() const;
199 212
200 // Returns a struct with detailed information used to populate the details 213 // Returns a struct with detailed information used to populate the details
201 // part of the view. 214 // part of the view.
202 virtual DetailedInfo GetDetailedInfo() const = 0; 215 virtual DetailedInfo GetDetailedInfo() const = 0;
203 216
204 protected: 217 protected:
218 // This class implements comparison by title of a CookieTreeNode. It is
219 // used to insert nodes in alphabetical order.
205 class NodeTitleComparator { 220 class NodeTitleComparator {
206 public: 221 public:
207 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs); 222 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs);
208 }; 223 };
209 224
225 // This class implements comparison by application id of a CookieTreeAppNode.
226 class AppNodeComparator {
227 public:
228 bool operator() (const CookieTreeNode* lhs, const CookieTreeNode* rhs);
229 };
230
210 void AddChildSortedByTitle(CookieTreeNode* new_child); 231 void AddChildSortedByTitle(CookieTreeNode* new_child);
211 232
212 private: 233 private:
213 234
214 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode); 235 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode);
215 }; 236 };
216 237
238 // CookieTreeAppNode ----------------------------------------------------------
239 class CookieTreeAppNode : public CookieTreeNode {
240 public:
241 explicit CookieTreeAppNode(const std::string& app_name,
242 const std::string& app_id);
243 virtual ~CookieTreeAppNode();
244
245 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url);
246
247 // CookieTreeNode methods:
248 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
249
250 const std::string& app_id() const { return app_id_; }
251
252 private:
253 std::string app_name_;
254 std::string app_id_;
255
256 DISALLOW_COPY_AND_ASSIGN(CookieTreeAppNode);
257 };
258
217 // CookieTreeRootNode --------------------------------------------------------- 259 // CookieTreeRootNode ---------------------------------------------------------
218 // The node at the root of the CookieTree that gets inserted into the view. 260 // The node at the root of the CookieTree that gets inserted into the view.
219 class CookieTreeRootNode : public CookieTreeNode { 261 class CookieTreeRootNode : public CookieTreeNode {
220 public: 262 public:
221 explicit CookieTreeRootNode(CookiesTreeModel* model); 263 explicit CookieTreeRootNode(CookiesTreeModel* model);
222 virtual ~CookieTreeRootNode(); 264 virtual ~CookieTreeRootNode();
223 265
224 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url); 266 // Creates a new CookieTreeAppNode, based on the app id and name. If a node,
267 // already exists in the tree, it returns a pointer to it.
268 CookieTreeAppNode* GetOrCreateAppNode(const std::string& app_name,
269 const std::string& app_id);
225 270
226 // CookieTreeNode methods: 271 // CookieTreeNode methods:
227 virtual CookiesTreeModel* GetModel() const OVERRIDE; 272 virtual CookiesTreeModel* GetModel() const OVERRIDE;
228 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 273 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
229 274
230 private: 275 private:
231 CookiesTreeModel* model_; 276 CookiesTreeModel* model_;
232 277
233 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode); 278 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode);
234 }; 279 };
235 280
236 // CookieTreeOriginNode ------------------------------------------------------- 281 // CookieTreeOriginNode -------------------------------------------------------
237 class CookieTreeOriginNode : public CookieTreeNode { 282 class CookieTreeOriginNode : public CookieTreeNode {
238 public: 283 public:
239 // Returns the origin node's title to use for a given URL. 284 // Returns the origin node's title to use for a given URL.
240 static std::wstring TitleForUrl(const GURL& url); 285 static string16 TitleForUrl(const GURL& url);
241 286
242 explicit CookieTreeOriginNode(const GURL& url); 287 explicit CookieTreeOriginNode(const GURL& url);
243 virtual ~CookieTreeOriginNode(); 288 virtual ~CookieTreeOriginNode();
244 289
245 // CookieTreeNode methods: 290 // CookieTreeNode methods:
246 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 291 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
247 292
248 // CookieTreeOriginNode methods: 293 // CookieTreeOriginNode methods:
249 CookieTreeCookiesNode* GetOrCreateCookiesNode(); 294 CookieTreeCookiesNode* GetOrCreateCookiesNode();
250 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); 295 CookieTreeDatabasesNode* GetOrCreateDatabasesNode();
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 652 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
608 653
609 void AddServerBoundCertNode(CookieTreeServerBoundCertNode* child) { 654 void AddServerBoundCertNode(CookieTreeServerBoundCertNode* child) {
610 AddChildSortedByTitle(child); 655 AddChildSortedByTitle(child);
611 } 656 }
612 657
613 private: 658 private:
614 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode); 659 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode);
615 }; 660 };
616 661
662 // CookiesTreeModelDelegate ---------------------------------------------------
663 // This is a delegate definition class. It is used by the CookiesTreeModel
664 // to pass a pointer to itself to each of the LocalDataContainer objects, so
665 // when resource fetching is complete, the objects can call back to the model
666 // and update it. The CookiesTreeModel instance must outlive the
667 // LocalDataContainer instances.
668 class CookiesTreeModelDelegate {
669 public:
670 virtual void PopulateAppCacheInfoWithFilter(const std::string* app_id,
671 const string16& filter) = 0;
672 virtual void PopulateCookieInfoWithFilter(const std::string* app_id,
673 const string16& filter) = 0;
674 virtual void PopulateDatabaseInfoWithFilter(const std::string* app_id,
675 const string16& filter) = 0;
676 virtual void PopulateLocalStorageInfoWithFilter(const std::string* app_id,
677 const string16& filter) = 0;
678 virtual void PopulateSessionStorageInfoWithFilter(
679 const std::string* app_id, const string16& filter) = 0;
680 virtual void PopulateIndexedDBInfoWithFilter(const std::string* app_id,
681 const string16& filter) = 0;
682 virtual void PopulateFileSystemInfoWithFilter(const std::string* app_id,
683 const string16& filter) = 0;
684 virtual void PopulateQuotaInfoWithFilter(const std::string* app_id,
685 const string16& filter) = 0;
686 virtual void PopulateServerBoundCertInfoWithFilter(
687 const std::string* app_id, const string16& filter) = 0;
688 };
689
617 // CookiesTreeModel ----------------------------------------------------------- 690 // CookiesTreeModel -----------------------------------------------------------
618 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { 691 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode>,
692 public CookiesTreeModelDelegate {
619 public: 693 public:
694 CookiesTreeModel(const ContainerMap& apps_map, bool use_cookie_source);
695 virtual ~CookiesTreeModel();
696
620 // Because non-cookie nodes are fetched in a background thread, they are not 697 // 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 698 // present at the time the Model is created. The Model then notifies its
622 // observers for every item added from databases, local storage, and 699 // observers for every item added from databases, local storage, and
623 // appcache. We extend the Observer interface to add notifications before and 700 // appcache. We extend the Observer interface to add notifications before and
624 // after these batch inserts. 701 // after these batch inserts.
625 class Observer : public ui::TreeModelObserver { 702 class Observer : public ui::TreeModelObserver {
626 public: 703 public:
627 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {} 704 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {}
628 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} 705 virtual void TreeModelEndBatch(CookiesTreeModel* model) {}
629 }; 706 };
630 707
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: 708 // ui::TreeModel methods:
645 // Returns the set of icons for the nodes in the tree. You only need override 709 // 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. 710 // this if you don't want to use the default folder icons.
647 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; 711 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE;
648 712
649 // Returns the index of the icon to use for |node|. Return -1 to use the 713 // 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 714 // default icon. The index is relative to the list of icons returned from
651 // GetIcons. 715 // GetIcons.
652 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; 716 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE;
653 717
654 // CookiesTreeModel methods: 718 // CookiesTreeModel methods:
655 void DeleteAllStoredObjects(); 719 void DeleteAllStoredObjects();
720
721 // Deletes all the stored objects for a specific app, identified by |app_id|.
722 void DeleteStoredObjectsForApp(const std::string& app_id);
656 void DeleteCookieNode(CookieTreeNode* cookie_node); 723 void DeleteCookieNode(CookieTreeNode* cookie_node);
657 724
658 // Filter the origins to only display matched results. 725 // Filter the origins to only display matched results.
659 void UpdateSearchResults(const std::wstring& filter); 726 void UpdateSearchResults(const string16& filter);
660 727
661 // Manages CookiesTreeModel::Observers. This will also call 728 // Manages CookiesTreeModel::Observers. This will also call
662 // TreeNodeModel::AddObserver so that it gets all the proper notifications. 729 // TreeNodeModel::AddObserver so that it gets all the proper notifications.
663 // Note that the converse is not true: simply adding a TreeModelObserver will 730 // Note that the converse is not true: simply adding a TreeModelObserver will
664 // not get CookiesTreeModel::Observer notifications. 731 // not get CookiesTreeModel::Observer notifications.
665 virtual void AddCookiesTreeObserver(Observer* observer); 732 virtual void AddCookiesTreeObserver(Observer* observer);
666 virtual void RemoveCookiesTreeObserver(Observer* observer); 733 virtual void RemoveCookiesTreeObserver(Observer* observer);
667 734
735 // CookiesTreeModelDelegate methods:
736 virtual void PopulateAppCacheInfoWithFilter(
737 const std::string* app_id, const string16& filter) OVERRIDE;
738 virtual void PopulateCookieInfoWithFilter(
739 const std::string* app_id, const string16& filter) OVERRIDE;
740 virtual void PopulateDatabaseInfoWithFilter(
741 const std::string* app_id, const string16& filter) OVERRIDE;
742 virtual void PopulateLocalStorageInfoWithFilter(
743 const std::string* app_id, const string16& filter) OVERRIDE;
744 virtual void PopulateSessionStorageInfoWithFilter(
745 const std::string* app_id, const string16& filter) OVERRIDE;
746 virtual void PopulateIndexedDBInfoWithFilter(
747 const std::string* app_id, const string16& filter) OVERRIDE;
748 virtual void PopulateFileSystemInfoWithFilter(
749 const std::string* app_id, const string16& filter) OVERRIDE;
750 virtual void PopulateQuotaInfoWithFilter(
751 const std::string* app_id, const string16& filter) OVERRIDE;
752 virtual void PopulateServerBoundCertInfoWithFilter(
753 const std::string* app_id, const string16& filter) OVERRIDE;
754
755 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id);
756 LocalDataContainer* GetLocalDataContainer(const std::string& app_id);
757
668 private: 758 private:
669 enum CookieIconIndex { 759 enum CookieIconIndex {
670 ORIGIN = 0, 760 ORIGIN = 0,
671 COOKIE = 1, 761 COOKIE = 1,
672 DATABASE = 2 762 DATABASE = 2
673 }; 763 };
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 764
712 void NotifyObserverBeginBatch(); 765 void NotifyObserverBeginBatch();
713 void NotifyObserverEndBatch(); 766 void NotifyObserverEndBatch();
714 767
715 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; 768 // Map of app ids to LocalDataContainer objects to use when retrieving
716 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; 769 // locally stored data.
717 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; 770 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 771
735 // The CookiesTreeModel maintains a separate list of observers that are 772 // The CookiesTreeModel maintains a separate list of observers that are
736 // specifically of the type CookiesTreeModel::Observer. 773 // specifically of the type CookiesTreeModel::Observer.
737 ObserverList<Observer> cookies_observer_list_; 774 ObserverList<Observer> cookies_observer_list_;
738 775
776 // If true, use the CanonicalCookie::Source attribute to group cookies.
777 // Otherwise, use the CanonicalCookie::Domain attribute.
778 bool use_cookie_source_;
779
739 // If this is non-zero, then this model is batching updates (there's a lot of 780 // 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 781 // 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. 782 // calls to Begin/EndBatch() if they're called in a nested manner.
742 int batch_update_; 783 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 }; 784 };
762 785
763 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ 786 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cookies_tree_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698