| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 13 #include <string> |
| 13 #include <vector> | 14 #include <vector> |
| 14 | 15 |
| 15 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 16 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 17 #include "base/string16.h" | 18 #include "base/string16.h" |
| 18 #include "base/utf_string_conversions.h" | 19 #include "base/utf_string_conversions.h" |
| 19 #include "chrome/browser/browsing_data_appcache_helper.h" | 20 #include "chrome/browser/browsing_data_appcache_helper.h" |
| 20 #include "chrome/browser/browsing_data_database_helper.h" | 21 #include "chrome/browser/browsing_data_database_helper.h" |
| 21 #include "chrome/browser/browsing_data_file_system_helper.h" | 22 #include "chrome/browser/browsing_data_file_system_helper.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 // CookieTreeOriginNode methods: | 218 // CookieTreeOriginNode methods: |
| 218 CookieTreeCookiesNode* GetOrCreateCookiesNode(); | 219 CookieTreeCookiesNode* GetOrCreateCookiesNode(); |
| 219 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); | 220 CookieTreeDatabasesNode* GetOrCreateDatabasesNode(); |
| 220 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); | 221 CookieTreeLocalStoragesNode* GetOrCreateLocalStoragesNode(); |
| 221 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); | 222 CookieTreeSessionStoragesNode* GetOrCreateSessionStoragesNode(); |
| 222 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); | 223 CookieTreeAppCachesNode* GetOrCreateAppCachesNode(); |
| 223 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); | 224 CookieTreeIndexedDBsNode* GetOrCreateIndexedDBsNode(); |
| 224 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); | 225 CookieTreeFileSystemsNode* GetOrCreateFileSystemsNode(); |
| 225 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( | 226 CookieTreeQuotaNode* UpdateOrCreateQuotaNode( |
| 226 BrowsingDataQuotaHelper::QuotaInfo* quota_info); | 227 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); |
| 227 | 228 |
| 228 // Creates an content exception for this origin of type | 229 // Creates an content exception for this origin of type |
| 229 // CONTENT_SETTINGS_TYPE_COOKIES. | 230 // CONTENT_SETTINGS_TYPE_COOKIES. |
| 230 void CreateContentException(HostContentSettingsMap* content_settings, | 231 void CreateContentException(HostContentSettingsMap* content_settings, |
| 231 ContentSetting setting) const; | 232 ContentSetting setting) const; |
| 232 | 233 |
| 233 // True if a content exception can be created for this origin. | 234 // True if a content exception can be created for this origin. |
| 234 bool CanCreateContentException() const; | 235 bool CanCreateContentException() const; |
| 235 | 236 |
| 236 private: | 237 private: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 252 GURL url_; | 253 GURL url_; |
| 253 | 254 |
| 254 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); | 255 DISALLOW_COPY_AND_ASSIGN(CookieTreeOriginNode); |
| 255 }; | 256 }; |
| 256 | 257 |
| 257 // CookieTreeCookieNode ------------------------------------------------------ | 258 // CookieTreeCookieNode ------------------------------------------------------ |
| 258 class CookieTreeCookieNode : public CookieTreeNode { | 259 class CookieTreeCookieNode : public CookieTreeNode { |
| 259 public: | 260 public: |
| 260 friend class CookieTreeCookiesNode; | 261 friend class CookieTreeCookiesNode; |
| 261 | 262 |
| 262 // Does not take ownership of cookie, and cookie should remain valid at least | 263 // The cookie should remain valid at least as long as the |
| 263 // as long as the CookieTreeCookieNode is valid. | 264 // CookieTreeCookieNode is valid. |
| 264 explicit CookieTreeCookieNode(net::CookieMonster::CanonicalCookie* cookie); | 265 explicit CookieTreeCookieNode( |
| 266 std::list<net::CookieMonster::CanonicalCookie>::iterator cookie); |
| 265 virtual ~CookieTreeCookieNode(); | 267 virtual ~CookieTreeCookieNode(); |
| 266 | 268 |
| 267 // CookieTreeNode methods: | 269 // CookieTreeNode methods: |
| 268 virtual void DeleteStoredObjects(); | 270 virtual void DeleteStoredObjects(); |
| 269 virtual DetailedInfo GetDetailedInfo() const; | 271 virtual DetailedInfo GetDetailedInfo() const; |
| 270 | 272 |
| 271 private: | 273 private: |
| 272 // Cookie_ is not owned by the node, and is expected to remain valid as long | 274 // cookie_ is expected to remain valid as long as the CookieTreeCookieNode is |
| 273 // as the CookieTreeCookieNode is valid. | 275 // valid. |
| 274 net::CookieMonster::CanonicalCookie* cookie_; | 276 std::list<net::CookieMonster::CanonicalCookie>::iterator cookie_; |
| 275 | 277 |
| 276 DISALLOW_COPY_AND_ASSIGN(CookieTreeCookieNode); | 278 DISALLOW_COPY_AND_ASSIGN(CookieTreeCookieNode); |
| 277 }; | 279 }; |
| 278 | 280 |
| 279 class CookieTreeCookiesNode : public CookieTreeNode { | 281 class CookieTreeCookiesNode : public CookieTreeNode { |
| 280 public: | 282 public: |
| 281 CookieTreeCookiesNode(); | 283 CookieTreeCookiesNode(); |
| 282 virtual ~CookieTreeCookiesNode(); | 284 virtual ~CookieTreeCookiesNode(); |
| 283 | 285 |
| 284 virtual DetailedInfo GetDetailedInfo() const; | 286 virtual DetailedInfo GetDetailedInfo() const; |
| 285 | 287 |
| 286 void AddCookieNode(CookieTreeCookieNode* child) { | 288 void AddCookieNode(CookieTreeCookieNode* child) { |
| 287 AddChildSortedByTitle(child); | 289 AddChildSortedByTitle(child); |
| 288 } | 290 } |
| 289 | 291 |
| 290 private: | 292 private: |
| 291 DISALLOW_COPY_AND_ASSIGN(CookieTreeCookiesNode); | 293 DISALLOW_COPY_AND_ASSIGN(CookieTreeCookiesNode); |
| 292 }; | 294 }; |
| 293 | 295 |
| 294 // CookieTreeAppCacheNode ----------------------------------------------------- | 296 // CookieTreeAppCacheNode ----------------------------------------------------- |
| 295 class CookieTreeAppCacheNode : public CookieTreeNode { | 297 class CookieTreeAppCacheNode : public CookieTreeNode { |
| 296 public: | 298 public: |
| 297 friend class CookieTreeAppCachesNode; | 299 friend class CookieTreeAppCachesNode; |
| 298 | 300 |
| 299 // Does not take ownership of appcache_info, and appcache_info should remain | 301 // appcache_info should remain valid at least as long as the |
| 300 // valid at least as long as the CookieTreeAppCacheNode is valid. | 302 // CookieTreeAppCacheNode is valid. |
| 301 explicit CookieTreeAppCacheNode( | 303 explicit CookieTreeAppCacheNode( |
| 302 const appcache::AppCacheInfo* appcache_info); | 304 const GURL& origin_url, |
| 305 std::list<appcache::AppCacheInfo>::iterator appcache_info); |
| 303 virtual ~CookieTreeAppCacheNode() {} | 306 virtual ~CookieTreeAppCacheNode() {} |
| 304 | 307 |
| 305 virtual void DeleteStoredObjects(); | 308 virtual void DeleteStoredObjects(); |
| 306 virtual DetailedInfo GetDetailedInfo() const; | 309 virtual DetailedInfo GetDetailedInfo() const; |
| 307 | 310 |
| 308 private: | 311 private: |
| 309 const appcache::AppCacheInfo* appcache_info_; | 312 GURL origin_url_; |
| 313 std::list<appcache::AppCacheInfo>::iterator appcache_info_; |
| 310 DISALLOW_COPY_AND_ASSIGN(CookieTreeAppCacheNode); | 314 DISALLOW_COPY_AND_ASSIGN(CookieTreeAppCacheNode); |
| 311 }; | 315 }; |
| 312 | 316 |
| 313 class CookieTreeAppCachesNode : public CookieTreeNode { | 317 class CookieTreeAppCachesNode : public CookieTreeNode { |
| 314 public: | 318 public: |
| 315 CookieTreeAppCachesNode(); | 319 CookieTreeAppCachesNode(); |
| 316 virtual ~CookieTreeAppCachesNode(); | 320 virtual ~CookieTreeAppCachesNode(); |
| 317 | 321 |
| 318 virtual DetailedInfo GetDetailedInfo() const; | 322 virtual DetailedInfo GetDetailedInfo() const; |
| 319 | 323 |
| 320 void AddAppCacheNode(CookieTreeAppCacheNode* child) { | 324 void AddAppCacheNode(CookieTreeAppCacheNode* child) { |
| 321 AddChildSortedByTitle(child); | 325 AddChildSortedByTitle(child); |
| 322 } | 326 } |
| 323 | 327 |
| 324 private: | 328 private: |
| 325 DISALLOW_COPY_AND_ASSIGN(CookieTreeAppCachesNode); | 329 DISALLOW_COPY_AND_ASSIGN(CookieTreeAppCachesNode); |
| 326 }; | 330 }; |
| 327 | 331 |
| 328 // CookieTreeDatabaseNode ----------------------------------------------------- | 332 // CookieTreeDatabaseNode ----------------------------------------------------- |
| 329 class CookieTreeDatabaseNode : public CookieTreeNode { | 333 class CookieTreeDatabaseNode : public CookieTreeNode { |
| 330 public: | 334 public: |
| 331 friend class CookieTreeDatabasesNode; | 335 friend class CookieTreeDatabasesNode; |
| 332 | 336 |
| 333 // Does not take ownership of database_info, and database_info should remain | 337 // database_info should remain valid at least as long as the |
| 334 // valid at least as long as the CookieTreeDatabaseNode is valid. | 338 // CookieTreeDatabaseNode is valid. |
| 335 explicit CookieTreeDatabaseNode( | 339 explicit CookieTreeDatabaseNode( |
| 336 BrowsingDataDatabaseHelper::DatabaseInfo* database_info); | 340 std::list<BrowsingDataDatabaseHelper::DatabaseInfo>::iterator |
| 341 database_info); |
| 337 virtual ~CookieTreeDatabaseNode(); | 342 virtual ~CookieTreeDatabaseNode(); |
| 338 | 343 |
| 339 virtual void DeleteStoredObjects(); | 344 virtual void DeleteStoredObjects(); |
| 340 virtual DetailedInfo GetDetailedInfo() const; | 345 virtual DetailedInfo GetDetailedInfo() const; |
| 341 | 346 |
| 342 private: | 347 private: |
| 343 // database_info_ is not owned by the node, and is expected to remain | 348 // database_info_ is expected to remain valid as long as the |
| 344 // valid as long as the CookieTreeDatabaseNode is valid. | 349 // CookieTreeDatabaseNode is valid. |
| 345 BrowsingDataDatabaseHelper::DatabaseInfo* database_info_; | 350 std::list<BrowsingDataDatabaseHelper::DatabaseInfo>::iterator |
| 351 database_info_; |
| 346 | 352 |
| 347 DISALLOW_COPY_AND_ASSIGN(CookieTreeDatabaseNode); | 353 DISALLOW_COPY_AND_ASSIGN(CookieTreeDatabaseNode); |
| 348 }; | 354 }; |
| 349 | 355 |
| 350 class CookieTreeDatabasesNode : public CookieTreeNode { | 356 class CookieTreeDatabasesNode : public CookieTreeNode { |
| 351 public: | 357 public: |
| 352 CookieTreeDatabasesNode(); | 358 CookieTreeDatabasesNode(); |
| 353 virtual ~CookieTreeDatabasesNode(); | 359 virtual ~CookieTreeDatabasesNode(); |
| 354 | 360 |
| 355 virtual DetailedInfo GetDetailedInfo() const; | 361 virtual DetailedInfo GetDetailedInfo() const; |
| 356 | 362 |
| 357 void AddDatabaseNode(CookieTreeDatabaseNode* child) { | 363 void AddDatabaseNode(CookieTreeDatabaseNode* child) { |
| 358 AddChildSortedByTitle(child); | 364 AddChildSortedByTitle(child); |
| 359 } | 365 } |
| 360 | 366 |
| 361 private: | 367 private: |
| 362 DISALLOW_COPY_AND_ASSIGN(CookieTreeDatabasesNode); | 368 DISALLOW_COPY_AND_ASSIGN(CookieTreeDatabasesNode); |
| 363 }; | 369 }; |
| 364 | 370 |
| 365 // CookieTreeFileSystemNode -------------------------------------------------- | 371 // CookieTreeFileSystemNode -------------------------------------------------- |
| 366 class CookieTreeFileSystemNode : public CookieTreeNode { | 372 class CookieTreeFileSystemNode : public CookieTreeNode { |
| 367 public: | 373 public: |
| 368 friend class CookieTreeFileSystemsNode; | 374 friend class CookieTreeFileSystemsNode; |
| 369 | 375 |
| 370 // Does not take ownership of file_system_info, and file_system_info should | 376 // file_system_info should remain valid at least as long as the |
| 371 // remain valid at least as long as the CookieTreeFileSystemNode is valid. | 377 // CookieTreeFileSystemNode is valid. |
| 372 explicit CookieTreeFileSystemNode( | 378 explicit CookieTreeFileSystemNode( |
| 373 BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info); | 379 std::list<BrowsingDataFileSystemHelper::FileSystemInfo>::iterator |
| 380 file_system_info); |
| 374 virtual ~CookieTreeFileSystemNode(); | 381 virtual ~CookieTreeFileSystemNode(); |
| 375 | 382 |
| 376 virtual void DeleteStoredObjects(); | 383 virtual void DeleteStoredObjects(); |
| 377 virtual DetailedInfo GetDetailedInfo() const; | 384 virtual DetailedInfo GetDetailedInfo() const; |
| 378 | 385 |
| 379 private: | 386 private: |
| 380 // file_system_info_ is not owned by the node, and is expected to remain | 387 // file_system_info_ expected to remain valid as long as the |
| 381 // valid as long as the CookieTreeFileSystemNode is valid. | 388 // CookieTreeFileSystemNode is valid. |
| 382 BrowsingDataFileSystemHelper::FileSystemInfo* file_system_info_; | 389 std::list<BrowsingDataFileSystemHelper::FileSystemInfo>::iterator |
| 390 file_system_info_; |
| 383 | 391 |
| 384 DISALLOW_COPY_AND_ASSIGN(CookieTreeFileSystemNode); | 392 DISALLOW_COPY_AND_ASSIGN(CookieTreeFileSystemNode); |
| 385 }; | 393 }; |
| 386 | 394 |
| 387 class CookieTreeFileSystemsNode : public CookieTreeNode { | 395 class CookieTreeFileSystemsNode : public CookieTreeNode { |
| 388 public: | 396 public: |
| 389 CookieTreeFileSystemsNode(); | 397 CookieTreeFileSystemsNode(); |
| 390 virtual ~CookieTreeFileSystemsNode(); | 398 virtual ~CookieTreeFileSystemsNode(); |
| 391 | 399 |
| 392 virtual DetailedInfo GetDetailedInfo() const; | 400 virtual DetailedInfo GetDetailedInfo() const; |
| 393 | 401 |
| 394 void AddFileSystemNode(CookieTreeFileSystemNode* child) { | 402 void AddFileSystemNode(CookieTreeFileSystemNode* child) { |
| 395 AddChildSortedByTitle(child); | 403 AddChildSortedByTitle(child); |
| 396 } | 404 } |
| 397 | 405 |
| 398 private: | 406 private: |
| 399 DISALLOW_COPY_AND_ASSIGN(CookieTreeFileSystemsNode); | 407 DISALLOW_COPY_AND_ASSIGN(CookieTreeFileSystemsNode); |
| 400 }; | 408 }; |
| 401 | 409 |
| 402 // CookieTreeLocalStorageNode ------------------------------------------------- | 410 // CookieTreeLocalStorageNode ------------------------------------------------- |
| 403 class CookieTreeLocalStorageNode : public CookieTreeNode { | 411 class CookieTreeLocalStorageNode : public CookieTreeNode { |
| 404 public: | 412 public: |
| 405 // Does not take ownership of local_storage_info, and local_storage_info | 413 // local_storage_info should remain valid at least as long as the |
| 406 // should remain valid at least as long as the CookieTreeLocalStorageNode is | 414 // CookieTreeLocalStorageNode is valid. |
| 407 // valid. | |
| 408 explicit CookieTreeLocalStorageNode( | 415 explicit CookieTreeLocalStorageNode( |
| 409 BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info); | 416 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator |
| 417 local_storage_info); |
| 410 virtual ~CookieTreeLocalStorageNode(); | 418 virtual ~CookieTreeLocalStorageNode(); |
| 411 | 419 |
| 412 // CookieTreeNode methods: | 420 // CookieTreeNode methods: |
| 413 virtual void DeleteStoredObjects(); | 421 virtual void DeleteStoredObjects(); |
| 414 virtual DetailedInfo GetDetailedInfo() const; | 422 virtual DetailedInfo GetDetailedInfo() const; |
| 415 | 423 |
| 416 private: | 424 private: |
| 417 // local_storage_info_ is not owned by the node, and is expected to remain | 425 // local_storage_info_ is expected to remain valid as long as the |
| 418 // valid as long as the CookieTreeLocalStorageNode is valid. | 426 // CookieTreeLocalStorageNode is valid. |
| 419 BrowsingDataLocalStorageHelper::LocalStorageInfo* local_storage_info_; | 427 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator |
| 428 local_storage_info_; |
| 420 | 429 |
| 421 DISALLOW_COPY_AND_ASSIGN(CookieTreeLocalStorageNode); | 430 DISALLOW_COPY_AND_ASSIGN(CookieTreeLocalStorageNode); |
| 422 }; | 431 }; |
| 423 | 432 |
| 424 class CookieTreeLocalStoragesNode : public CookieTreeNode { | 433 class CookieTreeLocalStoragesNode : public CookieTreeNode { |
| 425 public: | 434 public: |
| 426 CookieTreeLocalStoragesNode(); | 435 CookieTreeLocalStoragesNode(); |
| 427 virtual ~CookieTreeLocalStoragesNode(); | 436 virtual ~CookieTreeLocalStoragesNode(); |
| 428 | 437 |
| 429 virtual DetailedInfo GetDetailedInfo() const; | 438 virtual DetailedInfo GetDetailedInfo() const; |
| 430 | 439 |
| 431 void AddLocalStorageNode(CookieTreeLocalStorageNode* child) { | 440 void AddLocalStorageNode(CookieTreeLocalStorageNode* child) { |
| 432 AddChildSortedByTitle(child); | 441 AddChildSortedByTitle(child); |
| 433 } | 442 } |
| 434 | 443 |
| 435 private: | 444 private: |
| 436 | 445 |
| 437 DISALLOW_COPY_AND_ASSIGN(CookieTreeLocalStoragesNode); | 446 DISALLOW_COPY_AND_ASSIGN(CookieTreeLocalStoragesNode); |
| 438 }; | 447 }; |
| 439 | 448 |
| 440 | 449 |
| 441 // CookieTreeSessionStorageNode ----------------------------------------------- | 450 // CookieTreeSessionStorageNode ----------------------------------------------- |
| 442 class CookieTreeSessionStorageNode : public CookieTreeNode { | 451 class CookieTreeSessionStorageNode : public CookieTreeNode { |
| 443 public: | 452 public: |
| 444 // Does not take ownership of session_storage_info, and session_storage_info | 453 // session_storage_info should remain valid at least as long as the |
| 445 // should remain valid at least as long as the CookieTreeSessionStorageNode | 454 // CookieTreeSessionStorageNode is valid. |
| 446 // is valid. | |
| 447 explicit CookieTreeSessionStorageNode( | 455 explicit CookieTreeSessionStorageNode( |
| 448 BrowsingDataLocalStorageHelper::LocalStorageInfo* session_storage_info); | 456 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator |
| 457 session_storage_info); |
| 449 virtual ~CookieTreeSessionStorageNode(); | 458 virtual ~CookieTreeSessionStorageNode(); |
| 450 | 459 |
| 451 // CookieTreeNode methods: | 460 // CookieTreeNode methods: |
| 461 virtual void DeleteStoredObjects(); |
| 452 virtual DetailedInfo GetDetailedInfo() const; | 462 virtual DetailedInfo GetDetailedInfo() const; |
| 453 | 463 |
| 454 private: | 464 private: |
| 455 // session_storage_info_ is not owned by the node, and is expected to remain | 465 // session_storage_info_ is expected to remain valid as long as the |
| 456 // valid as long as the CookieTreeSessionStorageNode is valid. | 466 // CookieTreeSessionStorageNode is valid. |
| 457 BrowsingDataLocalStorageHelper::LocalStorageInfo* session_storage_info_; | 467 std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo>::iterator |
| 468 session_storage_info_; |
| 458 | 469 |
| 459 DISALLOW_COPY_AND_ASSIGN(CookieTreeSessionStorageNode); | 470 DISALLOW_COPY_AND_ASSIGN(CookieTreeSessionStorageNode); |
| 460 }; | 471 }; |
| 461 | 472 |
| 462 class CookieTreeSessionStoragesNode : public CookieTreeNode { | 473 class CookieTreeSessionStoragesNode : public CookieTreeNode { |
| 463 public: | 474 public: |
| 464 CookieTreeSessionStoragesNode(); | 475 CookieTreeSessionStoragesNode(); |
| 465 virtual ~CookieTreeSessionStoragesNode(); | 476 virtual ~CookieTreeSessionStoragesNode(); |
| 466 | 477 |
| 467 virtual DetailedInfo GetDetailedInfo() const; | 478 virtual DetailedInfo GetDetailedInfo() const; |
| 468 | 479 |
| 469 void AddSessionStorageNode(CookieTreeSessionStorageNode* child) { | 480 void AddSessionStorageNode(CookieTreeSessionStorageNode* child) { |
| 470 AddChildSortedByTitle(child); | 481 AddChildSortedByTitle(child); |
| 471 } | 482 } |
| 472 | 483 |
| 473 private: | 484 private: |
| 474 | 485 |
| 475 DISALLOW_COPY_AND_ASSIGN(CookieTreeSessionStoragesNode); | 486 DISALLOW_COPY_AND_ASSIGN(CookieTreeSessionStoragesNode); |
| 476 }; | 487 }; |
| 477 | 488 |
| 478 // CookieTreeIndexedDBNode ----------------------------------------------- | 489 // CookieTreeIndexedDBNode ----------------------------------------------- |
| 479 class CookieTreeIndexedDBNode : public CookieTreeNode { | 490 class CookieTreeIndexedDBNode : public CookieTreeNode { |
| 480 public: | 491 public: |
| 481 // Does not take ownership of session_storage_info, and session_storage_info | 492 // indexed_db_info should remain valid at least as long as the |
| 482 // should remain valid at least as long as the CookieTreeSessionStorageNode | 493 // CookieTreeIndexedDBNode is valid. |
| 483 // is valid. | |
| 484 explicit CookieTreeIndexedDBNode( | 494 explicit CookieTreeIndexedDBNode( |
| 485 BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info); | 495 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>::iterator |
| 496 indexed_db_info); |
| 486 virtual ~CookieTreeIndexedDBNode(); | 497 virtual ~CookieTreeIndexedDBNode(); |
| 487 | 498 |
| 488 // CookieTreeNode methods: | 499 // CookieTreeNode methods: |
| 489 virtual void DeleteStoredObjects(); | 500 virtual void DeleteStoredObjects(); |
| 490 virtual DetailedInfo GetDetailedInfo() const; | 501 virtual DetailedInfo GetDetailedInfo() const; |
| 491 | 502 |
| 492 private: | 503 private: |
| 493 // indexed_db_info_ is not owned by the node, and is expected to remain | 504 // indexed_db_info_ is expected to remain valid as long as the |
| 494 // valid as long as the CookieTreeIndexedDBNode is valid. | 505 // CookieTreeIndexedDBNode is valid. |
| 495 BrowsingDataIndexedDBHelper::IndexedDBInfo* indexed_db_info_; | 506 std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo>::iterator |
| 507 indexed_db_info_; |
| 496 | 508 |
| 497 DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBNode); | 509 DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBNode); |
| 498 }; | 510 }; |
| 499 | 511 |
| 500 class CookieTreeIndexedDBsNode : public CookieTreeNode { | 512 class CookieTreeIndexedDBsNode : public CookieTreeNode { |
| 501 public: | 513 public: |
| 502 CookieTreeIndexedDBsNode(); | 514 CookieTreeIndexedDBsNode(); |
| 503 virtual ~CookieTreeIndexedDBsNode(); | 515 virtual ~CookieTreeIndexedDBsNode(); |
| 504 | 516 |
| 505 virtual DetailedInfo GetDetailedInfo() const; | 517 virtual DetailedInfo GetDetailedInfo() const; |
| 506 | 518 |
| 507 void AddIndexedDBNode(CookieTreeIndexedDBNode* child) { | 519 void AddIndexedDBNode(CookieTreeIndexedDBNode* child) { |
| 508 AddChildSortedByTitle(child); | 520 AddChildSortedByTitle(child); |
| 509 } | 521 } |
| 510 | 522 |
| 511 private: | 523 private: |
| 512 DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBsNode); | 524 DISALLOW_COPY_AND_ASSIGN(CookieTreeIndexedDBsNode); |
| 513 }; | 525 }; |
| 514 | 526 |
| 515 // CookieTreeQuotaNode -------------------------------------------------- | 527 // CookieTreeQuotaNode -------------------------------------------------- |
| 516 class CookieTreeQuotaNode : public CookieTreeNode { | 528 class CookieTreeQuotaNode : public CookieTreeNode { |
| 517 public: | 529 public: |
| 518 // Does not take ownership of quota_info, and quota_info should remain valid | 530 // quota_info should remain valid at least as long as the CookieTreeQuotaNode |
| 519 // at least as long as the CookieTreeQuotaNode is valid. | 531 // is valid. |
| 520 explicit CookieTreeQuotaNode(BrowsingDataQuotaHelper::QuotaInfo* quota_info); | 532 explicit CookieTreeQuotaNode( |
| 533 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info); |
| 521 virtual ~CookieTreeQuotaNode(); | 534 virtual ~CookieTreeQuotaNode(); |
| 522 | 535 |
| 523 virtual void DeleteStoredObjects(); | 536 virtual void DeleteStoredObjects(); |
| 524 virtual DetailedInfo GetDetailedInfo() const; | 537 virtual DetailedInfo GetDetailedInfo() const; |
| 525 | 538 |
| 526 private: | 539 private: |
| 527 // quota_info_ is not owned by the node, and is expected to remain valid as | 540 // quota_info_ is expected to remain valid as long as the CookieTreeQuotaNode |
| 528 // long as the CookieTreeQuotaNode is valid. | 541 // is valid. |
| 529 BrowsingDataQuotaHelper::QuotaInfo* quota_info_; | 542 std::list<BrowsingDataQuotaHelper::QuotaInfo>::iterator quota_info_; |
| 530 | 543 |
| 531 DISALLOW_COPY_AND_ASSIGN(CookieTreeQuotaNode); | 544 DISALLOW_COPY_AND_ASSIGN(CookieTreeQuotaNode); |
| 532 }; | 545 }; |
| 533 | 546 |
| 534 // CookiesTreeModel ----------------------------------------------------------- | 547 // CookiesTreeModel ----------------------------------------------------------- |
| 535 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { | 548 class CookiesTreeModel : public ui::TreeNodeModel<CookieTreeNode> { |
| 536 public: | 549 public: |
| 537 // Because non-cookie nodes are fetched in a background thread, they are not | 550 // Because non-cookie nodes are fetched in a background thread, they are not |
| 538 // present at the time the Model is created. The Model then notifies its | 551 // present at the time the Model is created. The Model then notifies its |
| 539 // observers for every item added from databases, local storage, and | 552 // observers for every item added from databases, local storage, and |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 // not get CookiesTreeModel::Observer notifications. | 593 // not get CookiesTreeModel::Observer notifications. |
| 581 virtual void AddCookiesTreeObserver(Observer* observer); | 594 virtual void AddCookiesTreeObserver(Observer* observer); |
| 582 virtual void RemoveCookiesTreeObserver(Observer* observer); | 595 virtual void RemoveCookiesTreeObserver(Observer* observer); |
| 583 | 596 |
| 584 private: | 597 private: |
| 585 enum CookieIconIndex { | 598 enum CookieIconIndex { |
| 586 ORIGIN = 0, | 599 ORIGIN = 0, |
| 587 COOKIE = 1, | 600 COOKIE = 1, |
| 588 DATABASE = 2 | 601 DATABASE = 2 |
| 589 }; | 602 }; |
| 590 typedef net::CookieList CookieList; | 603 typedef std::list<net::CookieMonster::CanonicalCookie> CookieList; |
| 591 typedef std::vector<BrowsingDataDatabaseHelper::DatabaseInfo> | 604 typedef std::list<BrowsingDataDatabaseHelper::DatabaseInfo> |
| 592 DatabaseInfoList; | 605 DatabaseInfoList; |
| 593 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 606 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 594 LocalStorageInfoList; | 607 LocalStorageInfoList; |
| 595 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 608 typedef std::list<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 596 SessionStorageInfoList; | 609 SessionStorageInfoList; |
| 597 typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> | 610 typedef std::list<BrowsingDataIndexedDBHelper::IndexedDBInfo> |
| 598 IndexedDBInfoList; | 611 IndexedDBInfoList; |
| 599 typedef std::vector<BrowsingDataFileSystemHelper::FileSystemInfo> | 612 typedef std::list<BrowsingDataFileSystemHelper::FileSystemInfo> |
| 600 FileSystemInfoList; | 613 FileSystemInfoList; |
| 601 typedef std::vector<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray; | 614 typedef std::list<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray; |
| 602 | 615 |
| 603 void OnAppCacheModelInfoLoaded(); | 616 void OnAppCacheModelInfoLoaded(); |
| 604 void OnCookiesModelInfoLoaded(const CookieList& cookie_list); | 617 void OnCookiesModelInfoLoaded(const net::CookieList& cookie_list); |
| 605 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); | 618 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); |
| 606 void OnLocalStorageModelInfoLoaded( | 619 void OnLocalStorageModelInfoLoaded( |
| 607 const LocalStorageInfoList& local_storage_info); | 620 const LocalStorageInfoList& local_storage_info); |
| 608 void OnSessionStorageModelInfoLoaded( | 621 void OnSessionStorageModelInfoLoaded( |
| 609 const LocalStorageInfoList& local_storage_info); | 622 const LocalStorageInfoList& local_storage_info); |
| 610 void OnIndexedDBModelInfoLoaded( | 623 void OnIndexedDBModelInfoLoaded( |
| 611 const IndexedDBInfoList& indexed_db_info); | 624 const IndexedDBInfoList& indexed_db_info); |
| 612 void OnFileSystemModelInfoLoaded( | 625 void OnFileSystemModelInfoLoaded( |
| 613 const FileSystemInfoList& file_system_info); | 626 const FileSystemInfoList& file_system_info); |
| 614 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); | 627 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 627 | 640 |
| 628 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 641 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
| 629 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; | 642 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
| 630 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 643 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
| 631 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 644 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
| 632 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 645 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
| 633 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 646 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
| 634 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 647 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
| 635 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; | 648 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
| 636 | 649 |
| 637 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; | 650 std::map<GURL, std::list<appcache::AppCacheInfo> > appcache_info_; |
| 638 CookieList cookie_list_; | 651 CookieList cookie_list_; |
| 639 DatabaseInfoList database_info_list_; | 652 DatabaseInfoList database_info_list_; |
| 640 LocalStorageInfoList local_storage_info_list_; | 653 LocalStorageInfoList local_storage_info_list_; |
| 641 LocalStorageInfoList session_storage_info_list_; | 654 LocalStorageInfoList session_storage_info_list_; |
| 642 IndexedDBInfoList indexed_db_info_list_; | 655 IndexedDBInfoList indexed_db_info_list_; |
| 643 FileSystemInfoList file_system_info_list_; | 656 FileSystemInfoList file_system_info_list_; |
| 644 QuotaInfoArray quota_info_list_; | 657 QuotaInfoArray quota_info_list_; |
| 645 | 658 |
| 646 // The CookiesTreeModel maintains a separate list of observers that are | 659 // The CookiesTreeModel maintains a separate list of observers that are |
| 647 // specifically of the type CookiesTreeModel::Observer. | 660 // specifically of the type CookiesTreeModel::Observer. |
| 648 ObserverList<Observer> cookies_observer_list_; | 661 ObserverList<Observer> cookies_observer_list_; |
| 649 | 662 |
| 650 // If this is non-zero, then this model is batching updates (there's a lot of | 663 // If this is non-zero, then this model is batching updates (there's a lot of |
| 651 // notifications coming down the pipe). This is an integer is used to balance | 664 // notifications coming down the pipe). This is an integer is used to balance |
| 652 // calls to Begin/EndBatch() if they're called in a nested manner. | 665 // calls to Begin/EndBatch() if they're called in a nested manner. |
| 653 int batch_update_; | 666 int batch_update_; |
| 654 | 667 |
| 655 // If true, use the CanonicalCookie::Source attribute to group cookies. | 668 // If true, use the CanonicalCookie::Source attribute to group cookies. |
| 656 // Otherwise, use the CanonicalCookie::Domain attribute. | 669 // Otherwise, use the CanonicalCookie::Domain attribute. |
| 657 bool use_cookie_source_; | 670 bool use_cookie_source_; |
| 658 | 671 |
| 659 friend class CookieTreeAppCacheNode; | 672 friend class CookieTreeAppCacheNode; |
| 660 friend class CookieTreeCookieNode; | 673 friend class CookieTreeCookieNode; |
| 661 friend class CookieTreeDatabaseNode; | 674 friend class CookieTreeDatabaseNode; |
| 662 friend class CookieTreeLocalStorageNode; | 675 friend class CookieTreeLocalStorageNode; |
| 676 friend class CookieTreeSessionStorageNode; |
| 663 friend class CookieTreeIndexedDBNode; | 677 friend class CookieTreeIndexedDBNode; |
| 664 friend class CookieTreeFileSystemNode; | 678 friend class CookieTreeFileSystemNode; |
| 665 friend class CookieTreeQuotaNode; | 679 friend class CookieTreeQuotaNode; |
| 666 | 680 |
| 667 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); | 681 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); |
| 668 }; | 682 }; |
| 669 | 683 |
| 670 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 684 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
| OLD | NEW |