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_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 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 void PopulateQuotaInfo(LocalDataContainer* container); | 712 void PopulateQuotaInfo(LocalDataContainer* container); |
713 void PopulateChannelIDInfo(LocalDataContainer* container); | 713 void PopulateChannelIDInfo(LocalDataContainer* container); |
714 void PopulateServiceWorkerUsageInfo(LocalDataContainer* container); | 714 void PopulateServiceWorkerUsageInfo(LocalDataContainer* container); |
715 void PopulateFlashLSOInfo(LocalDataContainer* container); | 715 void PopulateFlashLSOInfo(LocalDataContainer* container); |
716 | 716 |
717 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id); | 717 BrowsingDataCookieHelper* GetCookieHelper(const std::string& app_id); |
718 LocalDataContainer* data_container() { | 718 LocalDataContainer* data_container() { |
719 return data_container_.get(); | 719 return data_container_.get(); |
720 } | 720 } |
721 | 721 |
| 722 // Set the number of |batches_expected| this class should expect to receive. |
| 723 // If |reset| is true, then this is a new set of batches, but if false, then |
| 724 // this is a revised number (batches originally counted should no longer be |
| 725 // expected). |
| 726 void SetBatchExpectation(int batches_expected, bool reset); |
| 727 |
722 private: | 728 private: |
723 enum CookieIconIndex { | 729 enum CookieIconIndex { |
724 ORIGIN = 0, | 730 ORIGIN = 0, |
725 COOKIE = 1, | 731 COOKIE = 1, |
726 DATABASE = 2 | 732 DATABASE = 2 |
727 }; | 733 }; |
728 | 734 |
| 735 // Reset the counters for batches. |
| 736 void ResetBatches(); |
| 737 |
| 738 // Record that one batch has been delivered. |
| 739 void RecordBatchSeen(); |
| 740 |
| 741 // Record that one batch has begun processing. If this is the first batch then |
| 742 // observers will be notified that batch processing has started. |
729 void NotifyObserverBeginBatch(); | 743 void NotifyObserverBeginBatch(); |
| 744 |
| 745 // Record that one batch has finished processing. If this is the last batch |
| 746 // then observers will be notified that batch processing has ended. |
730 void NotifyObserverEndBatch(); | 747 void NotifyObserverEndBatch(); |
731 | 748 |
| 749 // Notifies observers if expected batch count has been delievered and all |
| 750 // batches have finished processing. |
| 751 void MaybeNotifyBatchesEnded(); |
| 752 |
732 void PopulateAppCacheInfoWithFilter(LocalDataContainer* container, | 753 void PopulateAppCacheInfoWithFilter(LocalDataContainer* container, |
733 ScopedBatchUpdateNotifier* notifier, | 754 ScopedBatchUpdateNotifier* notifier, |
734 const base::string16& filter); | 755 const base::string16& filter); |
735 void PopulateCookieInfoWithFilter(LocalDataContainer* container, | 756 void PopulateCookieInfoWithFilter(LocalDataContainer* container, |
736 ScopedBatchUpdateNotifier* notifier, | 757 ScopedBatchUpdateNotifier* notifier, |
737 const base::string16& filter); | 758 const base::string16& filter); |
738 void PopulateDatabaseInfoWithFilter(LocalDataContainer* container, | 759 void PopulateDatabaseInfoWithFilter(LocalDataContainer* container, |
739 ScopedBatchUpdateNotifier* notifier, | 760 ScopedBatchUpdateNotifier* notifier, |
740 const base::string16& filter); | 761 const base::string16& filter); |
741 void PopulateLocalStorageInfoWithFilter(LocalDataContainer* container, | 762 void PopulateLocalStorageInfoWithFilter(LocalDataContainer* container, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 #endif | 796 #endif |
776 | 797 |
777 // The CookiesTreeModel maintains a separate list of observers that are | 798 // The CookiesTreeModel maintains a separate list of observers that are |
778 // specifically of the type CookiesTreeModel::Observer. | 799 // specifically of the type CookiesTreeModel::Observer. |
779 ObserverList<Observer> cookies_observer_list_; | 800 ObserverList<Observer> cookies_observer_list_; |
780 | 801 |
781 // If true, use the CanonicalCookie::Source attribute to group cookies. | 802 // If true, use the CanonicalCookie::Source attribute to group cookies. |
782 // Otherwise, use the CanonicalCookie::Domain attribute. | 803 // Otherwise, use the CanonicalCookie::Domain attribute. |
783 bool group_by_cookie_source_; | 804 bool group_by_cookie_source_; |
784 | 805 |
785 // If this is non-zero, then this model is batching updates (there's a lot of | 806 // Keeps track of how many batches the consumer of this class says it is going |
786 // notifications coming down the pipe). This is an integer is used to balance | 807 // to send. |
787 // calls to Begin/EndBatch() if they're called in a nested manner. | 808 int batches_expected_; |
788 int batch_update_; | 809 |
| 810 // Keeps track of how many batches we've seen. |
| 811 int batches_seen_; |
| 812 |
| 813 // Counts how many batches have started already. If this is non-zero and lower |
| 814 // than batches_ended_, then this model is still batching updates. |
| 815 int batches_started_; |
| 816 |
| 817 // Counts how many batches have finished. |
| 818 int batches_ended_; |
789 }; | 819 }; |
790 | 820 |
791 #endif // CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_ | 821 #endif // CHROME_BROWSER_BROWSING_DATA_COOKIES_TREE_MODEL_H_ |
OLD | NEW |