OLD | NEW |
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 |
11 #include <list> | 11 #include <list> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
18 #include "base/string16.h" | 18 #include "base/string16.h" |
19 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
20 #include "chrome/browser/browsing_data_appcache_helper.h" | 20 #include "chrome/browser/browsing_data_appcache_helper.h" |
21 #include "chrome/browser/browsing_data_database_helper.h" | 21 #include "chrome/browser/browsing_data_database_helper.h" |
22 #include "chrome/browser/browsing_data_file_system_helper.h" | 22 #include "chrome/browser/browsing_data_file_system_helper.h" |
23 #include "chrome/browser/browsing_data_indexed_db_helper.h" | 23 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
24 #include "chrome/browser/browsing_data_local_storage_helper.h" | 24 #include "chrome/browser/browsing_data_local_storage_helper.h" |
25 #include "chrome/browser/browsing_data_quota_helper.h" | 25 #include "chrome/browser/browsing_data_quota_helper.h" |
26 #include "chrome/browser/local_data_container.h" | 26 #include "chrome/browser/local_data_container.h" |
27 #include "chrome/common/content_settings.h" | 27 #include "chrome/common/content_settings.h" |
28 #include "chrome/common/extensions/extension_set.h" | 28 #include "chrome/common/extensions/extension_set.h" |
29 #include "net/base/server_bound_cert_store.h" | 29 #include "net/base/server_bound_cert_store.h" |
30 #include "net/cookies/cookie_monster.h" | |
31 #include "ui/base/models/tree_node_model.h" | 30 #include "ui/base/models/tree_node_model.h" |
32 | 31 |
33 class BrowsingDataCookieHelper; | 32 class BrowsingDataCookieHelper; |
34 class BrowsingDataServerBoundCertHelper; | 33 class BrowsingDataServerBoundCertHelper; |
35 class CookieSettings; | 34 class CookieSettings; |
36 class CookiesTreeModel; | 35 class CookiesTreeModel; |
37 class CookieTreeAppCacheNode; | 36 class CookieTreeAppCacheNode; |
38 class CookieTreeAppCachesNode; | 37 class CookieTreeAppCachesNode; |
39 class CookieTreeCookieNode; | 38 class CookieTreeCookieNode; |
40 class CookieTreeCookiesNode; | 39 class CookieTreeCookiesNode; |
41 class CookieTreeDatabaseNode; | 40 class CookieTreeDatabaseNode; |
42 class CookieTreeDatabasesNode; | 41 class CookieTreeDatabasesNode; |
43 class CookieTreeFileSystemNode; | 42 class CookieTreeFileSystemNode; |
44 class CookieTreeFileSystemsNode; | 43 class CookieTreeFileSystemsNode; |
45 class CookieTreeHostNode; | 44 class CookieTreeHostNode; |
46 class CookieTreeIndexedDBNode; | 45 class CookieTreeIndexedDBNode; |
47 class CookieTreeIndexedDBsNode; | 46 class CookieTreeIndexedDBsNode; |
48 class CookieTreeLocalStorageNode; | 47 class CookieTreeLocalStorageNode; |
49 class CookieTreeLocalStoragesNode; | 48 class CookieTreeLocalStoragesNode; |
50 class CookieTreeQuotaNode; | 49 class CookieTreeQuotaNode; |
51 class CookieTreeServerBoundCertNode; | 50 class CookieTreeServerBoundCertNode; |
52 class CookieTreeServerBoundCertsNode; | 51 class CookieTreeServerBoundCertsNode; |
53 class CookieTreeSessionStorageNode; | 52 class CookieTreeSessionStorageNode; |
54 class CookieTreeSessionStoragesNode; | 53 class CookieTreeSessionStoragesNode; |
55 class ExtensionSpecialStoragePolicy; | 54 class ExtensionSpecialStoragePolicy; |
56 | 55 |
| 56 namespace net { |
| 57 class CanonicalCookie; |
| 58 } |
| 59 |
57 // CookieTreeNode ------------------------------------------------------------- | 60 // CookieTreeNode ------------------------------------------------------------- |
58 // The base node type in the Cookies, Databases, and Local Storage options | 61 // The base node type in the Cookies, Databases, and Local Storage options |
59 // view, from which all other types are derived. Specialized from TreeNode in | 62 // view, from which all other types are derived. Specialized from TreeNode in |
60 // that it has a notion of deleting objects stored in the profile, and being | 63 // that it has a notion of deleting objects stored in the profile, and being |
61 // able to have its children do the same. | 64 // able to have its children do the same. |
62 class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { | 65 class CookieTreeNode : public ui::TreeNode<CookieTreeNode> { |
63 public: | 66 public: |
64 // Used to pull out information for the InfoView (the details display below | 67 // Used to pull out information for the InfoView (the details display below |
65 // the tree control.) | 68 // the tree control.) |
66 struct DetailedInfo { | 69 struct DetailedInfo { |
(...skipping 20 matching lines...) Expand all Loading... |
87 TYPE_SERVER_BOUND_CERTS, // Used for CookieTreeServerBoundCertsNode. | 90 TYPE_SERVER_BOUND_CERTS, // Used for CookieTreeServerBoundCertsNode. |
88 TYPE_SERVER_BOUND_CERT, // Used for CookieTreeServerBoundCertNode. | 91 TYPE_SERVER_BOUND_CERT, // Used for CookieTreeServerBoundCertNode. |
89 }; | 92 }; |
90 | 93 |
91 DetailedInfo(); | 94 DetailedInfo(); |
92 ~DetailedInfo(); | 95 ~DetailedInfo(); |
93 | 96 |
94 DetailedInfo& Init(NodeType type); | 97 DetailedInfo& Init(NodeType type); |
95 DetailedInfo& InitHost(const std::string& app_id, | 98 DetailedInfo& InitHost(const std::string& app_id, |
96 const std::string& app_name); | 99 const std::string& app_name); |
97 DetailedInfo& InitCookie( | 100 DetailedInfo& InitCookie(const net::CanonicalCookie* cookie); |
98 const net::CookieMonster::CanonicalCookie* cookie); | |
99 DetailedInfo& InitDatabase( | 101 DetailedInfo& InitDatabase( |
100 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info); | 102 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info); |
101 DetailedInfo& InitLocalStorage( | 103 DetailedInfo& InitLocalStorage( |
102 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 104 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
103 local_storage_info); | 105 local_storage_info); |
104 DetailedInfo& InitSessionStorage( | 106 DetailedInfo& InitSessionStorage( |
105 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 107 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
106 session_storage_info); | 108 session_storage_info); |
107 DetailedInfo& InitAppCache(const GURL& origin, | 109 DetailedInfo& InitAppCache(const GURL& origin, |
108 const appcache::AppCacheInfo* appcache_info); | 110 const appcache::AppCacheInfo* appcache_info); |
109 DetailedInfo& InitIndexedDB( | 111 DetailedInfo& InitIndexedDB( |
110 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info); | 112 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info); |
111 DetailedInfo& InitFileSystem( | 113 DetailedInfo& InitFileSystem( |
112 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info); | 114 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info); |
113 DetailedInfo& InitQuota( | 115 DetailedInfo& InitQuota( |
114 const BrowsingDataQuotaHelper::QuotaInfo* quota_info); | 116 const BrowsingDataQuotaHelper::QuotaInfo* quota_info); |
115 DetailedInfo& InitServerBoundCert( | 117 DetailedInfo& InitServerBoundCert( |
116 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert); | 118 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert); |
117 | 119 |
118 std::string app_name; | 120 std::string app_name; |
119 std::string app_id; | 121 std::string app_id; |
120 NodeType node_type; | 122 NodeType node_type; |
121 GURL origin; | 123 GURL origin; |
122 const net::CookieMonster::CanonicalCookie* cookie; | 124 const net::CanonicalCookie* cookie; |
123 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; | 125 const BrowsingDataDatabaseHelper::DatabaseInfo* database_info; |
124 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; | 126 const BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info; |
125 const BrowsingDataLocalStorageHelper::LocalStorageInfo* | 127 const BrowsingDataLocalStorageHelper::LocalStorageInfo* |
126 session_storage_info; | 128 session_storage_info; |
127 const appcache::AppCacheInfo* appcache_info; | 129 const appcache::AppCacheInfo* appcache_info; |
128 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; | 130 const BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info; |
129 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; | 131 const BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info; |
130 const BrowsingDataQuotaHelper::QuotaInfo* quota_info; | 132 const BrowsingDataQuotaHelper::QuotaInfo* quota_info; |
131 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert; | 133 const net::ServerBoundCertStore::ServerBoundCert* server_bound_cert; |
132 }; | 134 }; |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 }; | 247 }; |
246 | 248 |
247 // CookieTreeCookieNode ------------------------------------------------------ | 249 // CookieTreeCookieNode ------------------------------------------------------ |
248 class CookieTreeCookieNode : public CookieTreeNode { | 250 class CookieTreeCookieNode : public CookieTreeNode { |
249 public: | 251 public: |
250 friend class CookieTreeCookiesNode; | 252 friend class CookieTreeCookiesNode; |
251 | 253 |
252 // The cookie should remain valid at least as long as the | 254 // The cookie should remain valid at least as long as the |
253 // CookieTreeCookieNode is valid. | 255 // CookieTreeCookieNode is valid. |
254 explicit CookieTreeCookieNode( | 256 explicit CookieTreeCookieNode( |
255 std::list<net::CookieMonster::CanonicalCookie>::iterator cookie); | 257 std::list<net::CanonicalCookie>::iterator cookie); |
256 virtual ~CookieTreeCookieNode(); | 258 virtual ~CookieTreeCookieNode(); |
257 | 259 |
258 // CookieTreeNode methods: | 260 // CookieTreeNode methods: |
259 virtual void DeleteStoredObjects() OVERRIDE; | 261 virtual void DeleteStoredObjects() OVERRIDE; |
260 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; | 262 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; |
261 | 263 |
262 private: | 264 private: |
263 // cookie_ is expected to remain valid as long as the CookieTreeCookieNode is | 265 // cookie_ is expected to remain valid as long as the CookieTreeCookieNode is |
264 // valid. | 266 // valid. |
265 std::list<net::CookieMonster::CanonicalCookie>::iterator cookie_; | 267 std::list<net::CanonicalCookie>::iterator cookie_; |
266 | 268 |
267 DISALLOW_COPY_AND_ASSIGN(CookieTreeCookieNode); | 269 DISALLOW_COPY_AND_ASSIGN(CookieTreeCookieNode); |
268 }; | 270 }; |
269 | 271 |
270 class CookieTreeCookiesNode : public CookieTreeNode { | 272 class CookieTreeCookiesNode : public CookieTreeNode { |
271 public: | 273 public: |
272 CookieTreeCookiesNode(); | 274 CookieTreeCookiesNode(); |
273 virtual ~CookieTreeCookiesNode(); | 275 virtual ~CookieTreeCookiesNode(); |
274 | 276 |
275 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; | 277 virtual DetailedInfo GetDetailedInfo() const OVERRIDE; |
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 // Otherwise, use the CanonicalCookie::Domain attribute. | 712 // Otherwise, use the CanonicalCookie::Domain attribute. |
711 bool group_by_cookie_source_; | 713 bool group_by_cookie_source_; |
712 | 714 |
713 // If this is non-zero, then this model is batching updates (there's a lot of | 715 // If this is non-zero, then this model is batching updates (there's a lot of |
714 // notifications coming down the pipe). This is an integer is used to balance | 716 // notifications coming down the pipe). This is an integer is used to balance |
715 // calls to Begin/EndBatch() if they're called in a nested manner. | 717 // calls to Begin/EndBatch() if they're called in a nested manner. |
716 int batch_update_; | 718 int batch_update_; |
717 }; | 719 }; |
718 | 720 |
719 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 721 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
OLD | NEW |