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

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

Issue 10636019: Adding Application Data dialog for isolated apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed merge conflicts Created 8 years, 5 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 | « chrome/app/generated_resources.grd ('k') | 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.)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 file_system_info(NULL), 102 file_system_info(NULL),
101 quota_info(NULL), 103 quota_info(NULL),
102 server_bound_cert(NULL) {} 104 server_bound_cert(NULL) {}
103 105
104 DetailedInfo& Init(NodeType type) { 106 DetailedInfo& Init(NodeType type) {
105 DCHECK_EQ(TYPE_NONE, node_type); 107 DCHECK_EQ(TYPE_NONE, node_type);
106 node_type = type; 108 node_type = type;
107 return *this; 109 return *this;
108 } 110 }
109 111
112 DetailedInfo& InitOrigin(const std::string& app_id,
113 const std::string& app_name) {
114 Init(TYPE_ORIGIN);
115 this->app_name = app_name;
116 this->app_id = app_id;
117 return *this;
118 }
119
110 DetailedInfo& InitCookie( 120 DetailedInfo& InitCookie(
111 const net::CookieMonster::CanonicalCookie* cookie) { 121 const net::CookieMonster::CanonicalCookie* cookie) {
112 Init(TYPE_COOKIE); 122 Init(TYPE_COOKIE);
113 this->cookie = cookie; 123 this->cookie = cookie;
114 return *this; 124 return *this;
115 } 125 }
116 126
117 DetailedInfo& InitDatabase( 127 DetailedInfo& InitDatabase(
118 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) { 128 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info) {
119 Init(TYPE_DATABASE); 129 Init(TYPE_DATABASE);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 return *this; 174 return *this;
165 } 175 }
166 176
167 DetailedInfo& InitServerBoundCert( 177 DetailedInfo& InitServerBoundCert(
168 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) { 178 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert) {
169 Init(TYPE_SERVER_BOUND_CERT); 179 Init(TYPE_SERVER_BOUND_CERT);
170 this->server_bound_cert = server_bound_cert; 180 this->server_bound_cert = server_bound_cert;
171 return *this; 181 return *this;
172 } 182 }
173 183
184 std::string app_name;
185 std::string app_id;
174 string16 origin; 186 string16 origin;
175 NodeType node_type; 187 NodeType node_type;
176 const net::CookieMonster::CanonicalCookie* cookie; 188 const net::CookieMonster::CanonicalCookie* cookie;
177 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; 189 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info;
178 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; 190 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info;
179 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 191 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
180 session_storage_info; 192 session_storage_info;
181 const appcache::AppCacheInfo* appcache_info; 193 const appcache::AppCacheInfo* appcache_info;
182 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; 194 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info;
183 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; 195 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info;
(...skipping 25 matching lines...) Expand all
209 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode); 221 DISALLOW_COPY_AND_ASSIGN(CookieTreeNode);
210 }; 222 };
211 223
212 // CookieTreeRootNode --------------------------------------------------------- 224 // CookieTreeRootNode ---------------------------------------------------------
213 // The node at the root of the CookieTree that gets inserted into the view. 225 // The node at the root of the CookieTree that gets inserted into the view.
214 class CookieTreeRootNode : public CookieTreeNode { 226 class CookieTreeRootNode : public CookieTreeNode {
215 public: 227 public:
216 explicit CookieTreeRootNode(CookiesTreeModel* model); 228 explicit CookieTreeRootNode(CookiesTreeModel* model);
217 virtual ~CookieTreeRootNode(); 229 virtual ~CookieTreeRootNode();
218 230
219 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url); 231 CookieTreeOriginNode* GetOrCreateOriginNode(const GURL& url,
232 const std::string& app_id,
233 const std::string& app_name);
220 234
221 // CookieTreeNode methods: 235 // CookieTreeNode methods:
222 virtual CookiesTreeModel* GetModel() const OVERRIDE; 236 virtual CookiesTreeModel* GetModel() const OVERRIDE;
223 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 237 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
224 238
225 private: 239 private:
226 CookiesTreeModel* model_; 240 CookiesTreeModel* model_;
227 241
228 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode); 242 DISALLOW_COPY_AND_ASSIGN(CookieTreeRootNode);
229 }; 243 };
230 244
231 // CookieTreeOriginNode ------------------------------------------------------- 245 // CookieTreeOriginNode -------------------------------------------------------
232 class CookieTreeOriginNode : public CookieTreeNode { 246 class CookieTreeOriginNode : public CookieTreeNode {
233 public: 247 public:
234 // Returns the origin node's title to use for a given URL. 248 // Returns the origin node's title to use for a given URL.
235 static std::wstring TitleForUrl(const GURL& url); 249 static string16 TitleForUrl(const GURL& url,
250 const std::string& app_id,
251 const std::string& app_name);
236 252
237 explicit CookieTreeOriginNode(const GURL& url); 253 explicit CookieTreeOriginNode(const GURL& url,
254 const std::string& app_id,
255 const std::string& app_name);
238 virtual ~CookieTreeOriginNode(); 256 virtual ~CookieTreeOriginNode();
239 257
240 // CookieTreeNode methods: 258 // CookieTreeNode methods:
241 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 259 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
242 260
243 // CookieTreeOriginNode methods: 261 // CookieTreeOriginNode methods:
244 CookieTreeCookiesNode* GetOrCreateCookiesNode(); 262 CookieTreeCookiesNode* GetOrCreateCookiesNode();
245 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); 263 CookieTreeDatabasesNode* GetOrCreateDatabasesNode();
246 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); 264 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode();
247 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); 265 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode();
248 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); 266 CookieTreeAppCachesNode* GetOrCreateAppCachesNode();
249 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); 267 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode();
250 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); 268 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode();
251 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode(); 269 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode();
252 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( 270 CookieTreeQuotaNode* UpdateOrCreateQuotaNode(
253 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); 271 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info);
254 272
255 // Creates an content exception for this origin of type 273 // Creates an content exception for this origin of type
256 // CONTENT_SETTINGS_TYPE_COOKIES. 274 // CONTENT_SETTINGS_TYPE_COOKIES.
257 void CreateContentException(CookieSettings* cookie_settings, 275 void CreateContentException(CookieSettings* cookie_settings,
258 ContentSetting setting) const; 276 ContentSetting setting) const;
259 277
260 // True if a content exception can be created for this origin. 278 // True if a content exception can be created for this origin.
261 bool CanCreateContentException() const; 279 bool CanCreateContentException() const;
262 280
281 const std::string& app_id() const { return app_id_; }
282 const std::string& app_name() const { return app_name_; }
283 const std::string GetHost() const;
284
263 private: 285 private:
264 // Pointers to the cookies, databases, local and session storage and appcache 286 // Pointers to the cookies, databases, local and session storage and appcache
265 // nodes. When we build up the tree we need to quickly get a reference to 287 // nodes. When we build up the tree we need to quickly get a reference to
266 // the COOKIES node to add children. Checking each child and interrogating 288 // the COOKIES node to add children. Checking each child and interrogating
267 // them to see if they are a COOKIES, APPCACHES, DATABASES etc node seems 289 // them to see if they are a COOKIES, APPCACHES, DATABASES etc node seems
268 // less preferable than storing an extra pointer per origin. 290 // less preferable than storing an extra pointer per origin.
269 CookieTreeCookiesNode* cookies_child_; 291 CookieTreeCookiesNode* cookies_child_;
270 CookieTreeDatabasesNode* databases_child_; 292 CookieTreeDatabasesNode* databases_child_;
271 CookieTreeLocalStoragesNode* local_storages_child_; 293 CookieTreeLocalStoragesNode* local_storages_child_;
272 CookieTreeSessionStoragesNode* session_storages_child_; 294 CookieTreeSessionStoragesNode* session_storages_child_;
273 CookieTreeAppCachesNode* appcaches_child_; 295 CookieTreeAppCachesNode* appcaches_child_;
274 CookieTreeIndexedDBsNode* indexed_dbs_child_; 296 CookieTreeIndexedDBsNode* indexed_dbs_child_;
275 CookieTreeFileSystemsNode* file_systems_child_; 297 CookieTreeFileSystemsNode* file_systems_child_;
276 CookieTreeQuotaNode* quota_child_; 298 CookieTreeQuotaNode* quota_child_;
277 CookieTreeServerBoundCertsNode* server_bound_certs_child_; 299 CookieTreeServerBoundCertsNode* server_bound_certs_child_;
278 300
301 std::string app_id_;
302 std::string app_name_;
303
279 // The URL for which this node was initially created. 304 // The URL for which this node was initially created.
280 GURL url_; 305 GURL url_;
281 306
282 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); 307 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode);
283 }; 308 };
284 309
285 // CookieTreeCookieNode ------------------------------------------------------ 310 // CookieTreeCookieNode ------------------------------------------------------
286 class CookieTreeCookieNode : public CookieTreeNode { 311 class CookieTreeCookieNode : public CookieTreeNode {
287 public: 312 public:
288 friend class CookieTreeCookiesNode; 313 friend class CookieTreeCookiesNode;
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 AddChildSortedByTitle(child); 630 AddChildSortedByTitle(child);
606 } 631 }
607 632
608 private: 633 private:
609 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode); 634 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode);
610 }; 635 };
611 636
612 // CookiesTreeModel ----------------------------------------------------------- 637 // CookiesTreeModel -----------------------------------------------------------
613 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { 638 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
614 public: 639 public:
640 CookiesTreeModel(const ContainerMap& apps_map, bool group_by_cookie_source);
641 virtual ~CookiesTreeModel();
642
615 // Because non-cookie nodes are fetched in a background thread, they are not 643 // Because non-cookie nodes are fetched in a background thread, they are not
616 // present at the time the Model is created. The Model then notifies its 644 // present at the time the Model is created. The Model then notifies its
617 // observers for every item added from databases, local storage, and 645 // observers for every item added from databases, local storage, and
618 // appcache. We extend the Observer interface to add notifications before and 646 // appcache. We extend the Observer interface to add notifications before and
619 // after these batch inserts. 647 // after these batch inserts.
620 class Observer : public ui::TreeModelObserver { 648 class Observer : public ui::TreeModelObserver {
621 public: 649 public:
622 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {} 650 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {}
623 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} 651 virtual void TreeModelEndBatch(CookiesTreeModel* model) {}
624 }; 652 };
625 653
626 CookiesTreeModel( 654 // This class defines the scope for batch updates. It can be created as a
627 BrowsingDataCookieHelper* cookie_helper, 655 // local variable and the destructor will terminate the batch update, if one
628 BrowsingDataDatabaseHelper* database_helper, 656 // has been started.
629 BrowsingDataLocalStorageHelper* local_storage_helper, 657 class ScopedBatchUpdateNotifier {
630 BrowsingDataLocalStorageHelper* session_storage_helper, 658 public:
631 BrowsingDataAppCacheHelper* appcache_helper, 659 ScopedBatchUpdateNotifier(CookiesTreeModel* model,
632 BrowsingDataIndexedDBHelper* indexed_db_helper, 660 CookieTreeNode* node);
633 BrowsingDataFileSystemHelper* file_system_helper, 661 ~ScopedBatchUpdateNotifier();
634 BrowsingDataQuotaHelper* quota_helper, 662
635 BrowsingDataServerBoundCertHelper* server_bound_cert_helper, 663 void StartBatchUpdate();
636 bool use_cookie_source); 664
637 virtual ~CookiesTreeModel(); 665 private:
666 CookiesTreeModel* model_;
667 CookieTreeNode* node_;
668 bool batch_in_progress_;
669 };
638 670
639 // ui::TreeModel methods: 671 // ui::TreeModel methods:
640 // Returns the set of icons for the nodes in the tree. You only need override 672 // Returns the set of icons for the nodes in the tree. You only need override
641 // this if you don't want to use the default folder icons. 673 // this if you don't want to use the default folder icons.
642 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE; 674 virtual void GetIcons(std::vector<gfx::ImageSkia>* icons) OVERRIDE;
643 675
644 // Returns the index of the icon to use for |node|. Return -1 to use the 676 // Returns the index of the icon to use for |node|. Return -1 to use the
645 // default icon. The index is relative to the list of icons returned from 677 // default icon. The index is relative to the list of icons returned from
646 // GetIcons. 678 // GetIcons.
647 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE; 679 virtual int GetIconIndex(ui::TreeModelNode* node) OVERRIDE;
648 680
649 // CookiesTreeModel methods: 681 // CookiesTreeModel methods:
650 void DeleteAllStoredObjects(); 682 void DeleteAllStoredObjects();
683
684 // Deletes a specific node in the tree, identified by |cookie_node|, and its
685 // subtree.
651 void DeleteCookieNode(CookieTreeNode* cookie_node); 686 void DeleteCookieNode(CookieTreeNode* cookie_node);
652 687
653 // Filter the origins to only display matched results. 688 // Filter the origins to only display matched results.
654 void UpdateSearchResults(const std::wstring& filter); 689 void UpdateSearchResults(const string16& filter);
655 690
656 // Manages CookiesTreeModel::Observers. This will also call 691 // Manages CookiesTreeModel::Observers. This will also call
657 // TreeNodeModel::AddObserver so that it gets all the proper notifications. 692 // TreeNodeModel::AddObserver so that it gets all the proper notifications.
658 // Note that the converse is not true: simply adding a TreeModelObserver will 693 // Note that the converse is not true: simply adding a TreeModelObserver will
659 // not get CookiesTreeModel::Observer notifications. 694 // not get CookiesTreeModel::Observer notifications.
660 virtual void AddCookiesTreeObserver(Observer* observer); 695 virtual void AddCookiesTreeObserver(Observer* observer);
661 virtual void RemoveCookiesTreeObserver(Observer* observer); 696 virtual void RemoveCookiesTreeObserver(Observer* observer);
662 697
698 // Methods that update the model based on the data retrieved by the browsing
699 // data helpers.
700 void PopulateAppCacheInfo(LocalDataContainer* container);
701 void PopulateCookieInfo(LocalDataContainer* container);
702 void PopulateDatabaseInfo(LocalDataContainer* container);
703 void PopulateLocalStorageInfo(LocalDataContainer* container);
704 void PopulateSessionStorageInfo(LocalDataContainer* container);
705 void PopulateIndexedDBInfo(LocalDataContainer* container);
706 void PopulateFileSystemInfo(LocalDataContainer* container);
707 void PopulateQuotaInfo(LocalDataContainer* container);
708 void PopulateServerBoundCertInfo(LocalDataContainer* container);
709
710 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id);
711 LocalDataContainer* GetLocalDataContainer(const std::string& app_id);
712
663 private: 713 private:
664 enum CookieIconIndex { 714 enum CookieIconIndex {
665 ORIGIN = 0, 715 ORIGIN = 0,
666 COOKIE = 1, 716 COOKIE = 1,
667 DATABASE = 2 717 DATABASE = 2
668 }; 718 };
669 typedef std::list<net::CookieMonster::CanonicalCookie> CookieList;
670 typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo>
671 DatabaseInfoList;
672 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>
673 LocalStorageInfoList;
674 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>
675 SessionStorageInfoList;
676 typedef std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>
677 IndexedDBInfoList;
678 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo>
679 FileSystemInfoList;
680 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray;
681 typedef net::ServerBoundCertStore::ServerBoundCertList ServerBoundCertList;
682
683 void OnAppCacheModelInfoLoaded();
684 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list);
685 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info);
686 void OnLocalStorageModelInfoLoaded(
687 const LocalStorageInfoList& local_storage_info);
688 void OnSessionStorageModelInfoLoaded(
689 const LocalStorageInfoList& local_storage_info);
690 void OnIndexedDBModelInfoLoaded(
691 const IndexedDBInfoList& indexed_db_info);
692 void OnFileSystemModelInfoLoaded(
693 const FileSystemInfoList& file_system_info);
694 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info);
695 void OnServerBoundCertModelInfoLoaded(const ServerBoundCertList& cert_list);
696
697 void PopulateAppCacheInfoWithFilter(const std::wstring& filter);
698 void PopulateCookieInfoWithFilter(const std::wstring& filter);
699 void PopulateDatabaseInfoWithFilter(const std::wstring& filter);
700 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter);
701 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter);
702 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter);
703 void PopulateFileSystemInfoWithFilter(const std::wstring& filter);
704 void PopulateQuotaInfoWithFilter(const std::wstring& filter);
705 void PopulateServerBoundCertInfoWithFilter(const std::wstring& filter);
706 719
707 void NotifyObserverBeginBatch(); 720 void NotifyObserverBeginBatch();
708 void NotifyObserverEndBatch(); 721 void NotifyObserverEndBatch();
709 722
710 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; 723 void PopulateAppCacheInfoWithFilter(LocalDataContainer* container,
711 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; 724 ScopedBatchUpdateNotifier* notifier,
712 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; 725 const string16& filter);
713 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; 726 void PopulateCookieInfoWithFilter(LocalDataContainer* container,
714 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; 727 ScopedBatchUpdateNotifier* notifier,
715 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; 728 const string16& filter);
716 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; 729 void PopulateDatabaseInfoWithFilter(LocalDataContainer* container,
717 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; 730 ScopedBatchUpdateNotifier* notifier,
718 scoped_refptr<BrowsingDataServerBoundCertHelper> server_bound_cert_helper_; 731 const string16& filter);
732 void PopulateLocalStorageInfoWithFilter(LocalDataContainer* container,
733 ScopedBatchUpdateNotifier* notifier,
734 const string16& filter);
735 void PopulateSessionStorageInfoWithFilter(LocalDataContainer* container,
736 ScopedBatchUpdateNotifier* notifier,
737 const string16& filter);
738 void PopulateIndexedDBInfoWithFilter(LocalDataContainer* container,
739 ScopedBatchUpdateNotifier* notifier,
740 const string16& filter);
741 void PopulateFileSystemInfoWithFilter(LocalDataContainer* container,
742 ScopedBatchUpdateNotifier* notifier,
743 const string16& filter);
744 void PopulateQuotaInfoWithFilter(LocalDataContainer* container,
745 ScopedBatchUpdateNotifier* notifier,
746 const string16& filter);
747 void PopulateServerBoundCertInfoWithFilter(
748 LocalDataContainer* container,
749 ScopedBatchUpdateNotifier* notifier,
750 const string16& filter);
719 751
720 std::map<GURL, std::list<appcache::AppCacheInfo> > appcache_info_; 752 // Map of app ids to LocalDataContainer objects to use when retrieving
721 CookieList cookie_list_; 753 // locally stored data.
722 DatabaseInfoList database_info_list_; 754 ContainerMap app_data_map_;
723 LocalStorageInfoList local_storage_info_list_;
724 LocalStorageInfoList session_storage_info_list_;
725 IndexedDBInfoList indexed_db_info_list_;
726 FileSystemInfoList file_system_info_list_;
727 QuotaInfoArray quota_info_list_;
728 ServerBoundCertList server_bound_cert_list_;
729 755
730 // The CookiesTreeModel maintains a separate list of observers that are 756 // The CookiesTreeModel maintains a separate list of observers that are
731 // specifically of the type CookiesTreeModel::Observer. 757 // specifically of the type CookiesTreeModel::Observer.
732 ObserverList<Observer> cookies_observer_list_; 758 ObserverList<Observer> cookies_observer_list_;
733 759
760 // If true, use the CanonicalCookie::Source attribute to group cookies.
761 // Otherwise, use the CanonicalCookie::Domain attribute.
762 bool group_by_cookie_source_;
763
734 // If this is non-zero, then this model is batching updates (there's a lot of 764 // If this is non-zero, then this model is batching updates (there's a lot of
735 // notifications coming down the pipe). This is an integer is used to balance 765 // notifications coming down the pipe). This is an integer is used to balance
736 // calls to Begin/EndBatch() if they're called in a nested manner. 766 // calls to Begin/EndBatch() if they're called in a nested manner.
737 int batch_update_; 767 int batch_update_;
738
739 // If true, use the CanonicalCookie::Source attribute to group cookies.
740 // Otherwise, use the CanonicalCookie::Domain attribute.
741 bool use_cookie_source_;
742
743 base::WeakPtrFactory<CookiesTreeModel> weak_ptr_factory_;
744
745 friend class CookieTreeAppCacheNode;
746 friend class CookieTreeCookieNode;
747 friend class CookieTreeDatabaseNode;
748 friend class CookieTreeLocalStorageNode;
749 friend class CookieTreeSessionStorageNode;
750 friend class CookieTreeIndexedDBNode;
751 friend class CookieTreeFileSystemNode;
752 friend class CookieTreeQuotaNode;
753 friend class CookieTreeServerBoundCertNode;
754
755 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel);
756 }; 768 };
757 769
758 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ 770 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_
OLDNEW
« no previous file with comments | « chrome/app/generated_resources.grd ('k') | chrome/browser/cookies_tree_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698