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

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: rebase 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 class CookieTreeDatabaseNode; 46 class CookieTreeDatabaseNode;
47 class CookieTreeDatabasesNode; 47 class CookieTreeDatabasesNode;
48 class CookieTreeFileSystemNode; 48 class CookieTreeFileSystemNode;
49 class CookieTreeFileSystemsNode; 49 class CookieTreeFileSystemsNode;
50 class CookieTreeFlashLSONode; 50 class CookieTreeFlashLSONode;
51 class CookieTreeHostNode; 51 class CookieTreeHostNode;
52 class CookieTreeIndexedDBNode; 52 class CookieTreeIndexedDBNode;
53 class CookieTreeIndexedDBsNode; 53 class CookieTreeIndexedDBsNode;
54 class CookieTreeLocalStorageNode; 54 class CookieTreeLocalStorageNode;
55 class CookieTreeLocalStoragesNode; 55 class CookieTreeLocalStoragesNode;
56 class CookieTreeMediaLicenseNode;
57 class CookieTreeMediaLicensesNode;
56 class CookieTreeQuotaNode; 58 class CookieTreeQuotaNode;
57 class CookieTreeServiceWorkerNode; 59 class CookieTreeServiceWorkerNode;
58 class CookieTreeServiceWorkersNode; 60 class CookieTreeServiceWorkersNode;
59 class CookieTreeSessionStorageNode; 61 class CookieTreeSessionStorageNode;
60 class CookieTreeSessionStoragesNode; 62 class CookieTreeSessionStoragesNode;
61 class ExtensionSpecialStoragePolicy; 63 class ExtensionSpecialStoragePolicy;
62 64
63 namespace content_settings { 65 namespace content_settings {
64 class CookieSettings; 66 class CookieSettings;
65 } 67 }
(...skipping 36 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 // CookieTreeNode methods: 688 // CookieTreeNode methods:
678 void DeleteStoredObjects() override; 689 void DeleteStoredObjects() override;
679 DetailedInfo GetDetailedInfo() const override; 690 DetailedInfo GetDetailedInfo() const override;
680 691
681 private: 692 private:
682 std::string domain_; 693 std::string domain_;
683 694
684 DISALLOW_COPY_AND_ASSIGN(CookieTreeFlashLSONode); 695 DISALLOW_COPY_AND_ASSIGN(CookieTreeFlashLSONode);
685 }; 696 };
686 697
698 // CookieTreeMediaLicenseNode -----------------------------------------------
699 class CookieTreeMediaLicenseNode : public CookieTreeNode {
700 public:
701 friend class CookieTreeMediaLicensesNode;
702
703 // |media_license_info| is expected to remain valid as long as the
704 // CookieTreeMediaLicenseNode is valid.
705 explicit CookieTreeMediaLicenseNode(
706 const std::list<BrowsingDataMediaLicenseHelper::MediaLicenseInfo>::
707 iterator media_license_info);
708 ~CookieTreeMediaLicenseNode() override;
709
710 void DeleteStoredObjects() override;
711 DetailedInfo GetDetailedInfo() const override;
712
713 private:
714 // |media_license_info_| is expected to remain valid as long as the
715 // CookieTreeMediaLicenseNode is valid.
716 std::list<BrowsingDataMediaLicenseHelper::MediaLicenseInfo>::iterator
717 media_license_info_;
718
719 DISALLOW_COPY_AND_ASSIGN(CookieTreeMediaLicenseNode);
720 };
721
722 class CookieTreeMediaLicensesNode : public CookieTreeNode {
723 public:
724 CookieTreeMediaLicensesNode();
725 ~CookieTreeMediaLicensesNode() override;
726
727 DetailedInfo GetDetailedInfo() const override;
728
729 void AddMediaLicenseNode(std::unique_ptr<CookieTreeMediaLicenseNode> child) {
730 AddChildSortedByTitle(std::move(child));
731 }
732
733 private:
734 DISALLOW_COPY_AND_ASSIGN(CookieTreeMediaLicensesNode);
735 };
736
687 // CookiesTreeModel ----------------------------------------------------------- 737 // CookiesTreeModel -----------------------------------------------------------
688 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { 738 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> {
689 public: 739 public:
690 CookiesTreeModel(LocalDataContainer* data_container, 740 CookiesTreeModel(LocalDataContainer* data_container,
691 ExtensionSpecialStoragePolicy* special_storage_policy); 741 ExtensionSpecialStoragePolicy* special_storage_policy);
692 ~CookiesTreeModel() override; 742 ~CookiesTreeModel() override;
693 743
694 // Given a CanonicalCookie, return the ID of the message which should be 744 // Given a CanonicalCookie, return the ID of the message which should be
695 // displayed in various ports' "Send for:" UI. 745 // displayed in various ports' "Send for:" UI.
696 static int GetSendForMessageID(const net::CanonicalCookie& cookie); 746 static int GetSendForMessageID(const net::CanonicalCookie& cookie);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 void PopulateDatabaseInfo(LocalDataContainer* container); 816 void PopulateDatabaseInfo(LocalDataContainer* container);
767 void PopulateLocalStorageInfo(LocalDataContainer* container); 817 void PopulateLocalStorageInfo(LocalDataContainer* container);
768 void PopulateSessionStorageInfo(LocalDataContainer* container); 818 void PopulateSessionStorageInfo(LocalDataContainer* container);
769 void PopulateIndexedDBInfo(LocalDataContainer* container); 819 void PopulateIndexedDBInfo(LocalDataContainer* container);
770 void PopulateFileSystemInfo(LocalDataContainer* container); 820 void PopulateFileSystemInfo(LocalDataContainer* container);
771 void PopulateQuotaInfo(LocalDataContainer* container); 821 void PopulateQuotaInfo(LocalDataContainer* container);
772 void PopulateChannelIDInfo(LocalDataContainer* container); 822 void PopulateChannelIDInfo(LocalDataContainer* container);
773 void PopulateServiceWorkerUsageInfo(LocalDataContainer* container); 823 void PopulateServiceWorkerUsageInfo(LocalDataContainer* container);
774 void PopulateCacheStorageUsageInfo(LocalDataContainer* container); 824 void PopulateCacheStorageUsageInfo(LocalDataContainer* container);
775 void PopulateFlashLSOInfo(LocalDataContainer* container); 825 void PopulateFlashLSOInfo(LocalDataContainer* container);
826 void PopulateMediaLicenseInfo(LocalDataContainer* container);
776 827
777 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id); 828 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id);
778 LocalDataContainer* data_container() { 829 LocalDataContainer* data_container() {
779 return data_container_.get(); 830 return data_container_.get();
780 } 831 }
781 832
782 // Set the number of |batches_expected| this class should expect to receive. 833 // Set the number of |batches_expected| this class should expect to receive.
783 // If |reset| is true, then this is a new set of batches, but if false, then 834 // If |reset| is true, then this is a new set of batches, but if false, then
784 // this is a revised number (batches originally counted should no longer be 835 // this is a revised number (batches originally counted should no longer be
785 // expected). 836 // expected).
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 LocalDataContainer* container, 893 LocalDataContainer* container,
843 ScopedBatchUpdateNotifier* notifier, 894 ScopedBatchUpdateNotifier* notifier,
844 const base::string16& filter); 895 const base::string16& filter);
845 void PopulateCacheStorageUsageInfoWithFilter( 896 void PopulateCacheStorageUsageInfoWithFilter(
846 LocalDataContainer* container, 897 LocalDataContainer* container,
847 ScopedBatchUpdateNotifier* notifier, 898 ScopedBatchUpdateNotifier* notifier,
848 const base::string16& filter); 899 const base::string16& filter);
849 void PopulateFlashLSOInfoWithFilter(LocalDataContainer* container, 900 void PopulateFlashLSOInfoWithFilter(LocalDataContainer* container,
850 ScopedBatchUpdateNotifier* notifier, 901 ScopedBatchUpdateNotifier* notifier,
851 const base::string16& filter); 902 const base::string16& filter);
903 void PopulateMediaLicenseInfoWithFilter(LocalDataContainer* container,
904 ScopedBatchUpdateNotifier* notifier,
905 const base::string16& filter);
852 906
853 #if defined(ENABLE_EXTENSIONS) 907 #if defined(ENABLE_EXTENSIONS)
854 // The extension special storage policy; see ExtensionsProtectingNode() above. 908 // The extension special storage policy; see ExtensionsProtectingNode() above.
855 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_; 909 scoped_refptr<ExtensionSpecialStoragePolicy> special_storage_policy_;
856 #endif 910 #endif
857 911
858 // Map of app ids to LocalDataContainer objects to use when retrieving 912 // Map of app ids to LocalDataContainer objects to use when retrieving
859 // locally stored data. 913 // locally stored data.
860 std::unique_ptr<LocalDataContainer> data_container_; 914 std::unique_ptr<LocalDataContainer> data_container_;
861 915
(...skipping 10 matching lines...) Expand all
872 926
873 // Counts how many batches have started already. If this is non-zero and lower 927 // Counts how many batches have started already. If this is non-zero and lower
874 // than batches_ended_, then this model is still batching updates. 928 // than batches_ended_, then this model is still batching updates.
875 int batches_started_ = 0; 929 int batches_started_ = 0;
876 930
877 // Counts how many batches have finished. 931 // Counts how many batches have finished.
878 int batches_ended_ = 0; 932 int batches_ended_ = 0;
879 }; 933 };
880 934
881 #endif // CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_ 935 #endif // CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698