| 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 <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/observer_list.h" | 16 #include "base/observer_list.h" |
| 17 #include "base/string16.h" | 17 #include "base/string16.h" |
| 18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
| 19 #include "chrome/browser/browsing_data_appcache_helper.h" | 19 #include "chrome/browser/browsing_data_appcache_helper.h" |
| 20 #include "chrome/browser/browsing_data_database_helper.h" | 20 #include "chrome/browser/browsing_data_database_helper.h" |
| 21 #include "chrome/browser/browsing_data_file_system_helper.h" | 21 #include "chrome/browser/browsing_data_file_system_helper.h" |
| 22 #include "chrome/browser/browsing_data_indexed_db_helper.h" | 22 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
| 23 #include "chrome/browser/browsing_data_local_storage_helper.h" | 23 #include "chrome/browser/browsing_data_local_storage_helper.h" |
| 24 #include "chrome/browser/browsing_data_quota_helper.h" | 24 #include "chrome/browser/browsing_data_quota_helper.h" |
| 25 #include "chrome/common/content_settings.h" | 25 #include "chrome/common/content_settings.h" |
| 26 #include "net/base/cookie_monster.h" | 26 #include "net/base/cookie_monster.h" |
| 27 #include "ui/base/models/tree_node_model.h" | 27 #include "ui/base/models/tree_node_model.h" |
| 28 | 28 |
| 29 class BrowsingDataCookieHelper; |
| 29 class CookiesTreeModel; | 30 class CookiesTreeModel; |
| 30 class CookieTreeAppCacheNode; | 31 class CookieTreeAppCacheNode; |
| 31 class CookieTreeAppCachesNode; | 32 class CookieTreeAppCachesNode; |
| 32 class CookieTreeCookieNode; | 33 class CookieTreeCookieNode; |
| 33 class CookieTreeCookiesNode; | 34 class CookieTreeCookiesNode; |
| 34 class CookieTreeDatabaseNode; | 35 class CookieTreeDatabaseNode; |
| 35 class CookieTreeDatabasesNode; | 36 class CookieTreeDatabasesNode; |
| 36 class CookieTreeFileSystemsNode; | 37 class CookieTreeFileSystemsNode; |
| 37 class CookieTreeFileSystemNode; | 38 class CookieTreeFileSystemNode; |
| 38 class CookieTreeLocalStorageNode; | 39 class CookieTreeLocalStorageNode; |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 // observers for every item added from databases, local storage, and | 539 // observers for every item added from databases, local storage, and |
| 539 // appcache. We extend the Observer interface to add notifications before and | 540 // appcache. We extend the Observer interface to add notifications before and |
| 540 // after these batch inserts. | 541 // after these batch inserts. |
| 541 class Observer : public ui::TreeModelObserver { | 542 class Observer : public ui::TreeModelObserver { |
| 542 public: | 543 public: |
| 543 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {} | 544 virtual void TreeModelBeginBatch(CookiesTreeModel* model) {} |
| 544 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} | 545 virtual void TreeModelEndBatch(CookiesTreeModel* model) {} |
| 545 }; | 546 }; |
| 546 | 547 |
| 547 CookiesTreeModel( | 548 CookiesTreeModel( |
| 548 net::CookieMonster* cookie_monster_, | 549 BrowsingDataCookieHelper* cookie_helper, |
| 549 BrowsingDataDatabaseHelper* database_helper, | 550 BrowsingDataDatabaseHelper* database_helper, |
| 550 BrowsingDataLocalStorageHelper* local_storage_helper, | 551 BrowsingDataLocalStorageHelper* local_storage_helper, |
| 551 BrowsingDataLocalStorageHelper* session_storage_helper, | 552 BrowsingDataLocalStorageHelper* session_storage_helper, |
| 552 BrowsingDataAppCacheHelper* appcache_helper, | 553 BrowsingDataAppCacheHelper* appcache_helper, |
| 553 BrowsingDataIndexedDBHelper* indexed_db_helper, | 554 BrowsingDataIndexedDBHelper* indexed_db_helper, |
| 554 BrowsingDataFileSystemHelper* file_system_helper, | 555 BrowsingDataFileSystemHelper* file_system_helper, |
| 555 BrowsingDataQuotaHelper* quota_helper, | 556 BrowsingDataQuotaHelper* quota_helper, |
| 556 bool use_cookie_source); | 557 bool use_cookie_source); |
| 557 virtual ~CookiesTreeModel(); | 558 virtual ~CookiesTreeModel(); |
| 558 | 559 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 593 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 593 LocalStorageInfoList; | 594 LocalStorageInfoList; |
| 594 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> | 595 typedef std::vector<BrowsingDataLocalStorageHelper::LocalStorageInfo> |
| 595 SessionStorageInfoList; | 596 SessionStorageInfoList; |
| 596 typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> | 597 typedef std::vector<BrowsingDataIndexedDBHelper::IndexedDBInfo> |
| 597 IndexedDBInfoList; | 598 IndexedDBInfoList; |
| 598 typedef std::vector<BrowsingDataFileSystemHelper::FileSystemInfo> | 599 typedef std::vector<BrowsingDataFileSystemHelper::FileSystemInfo> |
| 599 FileSystemInfoList; | 600 FileSystemInfoList; |
| 600 typedef std::vector<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray; | 601 typedef std::vector<BrowsingDataQuotaHelper::QuotaInfo> QuotaInfoArray; |
| 601 | 602 |
| 602 void LoadCookies(); | |
| 603 void LoadCookiesWithFilter(const std::wstring& filter); | |
| 604 | |
| 605 void OnAppCacheModelInfoLoaded(); | 603 void OnAppCacheModelInfoLoaded(); |
| 604 void OnCookiesModelInfoLoaded(const CookieList& cookie_list); |
| 606 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); | 605 void OnDatabaseModelInfoLoaded(const DatabaseInfoList& database_info); |
| 607 void OnLocalStorageModelInfoLoaded( | 606 void OnLocalStorageModelInfoLoaded( |
| 608 const LocalStorageInfoList& local_storage_info); | 607 const LocalStorageInfoList& local_storage_info); |
| 609 void OnSessionStorageModelInfoLoaded( | 608 void OnSessionStorageModelInfoLoaded( |
| 610 const LocalStorageInfoList& local_storage_info); | 609 const LocalStorageInfoList& local_storage_info); |
| 611 void OnIndexedDBModelInfoLoaded( | 610 void OnIndexedDBModelInfoLoaded( |
| 612 const IndexedDBInfoList& indexed_db_info); | 611 const IndexedDBInfoList& indexed_db_info); |
| 613 void OnFileSystemModelInfoLoaded( | 612 void OnFileSystemModelInfoLoaded( |
| 614 const FileSystemInfoList& file_system_info); | 613 const FileSystemInfoList& file_system_info); |
| 615 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); | 614 void OnQuotaModelInfoLoaded(const QuotaInfoArray& quota_info); |
| 616 | 615 |
| 617 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); | 616 void PopulateAppCacheInfoWithFilter(const std::wstring& filter); |
| 617 void PopulateCookieInfoWithFilter(const std::wstring& filter); |
| 618 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); | 618 void PopulateDatabaseInfoWithFilter(const std::wstring& filter); |
| 619 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); | 619 void PopulateLocalStorageInfoWithFilter(const std::wstring& filter); |
| 620 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); | 620 void PopulateSessionStorageInfoWithFilter(const std::wstring& filter); |
| 621 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); | 621 void PopulateIndexedDBInfoWithFilter(const std::wstring& filter); |
| 622 void PopulateFileSystemInfoWithFilter(const std::wstring& filter); | 622 void PopulateFileSystemInfoWithFilter(const std::wstring& filter); |
| 623 void PopulateQuotaInfoWithFilter(const std::wstring& filter); | 623 void PopulateQuotaInfoWithFilter(const std::wstring& filter); |
| 624 | 624 |
| 625 void NotifyObserverBeginBatch(); | 625 void NotifyObserverBeginBatch(); |
| 626 void NotifyObserverEndBatch(); | 626 void NotifyObserverEndBatch(); |
| 627 | 627 |
| 628 scoped_refptr<net::CookieMonster> cookie_monster_; | |
| 629 CookieList all_cookies_; | |
| 630 | |
| 631 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; | 628 scoped_refptr<BrowsingDataAppCacheHelper> appcache_helper_; |
| 629 scoped_refptr<BrowsingDataCookieHelper> cookie_helper_; |
| 632 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; | 630 scoped_refptr<BrowsingDataDatabaseHelper> database_helper_; |
| 633 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; | |
| 634 DatabaseInfoList database_info_list_; | |
| 635 | |
| 636 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; | 631 scoped_refptr<BrowsingDataLocalStorageHelper> local_storage_helper_; |
| 637 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; | 632 scoped_refptr<BrowsingDataLocalStorageHelper> session_storage_helper_; |
| 638 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; | 633 scoped_refptr<BrowsingDataIndexedDBHelper> indexed_db_helper_; |
| 639 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; | 634 scoped_refptr<BrowsingDataFileSystemHelper> file_system_helper_; |
| 640 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; | 635 scoped_refptr<BrowsingDataQuotaHelper> quota_helper_; |
| 636 |
| 637 scoped_refptr<appcache::AppCacheInfoCollection> appcache_info_; |
| 638 CookieList cookie_list_; |
| 639 DatabaseInfoList database_info_list_; |
| 641 LocalStorageInfoList local_storage_info_list_; | 640 LocalStorageInfoList local_storage_info_list_; |
| 642 LocalStorageInfoList session_storage_info_list_; | 641 LocalStorageInfoList session_storage_info_list_; |
| 643 IndexedDBInfoList indexed_db_info_list_; | 642 IndexedDBInfoList indexed_db_info_list_; |
| 644 FileSystemInfoList file_system_info_list_; | 643 FileSystemInfoList file_system_info_list_; |
| 645 QuotaInfoArray quota_info_list_; | 644 QuotaInfoArray quota_info_list_; |
| 646 | 645 |
| 647 // The CookiesTreeModel maintains a separate list of observers that are | 646 // The CookiesTreeModel maintains a separate list of observers that are |
| 648 // specifically of the type CookiesTreeModel::Observer. | 647 // specifically of the type CookiesTreeModel::Observer. |
| 649 ObserverList<Observer> cookies_observer_list_; | 648 ObserverList<Observer> cookies_observer_list_; |
| 650 | 649 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 662 friend class CookieTreeDatabaseNode; | 661 friend class CookieTreeDatabaseNode; |
| 663 friend class CookieTreeLocalStorageNode; | 662 friend class CookieTreeLocalStorageNode; |
| 664 friend class CookieTreeIndexedDBNode; | 663 friend class CookieTreeIndexedDBNode; |
| 665 friend class CookieTreeFileSystemNode; | 664 friend class CookieTreeFileSystemNode; |
| 666 friend class CookieTreeQuotaNode; | 665 friend class CookieTreeQuotaNode; |
| 667 | 666 |
| 668 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); | 667 DISALLOW_COPY_AND_ASSIGN(CookiesTreeModel); |
| 669 }; | 668 }; |
| 670 | 669 |
| 671 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ | 670 #endif // CHROME_BROWSER_COOKIES_TREE_MODEL_H_ |
| OLD | NEW |