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

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

Issue 10790150: Show Flash LSOs for Pepper Flash in cookie dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: review Created 8 years, 4 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 7
8 // TODO(viettrungluu): This header file #includes far too much and has too much 8 // TODO(viettrungluu): This header file #includes far too much and has too much
9 // inline code (which shouldn't be inline). 9 // inline code (which shouldn't be inline).
10 10
(...skipping 23 matching lines...) Expand all
34 class CookieSettings; 34 class CookieSettings;
35 class CookiesTreeModel; 35 class CookiesTreeModel;
36 class CookieTreeAppCacheNode; 36 class CookieTreeAppCacheNode;
37 class CookieTreeAppCachesNode; 37 class CookieTreeAppCachesNode;
38 class CookieTreeCookieNode; 38 class CookieTreeCookieNode;
39 class CookieTreeCookiesNode; 39 class CookieTreeCookiesNode;
40 class CookieTreeDatabaseNode; 40 class CookieTreeDatabaseNode;
41 class CookieTreeDatabasesNode; 41 class CookieTreeDatabasesNode;
42 class CookieTreeFileSystemNode; 42 class CookieTreeFileSystemNode;
43 class CookieTreeFileSystemsNode; 43 class CookieTreeFileSystemsNode;
44 class CookieTreeFlashLSONode;
44 class CookieTreeHostNode; 45 class CookieTreeHostNode;
45 class CookieTreeIndexedDBNode; 46 class CookieTreeIndexedDBNode;
46 class CookieTreeIndexedDBsNode; 47 class CookieTreeIndexedDBsNode;
47 class CookieTreeLocalStorageNode; 48 class CookieTreeLocalStorageNode;
48 class CookieTreeLocalStoragesNode; 49 class CookieTreeLocalStoragesNode;
49 class CookieTreeQuotaNode; 50 class CookieTreeQuotaNode;
50 class CookieTreeServerBoundCertNode; 51 class CookieTreeServerBoundCertNode;
51 class CookieTreeServerBoundCertsNode; 52 class CookieTreeServerBoundCertsNode;
52 class CookieTreeSessionStorageNode; 53 class CookieTreeSessionStorageNode;
53 class CookieTreeSessionStoragesNode; 54 class CookieTreeSessionStoragesNode;
(...skipping 28 matching lines...) Expand all
82 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode. 83 TYPE_SESSION_STORAGE, // This is used for CookieTreeSessionStorageNode.
83 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode. 84 TYPE_APPCACHES, // This is used for CookieTreeAppCachesNode.
84 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode. 85 TYPE_APPCACHE, // This is used for CookieTreeAppCacheNode.
85 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode. 86 TYPE_INDEXED_DBS, // This is used for CookieTreeIndexedDBsNode.
86 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode. 87 TYPE_INDEXED_DB, // This is used for CookieTreeIndexedDBNode.
87 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. 88 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode.
88 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. 89 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode.
89 TYPE_QUOTA, // This is used for CookieTreeQuotaNode. 90 TYPE_QUOTA, // This is used for CookieTreeQuotaNode.
90 TYPE_SERVER_BOUND_CERTS, // Used for CookieTreeServerBoundCertsNode. 91 TYPE_SERVER_BOUND_CERTS, // Used for CookieTreeServerBoundCertsNode.
91 TYPE_SERVER_BOUND_CERT, // Used for CookieTreeServerBoundCertNode. 92 TYPE_SERVER_BOUND_CERT, // Used for CookieTreeServerBoundCertNode.
93 TYPE_FLASH_LSO, // This is used for CookieTreeFlashLSONode.
92 }; 94 };
93 95
94 DetailedInfo(); 96 DetailedInfo();
95 ~DetailedInfo(); 97 ~DetailedInfo();
96 98
97 DetailedInfo& Init(NodeType type); 99 DetailedInfo& Init(NodeType type);
98 DetailedInfo& InitHost(const std::string& app_id, 100 DetailedInfo& InitHost(const std::string& app_id,
99 const std::string& app_name); 101 const std::string& app_name);
100 DetailedInfo& InitCookie(const net::CanonicalCookie* cookie); 102 DetailedInfo& InitCookie(const net::CanonicalCookie* cookie);
101 DetailedInfo& InitDatabase( 103 DetailedInfo& InitDatabase(
102 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info); 104 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info);
103 DetailedInfo& InitLocalStorage( 105 DetailedInfo& InitLocalStorage(
104 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 106 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
105 local_storage_info); 107 local_storage_info);
106 DetailedInfo& InitSessionStorage( 108 DetailedInfo& InitSessionStorage(
107 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 109 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
108 session_storage_info); 110 session_storage_info);
109 DetailedInfo& InitAppCache(const GURL& origin, 111 DetailedInfo& InitAppCache(const GURL& origin,
110 const appcache::AppCacheInfo* appcache_info); 112 const appcache::AppCacheInfo* appcache_info);
111 DetailedInfo& InitIndexedDB( 113 DetailedInfo& InitIndexedDB(
112 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info); 114 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info);
113 DetailedInfo& InitFileSystem( 115 DetailedInfo& InitFileSystem(
114 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info); 116 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info);
115 DetailedInfo& InitQuota( 117 DetailedInfo& InitQuota(
116 const BrowsingDataQuotaHelper::QuotaInfo* quota_info); 118 const BrowsingDataQuotaHelper::QuotaInfo* quota_info);
117 DetailedInfo& InitServerBoundCert( 119 DetailedInfo& InitServerBoundCert(
118 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert); 120 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert);
121 DetailedInfo& InitFlashLSO(const std::string& flash_lso_domain);
119 122
120 std::string app_name; 123 std::string app_name;
121 std::string app_id; 124 std::string app_id;
122 NodeType node_type; 125 NodeType node_type;
123 GURL origin; 126 GURL origin;
124 const net::CanonicalCookie* cookie; 127 const net::CanonicalCookie* cookie;
125 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; 128 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info;
126 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; 129 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info;
127 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 130 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
128 session_storage_info; 131 session_storage_info;
129 const appcache::AppCacheInfo* appcache_info; 132 const appcache::AppCacheInfo* appcache_info;
130 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; 133 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info;
131 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; 134 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info;
132 const BrowsingDataQuotaHelper::QuotaInfo* quota_info; 135 const BrowsingDataQuotaHelper::QuotaInfo* quota_info;
133 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert; 136 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert;
137 std::string flash_lso_domain;
134 }; 138 };
135 139
136 CookieTreeNode() {} 140 CookieTreeNode() {}
137 explicit CookieTreeNode(const string16& title) 141 explicit CookieTreeNode(const string16& title)
138 : ui::TreeNode<CookieTreeNode>(title) {} 142 : ui::TreeNode<CookieTreeNode>(title) {}
139 virtual ~CookieTreeNode() {} 143 virtual ~CookieTreeNode() {}
140 144
141 // Delete backend storage for this node, and any children nodes. (E.g. delete 145 // Delete backend storage for this node, and any children nodes. (E.g. delete
142 // the cookie from CookieMonster, clear the database, and so forth.) 146 // the cookie from CookieMonster, clear the database, and so forth.)
143 virtual void DeleteStoredObjects(); 147 virtual void DeleteStoredObjects();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 CookieTreeCookiesNode* GetOrCreateCookiesNode(); 201 CookieTreeCookiesNode* GetOrCreateCookiesNode();
198 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); 202 CookieTreeDatabasesNode* GetOrCreateDatabasesNode();
199 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); 203 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode();
200 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); 204 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode();
201 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); 205 CookieTreeAppCachesNode* GetOrCreateAppCachesNode();
202 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); 206 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode();
203 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); 207 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode();
204 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode(); 208 CookieTreeServerBoundCertsNode* GetOrCreateServerBoundCertsNode();
205 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( 209 CookieTreeQuotaNode* UpdateOrCreateQuotaNode(
206 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); 210 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info);
211 CookieTreeFlashLSONode* GetOrCreateFlashLSONode(const std::string& domain);
207 212
208 std::string canonicalized_host() const { return canonicalized_host_; } 213 std::string canonicalized_host() const { return canonicalized_host_; }
209 214
210 // Creates an content exception for this origin of type 215 // Creates an content exception for this origin of type
211 // CONTENT_SETTINGS_TYPE_COOKIES. 216 // CONTENT_SETTINGS_TYPE_COOKIES.
212 void CreateContentException(CookieSettings* cookie_settings, 217 void CreateContentException(CookieSettings* cookie_settings,
213 ContentSetting setting) const; 218 ContentSetting setting) const;
214 219
215 // True if a content exception can be created for this origin. 220 // True if a content exception can be created for this origin.
216 bool CanCreateContentException() const; 221 bool CanCreateContentException() const;
(...skipping 10 matching lines...) Expand all
227 // less preferable than storing an extra pointer per origin. 232 // less preferable than storing an extra pointer per origin.
228 CookieTreeCookiesNode* cookies_child_; 233 CookieTreeCookiesNode* cookies_child_;
229 CookieTreeDatabasesNode* databases_child_; 234 CookieTreeDatabasesNode* databases_child_;
230 CookieTreeLocalStoragesNode* local_storages_child_; 235 CookieTreeLocalStoragesNode* local_storages_child_;
231 CookieTreeSessionStoragesNode* session_storages_child_; 236 CookieTreeSessionStoragesNode* session_storages_child_;
232 CookieTreeAppCachesNode* appcaches_child_; 237 CookieTreeAppCachesNode* appcaches_child_;
233 CookieTreeIndexedDBsNode* indexed_dbs_child_; 238 CookieTreeIndexedDBsNode* indexed_dbs_child_;
234 CookieTreeFileSystemsNode* file_systems_child_; 239 CookieTreeFileSystemsNode* file_systems_child_;
235 CookieTreeQuotaNode* quota_child_; 240 CookieTreeQuotaNode* quota_child_;
236 CookieTreeServerBoundCertsNode* server_bound_certs_child_; 241 CookieTreeServerBoundCertsNode* server_bound_certs_child_;
242 CookieTreeFlashLSONode* flash_lso_child_;
237 243
238 std::string app_id_; 244 std::string app_id_;
239 std::string app_name_; 245 std::string app_name_;
240 246
241 // The URL for which this node was initially created. 247 // The URL for which this node was initially created.
242 GURL url_; 248 GURL url_;
243 249
244 std::string canonicalized_host_; 250 std::string canonicalized_host_;
245 251
246 DISALLOW_COPY_AND_ASSIGN(CookieTreeHostNode); 252 DISALLOW_COPY_AND_ASSIGN(CookieTreeHostNode);
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; 572 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
567 573
568 void AddServerBoundCertNode(CookieTreeServerBoundCertNode* child) { 574 void AddServerBoundCertNode(CookieTreeServerBoundCertNode* child) {
569 AddChildSortedByTitle(child); 575 AddChildSortedByTitle(child);
570 } 576 }
571 577
572 private: 578 private:
573 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode); 579 DISALLOW_COPY_AND_ASSIGN(CookieTreeServerBoundCertsNode);
574 }; 580 };
575 581
582 // CookieTreeFlashLSONode ----------------------------------------------------
583 class CookieTreeFlashLSONode : public CookieTreeNode {
584 public:
585 explicit CookieTreeFlashLSONode(const std::string& domain);
586 virtual ~CookieTreeFlashLSONode();
587
588 // CookieTreeNode methods:
589 virtual void DeleteStoredObjects() OVERRIDE;
590 virtual DetailedInfo GetDetailedInfo() const OVERRIDE;
591
592 private:
593 std::string domain_;
594
595 DISALLOW_COPY_AND_ASSIGN(CookieTreeFlashLSONode);
596 };
597
576 // CookiesTreeModel ----------------------------------------------------------- 598 // CookiesTreeModel -----------------------------------------------------------
577 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { 599 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
578 public: 600 public:
579 CookiesTreeModel(const ContainerMap& apps_map, 601 CookiesTreeModel(const ContainerMap& apps_map,
580 ExtensionSpecialStoragePolicy* special_storage_policy, 602 ExtensionSpecialStoragePolicy* special_storage_policy,
581 bool group_by_cookie_source); 603 bool group_by_cookie_source);
582 virtual ~CookiesTreeModel(); 604 virtual ~CookiesTreeModel();
583 605
584 // Because non-cookie nodes are fetched in a background thread, they are not 606 // Because non-cookie nodes are fetched in a background thread, they are not
585 // present at the time the Model is created. The Model then notifies its 607 // present at the time the Model is created. The Model then notifies its
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 // data helpers. 669 // data helpers.
648 void PopulateAppCacheInfo(LocalDataContainer* container); 670 void PopulateAppCacheInfo(LocalDataContainer* container);
649 void PopulateCookieInfo(LocalDataContainer* container); 671 void PopulateCookieInfo(LocalDataContainer* container);
650 void PopulateDatabaseInfo(LocalDataContainer* container); 672 void PopulateDatabaseInfo(LocalDataContainer* container);
651 void PopulateLocalStorageInfo(LocalDataContainer* container); 673 void PopulateLocalStorageInfo(LocalDataContainer* container);
652 void PopulateSessionStorageInfo(LocalDataContainer* container); 674 void PopulateSessionStorageInfo(LocalDataContainer* container);
653 void PopulateIndexedDBInfo(LocalDataContainer* container); 675 void PopulateIndexedDBInfo(LocalDataContainer* container);
654 void PopulateFileSystemInfo(LocalDataContainer* container); 676 void PopulateFileSystemInfo(LocalDataContainer* container);
655 void PopulateQuotaInfo(LocalDataContainer* container); 677 void PopulateQuotaInfo(LocalDataContainer* container);
656 void PopulateServerBoundCertInfo(LocalDataContainer* container); 678 void PopulateServerBoundCertInfo(LocalDataContainer* container);
679 void PopulateFlashLSOInfo(LocalDataContainer* container);
657 680
658 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id); 681 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id);
659 LocalDataContainer* GetLocalDataContainer(const std::string& app_id); 682 LocalDataContainer* GetLocalDataContainer(const std::string& app_id);
660 683
661 private: 684 private:
662 enum CookieIconIndex { 685 enum CookieIconIndex {
663 ORIGIN = 0, 686 ORIGIN = 0,
664 COOKIE = 1, 687 COOKIE = 1,
665 DATABASE = 2 688 DATABASE = 2
666 }; 689 };
(...skipping 22 matching lines...) Expand all
689 void PopulateFileSystemInfoWithFilter(LocalDataContainer* container, 712 void PopulateFileSystemInfoWithFilter(LocalDataContainer* container,
690 ScopedBatchUpdateNotifier* notifier, 713 ScopedBatchUpdateNotifier* notifier,
691 const string16& filter); 714 const string16& filter);
692 void PopulateQuotaInfoWithFilter(LocalDataContainer* container, 715 void PopulateQuotaInfoWithFilter(LocalDataContainer* container,
693 ScopedBatchUpdateNotifier* notifier, 716 ScopedBatchUpdateNotifier* notifier,
694 const string16& filter); 717 const string16& filter);
695 void PopulateServerBoundCertInfoWithFilter( 718 void PopulateServerBoundCertInfoWithFilter(
696 LocalDataContainer* container, 719 LocalDataContainer* container,
697 ScopedBatchUpdateNotifier* notifier, 720 ScopedBatchUpdateNotifier* notifier,
698 const string16& filter); 721 const string16& filter);
722 void PopulateFlashLSOInfoWithFilter(LocalDataContainer* container,
723 ScopedBatchUpdateNotifier* notifier,
724 const string16& filter);
699 725
700 // Map of app ids to LocalDataContainer objects to use when retrieving 726 // Map of app ids to LocalDataContainer objects to use when retrieving
701 // locally stored data. 727 // locally stored data.
702 ContainerMap app_data_map_; 728 ContainerMap app_data_map_;
703 729
704 // The extension special storage policy; see ExtensionsProtectingNode() above. 730 // The extension special storage policy; see ExtensionsProtectingNode() above.
705 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; 731 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_;
706 732
707 // The CookiesTreeModel maintains a separate list of observers that are 733 // The CookiesTreeModel maintains a separate list of observers that are
708 // specifically of the type CookiesTreeModel::Observer. 734 // specifically of the type CookiesTreeModel::Observer.
709 ObserverList<Observer> cookies_observer_list_; 735 ObserverList<Observer> cookies_observer_list_;
710 736
711 // If true, use the CanonicalCookie::Source attribute to group cookies. 737 // If true, use the CanonicalCookie::Source attribute to group cookies.
712 // Otherwise, use the CanonicalCookie::Domain attribute. 738 // Otherwise, use the CanonicalCookie::Domain attribute.
713 bool group_by_cookie_source_; 739 bool group_by_cookie_source_;
714 740
715 // If this is non-zero, then this model is batching updates (there's a lot of 741 // If this is non-zero, then this model is batching updates (there's a lot of
716 // notifications coming down the pipe). This is an integer is used to balance 742 // notifications coming down the pipe). This is an integer is used to balance
717 // calls to Begin/EndBatch() if they're called in a nested manner. 743 // calls to Begin/EndBatch() if they're called in a nested manner.
718 int batch_update_; 744 int batch_update_;
719 }; 745 };
720 746
721 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ 747 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698