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

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

Issue 2359393002: Adds media license nodes to cookie tree model and cookies view. (Closed)
Patch Set: Changes Created 4 years, 2 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
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_BROWSING_DATA_COOKIES_TREE_MODEL_H_ 5 #ifndef CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_
6 #define CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_ 6 #define CHROME_BROWSER_BROWSING_DATA_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 34
35 class BrowsingDataChannelIDHelper; 35 class BrowsingDataChannelIDHelper;
36 class BrowsingDataCookieHelper; 36 class BrowsingDataCookieHelper;
37 class CookiesTreeModel; 37 class CookiesTreeModel;
38 class CookieTreeAppCacheNode; 38 class CookieTreeAppCacheNode;
39 class CookieTreeAppCachesNode; 39 class CookieTreeAppCachesNode;
40 class CookieTreeCacheStorageNode; 40 class CookieTreeCacheStorageNode;
41 class CookieTreeCacheStoragesNode; 41 class CookieTreeCacheStoragesNode;
42 class CookieTreeChannelIDNode; 42 class CookieTreeChannelIDNode;
43 class CookieTreeChannelIDsNode; 43 class CookieTreeChannelIDsNode;
44 class CookieTreeMediaLicenseNode;
45 class CookieTreeMediaLicensesNode;
44 class CookieTreeCookieNode; 46 class CookieTreeCookieNode;
45 class CookieTreeCookiesNode; 47 class CookieTreeCookiesNode;
46 class CookieTreeDatabaseNode; 48 class CookieTreeDatabaseNode;
47 class CookieTreeDatabasesNode; 49 class CookieTreeDatabasesNode;
48 class CookieTreeFileSystemNode; 50 class CookieTreeFileSystemNode;
49 class CookieTreeFileSystemsNode; 51 class CookieTreeFileSystemsNode;
50 class CookieTreeFlashLSONode; 52 class CookieTreeFlashLSONode;
51 class CookieTreeHostNode; 53 class CookieTreeHostNode;
52 class CookieTreeIndexedDBNode; 54 class CookieTreeIndexedDBNode;
53 class CookieTreeIndexedDBsNode; 55 class CookieTreeIndexedDBsNode;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode. 104 TYPE_FILE_SYSTEMS, // This is used for CookieTreeFileSystemsNode.
103 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode. 105 TYPE_FILE_SYSTEM, // This is used for CookieTreeFileSystemNode.
104 TYPE_QUOTA, // This is used for CookieTreeQuotaNode. 106 TYPE_QUOTA, // This is used for CookieTreeQuotaNode.
105 TYPE_CHANNEL_IDS, // Used for CookieTreeChannelIDsNode. 107 TYPE_CHANNEL_IDS, // Used for CookieTreeChannelIDsNode.
106 TYPE_CHANNEL_ID, // Used for CookieTreeChannelIDNode. 108 TYPE_CHANNEL_ID, // Used for CookieTreeChannelIDNode.
107 TYPE_SERVICE_WORKERS, // This is used for CookieTreeServiceWorkersNode. 109 TYPE_SERVICE_WORKERS, // This is used for CookieTreeServiceWorkersNode.
108 TYPE_SERVICE_WORKER, // This is used for CookieTreeServiceWorkerNode. 110 TYPE_SERVICE_WORKER, // This is used for CookieTreeServiceWorkerNode.
109 TYPE_CACHE_STORAGES, // This is used for CookieTreeCacheStoragesNode. 111 TYPE_CACHE_STORAGES, // This is used for CookieTreeCacheStoragesNode.
110 TYPE_CACHE_STORAGE, // This is used for CookieTreeCacheStorageNode. 112 TYPE_CACHE_STORAGE, // This is used for CookieTreeCacheStorageNode.
111 TYPE_FLASH_LSO, // This is used for CookieTreeFlashLSONode. 113 TYPE_FLASH_LSO, // This is used for CookieTreeFlashLSONode.
114 TYPE_MEDIA_LICENSES, // This is used for CookieTreeMediaLicensesNode.
115 TYPE_MEDIA_LICENSE, // This is used for CookieTreeMediaLicenseNode.
112 }; 116 };
113 117
114 DetailedInfo(); 118 DetailedInfo();
115 DetailedInfo(const DetailedInfo& other); 119 DetailedInfo(const DetailedInfo& other);
116 ~DetailedInfo(); 120 ~DetailedInfo();
117 121
118 DetailedInfo& Init(NodeType type); 122 DetailedInfo& Init(NodeType type);
119 DetailedInfo& InitHost(); 123 DetailedInfo& InitHost();
120 DetailedInfo& InitCookie(const net::CanonicalCookie* cookie); 124 DetailedInfo& InitCookie(const net::CanonicalCookie* cookie);
121 DetailedInfo& InitDatabase( 125 DetailedInfo& InitDatabase(
(...skipping 12 matching lines...) Expand all
134 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info); 138 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info);
135 DetailedInfo& InitQuota( 139 DetailedInfo& InitQuota(
136 const BrowsingDataQuotaHelper::QuotaInfo* quota_info); 140 const BrowsingDataQuotaHelper::QuotaInfo* quota_info);
137 DetailedInfo& InitChannelID( 141 DetailedInfo& InitChannelID(
138 const net::ChannelIDStore::ChannelID* channel_id); 142 const net::ChannelIDStore::ChannelID* channel_id);
139 DetailedInfo& InitServiceWorker( 143 DetailedInfo& InitServiceWorker(
140 const content::ServiceWorkerUsageInfo* service_worker_info); 144 const content::ServiceWorkerUsageInfo* service_worker_info);
141 DetailedInfo& InitCacheStorage( 145 DetailedInfo& InitCacheStorage(
142 const content::CacheStorageUsageInfo* cache_storage_info); 146 const content::CacheStorageUsageInfo* cache_storage_info);
143 DetailedInfo& InitFlashLSO(const std::string& flash_lso_domain); 147 DetailedInfo& InitFlashLSO(const std::string& flash_lso_domain);
148 DetailedInfo& InitMediaLicense(
149 const BrowsingDataMediaLicenseHelper::MediaLicenseInfo*
150 media_license_info);
144 151
145 NodeType node_type; 152 NodeType node_type;
146 GURL origin; 153 GURL origin;
147 const net::CanonicalCookie* cookie = nullptr; 154 const net::CanonicalCookie* cookie = nullptr;
148 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info = nullptr; 155 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info = nullptr;
149 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info = 156 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info =
150 nullptr; 157 nullptr;
151 const BrowsingDataLocalStorageHelper::LocalStorageInfo* 158 const BrowsingDataLocalStorageHelper::LocalStorageInfo*
152 session_storage_info = nullptr; 159 session_storage_info = nullptr;
153 const content::AppCacheInfo* appcache_info = nullptr; 160 const content::AppCacheInfo* appcache_info = nullptr;
154 const content::IndexedDBInfo* indexed_db_info = nullptr; 161 const content::IndexedDBInfo* indexed_db_info = nullptr;
155 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info = 162 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info =
156 nullptr; 163 nullptr;
157 const BrowsingDataQuotaHelper::QuotaInfo* quota_info = nullptr; 164 const BrowsingDataQuotaHelper::QuotaInfo* quota_info = nullptr;
158 const net::ChannelIDStore::ChannelID* channel_id = nullptr; 165 const net::ChannelIDStore::ChannelID* channel_id = nullptr;
159 const content::ServiceWorkerUsageInfo* service_worker_info = nullptr; 166 const content::ServiceWorkerUsageInfo* service_worker_info = nullptr;
160 const content::CacheStorageUsageInfo* cache_storage_info = nullptr; 167 const content::CacheStorageUsageInfo* cache_storage_info = nullptr;
161 std::string flash_lso_domain; 168 std::string flash_lso_domain;
169 const BrowsingDataMediaLicenseHelper::MediaLicenseInfo* media_license_info =
170 nullptr;
162 }; 171 };
163 172
164 CookieTreeNode() {} 173 CookieTreeNode() {}
165 explicit CookieTreeNode(const base::string16& title) 174 explicit CookieTreeNode(const base::string16& title)
166 : ui::TreeNode<CookieTreeNode>(title) {} 175 : ui::TreeNode<CookieTreeNode>(title) {}
167 ~CookieTreeNode() override {} 176 ~CookieTreeNode() override {}
168 177
169 // Delete backend storage for this node, and any children nodes. (E.g. delete 178 // Delete backend storage for this node, and any children nodes. (E.g. delete
170 // the cookie from CookieMonster, clear the database, and so forth.) 179 // the cookie from CookieMonster, clear the database, and so forth.)
171 virtual void DeleteStoredObjects(); 180 virtual void DeleteStoredObjects();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); 231 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode();
223 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); 232 CookieTreeAppCachesNode* GetOrCreateAppCachesNode();
224 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); 233 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode();
225 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); 234 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode();
226 CookieTreeChannelIDsNode* GetOrCreateChannelIDsNode(); 235 CookieTreeChannelIDsNode* GetOrCreateChannelIDsNode();
227 CookieTreeServiceWorkersNode* GetOrCreateServiceWorkersNode(); 236 CookieTreeServiceWorkersNode* GetOrCreateServiceWorkersNode();
228 CookieTreeCacheStoragesNode* GetOrCreateCacheStoragesNode(); 237 CookieTreeCacheStoragesNode* GetOrCreateCacheStoragesNode();
229 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( 238 CookieTreeQuotaNode* UpdateOrCreateQuotaNode(
230 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); 239 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info);
231 CookieTreeFlashLSONode* GetOrCreateFlashLSONode(const std::string& domain); 240 CookieTreeFlashLSONode* GetOrCreateFlashLSONode(const std::string& domain);
241 CookieTreeMediaLicensesNode* GetOrCreateMediaLicensesNode();
232 242
233 std::string canonicalized_host() const { return canonicalized_host_; } 243 std::string canonicalized_host() const { return canonicalized_host_; }
234 244
235 // Creates an content exception for this origin of type 245 // Creates an content exception for this origin of type
236 // CONTENT_SETTINGS_TYPE_COOKIES. 246 // CONTENT_SETTINGS_TYPE_COOKIES.
237 void CreateContentException(content_settings::CookieSettings* cookie_settings, 247 void CreateContentException(content_settings::CookieSettings* cookie_settings,
238 ContentSetting setting) const; 248 ContentSetting setting) const;
239 249
240 // True if a content exception can be created for this origin. 250 // True if a content exception can be created for this origin.
241 bool CanCreateContentException() const; 251 bool CanCreateContentException() const;
(...skipping 11 matching lines...) Expand all
253 CookieTreeLocalStoragesNode* local_storages_child_ = nullptr; 263 CookieTreeLocalStoragesNode* local_storages_child_ = nullptr;
254 CookieTreeSessionStoragesNode* session_storages_child_ = nullptr; 264 CookieTreeSessionStoragesNode* session_storages_child_ = nullptr;
255 CookieTreeAppCachesNode* appcaches_child_ = nullptr; 265 CookieTreeAppCachesNode* appcaches_child_ = nullptr;
256 CookieTreeIndexedDBsNode* indexed_dbs_child_ = nullptr; 266 CookieTreeIndexedDBsNode* indexed_dbs_child_ = nullptr;
257 CookieTreeFileSystemsNode* file_systems_child_ = nullptr; 267 CookieTreeFileSystemsNode* file_systems_child_ = nullptr;
258 CookieTreeQuotaNode* quota_child_ = nullptr; 268 CookieTreeQuotaNode* quota_child_ = nullptr;
259 CookieTreeChannelIDsNode* channel_ids_child_ = nullptr; 269 CookieTreeChannelIDsNode* channel_ids_child_ = nullptr;
260 CookieTreeServiceWorkersNode* service_workers_child_ = nullptr; 270 CookieTreeServiceWorkersNode* service_workers_child_ = nullptr;
261 CookieTreeCacheStoragesNode* cache_storages_child_ = nullptr; 271 CookieTreeCacheStoragesNode* cache_storages_child_ = nullptr;
262 CookieTreeFlashLSONode* flash_lso_child_ = nullptr; 272 CookieTreeFlashLSONode* flash_lso_child_ = nullptr;
273 CookieTreeMediaLicensesNode* media_licenses_child_ = nullptr;
263 274
264 // The URL for which this node was initially created. 275 // The URL for which this node was initially created.
265 GURL url_; 276 GURL url_;
266 277
267 std::string canonicalized_host_; 278 std::string canonicalized_host_;
268 279
269 DISALLOW_COPY_AND_ASSIGN(CookieTreeHostNode); 280 DISALLOW_COPY_AND_ASSIGN(CookieTreeHostNode);
270 }; 281 };
271 282
272 // CookieTreeCookieNode ------------------------------------------------------ 283 // CookieTreeCookieNode ------------------------------------------------------
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 // CookieTreeNode methods: 686 // CookieTreeNode methods:
676 void DeleteStoredObjects() override; 687 void DeleteStoredObjects() override;
677 DetailedInfo GetDetailedInfo() const override; 688 DetailedInfo GetDetailedInfo() const override;
678 689
679 private: 690 private:
680 std::string domain_; 691 std::string domain_;
681 692
682 DISALLOW_COPY_AND_ASSIGN(CookieTreeFlashLSONode); 693 DISALLOW_COPY_AND_ASSIGN(CookieTreeFlashLSONode);
683 }; 694 };
684 695
696 // CookieTreeMediaLicenseNode -----------------------------------------------
697 class CookieTreeMediaLicenseNode : public CookieTreeNode {
698 public:
699 friend class CookieTreeMediaLicensesNode;
700
701 // |media_license_info| is expected to remain valid as long as the
702 // CookieTreeMediaLicenseNode is valid.
703 explicit CookieTreeMediaLicenseNode(
704 const std::list<BrowsingDataMediaLicenseHelper::MediaLicenseInfo>::
705 iterator media_license_info);
706 ~CookieTreeMediaLicenseNode() override;
707
708 void DeleteStoredObjects() override;
709 DetailedInfo GetDetailedInfo() const override;
710
711 private:
712 // |media_license_info_| is expected to remain valid as long as the
713 // CookieTreeMediaLicenseNode is valid.
714 std::list<BrowsingDataMediaLicenseHelper::MediaLicenseInfo>::iterator
715 media_license_info_;
716
717 DISALLOW_COPY_AND_ASSIGN(CookieTreeMediaLicenseNode);
718 };
719
720 class CookieTreeMediaLicensesNode : public CookieTreeNode {
721 public:
722 CookieTreeMediaLicensesNode();
723 ~CookieTreeMediaLicensesNode() override;
724
725 DetailedInfo GetDetailedInfo() const override;
726
727 void AddMediaLicenseNode(CookieTreeMediaLicenseNode* child) {
728 AddChildSortedByTitle(child);
729 }
730
731 private:
732 DISALLOW_COPY_AND_ASSIGN(CookieTreeMediaLicensesNode);
733 };
734
685 // CookiesTreeModel ----------------------------------------------------------- 735 // CookiesTreeModel -----------------------------------------------------------
686 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { 736 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
687 public: 737 public:
688 CookiesTreeModel(LocalDataContainer* data_container, 738 CookiesTreeModel(LocalDataContainer* data_container,
689 ExtensionSpecialStoragePolicy* special_storage_policy); 739 ExtensionSpecialStoragePolicy* special_storage_policy);
690 ~CookiesTreeModel() override; 740 ~CookiesTreeModel() override;
691 741
692 // Given a CanonicalCookie, return the ID of the message which should be 742 // Given a CanonicalCookie, return the ID of the message which should be
693 // displayed in various ports' "Send for:" UI. 743 // displayed in various ports' "Send for:" UI.
694 static int GetSendForMessageID(const net::CanonicalCookie& cookie); 744 static int GetSendForMessageID(const net::CanonicalCookie& cookie);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 void PopulateDatabaseInfo(LocalDataContainer* container); 814 void PopulateDatabaseInfo(LocalDataContainer* container);
765 void PopulateLocalStorageInfo(LocalDataContainer* container); 815 void PopulateLocalStorageInfo(LocalDataContainer* container);
766 void PopulateSessionStorageInfo(LocalDataContainer* container); 816 void PopulateSessionStorageInfo(LocalDataContainer* container);
767 void PopulateIndexedDBInfo(LocalDataContainer* container); 817 void PopulateIndexedDBInfo(LocalDataContainer* container);
768 void PopulateFileSystemInfo(LocalDataContainer* container); 818 void PopulateFileSystemInfo(LocalDataContainer* container);
769 void PopulateQuotaInfo(LocalDataContainer* container); 819 void PopulateQuotaInfo(LocalDataContainer* container);
770 void PopulateChannelIDInfo(LocalDataContainer* container); 820 void PopulateChannelIDInfo(LocalDataContainer* container);
771 void PopulateServiceWorkerUsageInfo(LocalDataContainer* container); 821 void PopulateServiceWorkerUsageInfo(LocalDataContainer* container);
772 void PopulateCacheStorageUsageInfo(LocalDataContainer* container); 822 void PopulateCacheStorageUsageInfo(LocalDataContainer* container);
773 void PopulateFlashLSOInfo(LocalDataContainer* container); 823 void PopulateFlashLSOInfo(LocalDataContainer* container);
824 void PopulateMediaLicenseInfo(LocalDataContainer* container);
774 825
775 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id); 826 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id);
776 LocalDataContainer* data_container() { 827 LocalDataContainer* data_container() {
777 return data_container_.get(); 828 return data_container_.get();
778 } 829 }
779 830
780 // Set the number of |batches_expected| this class should expect to receive. 831 // Set the number of |batches_expected| this class should expect to receive.
781 // If |reset| is true, then this is a new set of batches, but if false, then 832 // If |reset| is true, then this is a new set of batches, but if false, then
782 // this is a revised number (batches originally counted should no longer be 833 // this is a revised number (batches originally counted should no longer be
783 // expected). 834 // expected).
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 LocalDataContainer* container, 891 LocalDataContainer* container,
841 ScopedBatchUpdateNotifier* notifier, 892 ScopedBatchUpdateNotifier* notifier,
842 const base::string16& filter); 893 const base::string16& filter);
843 void PopulateCacheStorageUsageInfoWithFilter( 894 void PopulateCacheStorageUsageInfoWithFilter(
844 LocalDataContainer* container, 895 LocalDataContainer* container,
845 ScopedBatchUpdateNotifier* notifier, 896 ScopedBatchUpdateNotifier* notifier,
846 const base::string16& filter); 897 const base::string16& filter);
847 void PopulateFlashLSOInfoWithFilter(LocalDataContainer* container, 898 void PopulateFlashLSOInfoWithFilter(LocalDataContainer* container,
848 ScopedBatchUpdateNotifier* notifier, 899 ScopedBatchUpdateNotifier* notifier,
849 const base::string16& filter); 900 const base::string16& filter);
901 void PopulateMediaLicenseInfoWithFilter(LocalDataContainer* container,
902 ScopedBatchUpdateNotifier* notifier,
903 const base::string16& filter);
850 904
851 #if defined(ENABLE_EXTENSIONS) 905 #if defined(ENABLE_EXTENSIONS)
852 // The extension special storage policy; see ExtensionsProtectingNode() above. 906 // The extension special storage policy; see ExtensionsProtectingNode() above.
853 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; 907 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_;
854 #endif 908 #endif
855 909
856 // Map of app ids to LocalDataContainer objects to use when retrieving 910 // Map of app ids to LocalDataContainer objects to use when retrieving
857 // locally stored data. 911 // locally stored data.
858 std::unique_ptr<LocalDataContainer> data_container_; 912 std::unique_ptr<LocalDataContainer> data_container_;
859 913
(...skipping 10 matching lines...) Expand all
870 924
871 // Counts how many batches have started already. If this is non-zero and lower 925 // Counts how many batches have started already. If this is non-zero and lower
872 // than batches_ended_, then this model is still batching updates. 926 // than batches_ended_, then this model is still batching updates.
873 int batches_started_ = 0; 927 int batches_started_ = 0;
874 928
875 // Counts how many batches have finished. 929 // Counts how many batches have finished.
876 int batches_ended_ = 0; 930 int batches_ended_ = 0;
877 }; 931 };
878 932
879 #endif // CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_ 933 #endif // CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698