| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 protected: | 61 protected: |
| 62 // Testing constructor. | 62 // Testing constructor. |
| 63 DownloadsListTracker(content::DownloadManager* download_manager, | 63 DownloadsListTracker(content::DownloadManager* download_manager, |
| 64 content::WebUI* web_ui, | 64 content::WebUI* web_ui, |
| 65 base::Callback<bool(const content::DownloadItem&)>); | 65 base::Callback<bool(const content::DownloadItem&)>); |
| 66 | 66 |
| 67 // Creates a dictionary value that's sent to the page as JSON. | 67 // Creates a dictionary value that's sent to the page as JSON. |
| 68 virtual scoped_ptr<base::DictionaryValue> CreateDownloadItemValue( | 68 virtual scoped_ptr<base::DictionaryValue> CreateDownloadItemValue( |
| 69 content::DownloadItem* item) const; | 69 content::DownloadItem* item) const; |
| 70 | 70 |
| 71 // Exposed for testing. |
| 72 bool IsIncognito(const content::DownloadItem& item) const; |
| 73 |
| 71 const content::DownloadItem* GetItemForTesting(size_t index) const; | 74 const content::DownloadItem* GetItemForTesting(size_t index) const; |
| 72 | 75 |
| 73 private: | 76 private: |
| 74 struct StartTimeComparator { | 77 struct StartTimeComparator { |
| 75 bool operator() (const content::DownloadItem* a, | 78 bool operator() (const content::DownloadItem* a, |
| 76 const content::DownloadItem* b) const; | 79 const content::DownloadItem* b) const; |
| 77 }; | 80 }; |
| 78 using SortedSet = std::set<content::DownloadItem*, StartTimeComparator>; | 81 using SortedSet = std::set<content::DownloadItem*, StartTimeComparator>; |
| 79 | 82 |
| 80 // Called by both constructors to initialize common state. | 83 // Called by both constructors to initialize common state. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 119 |
| 117 SortedSet sorted_visible_items_; | 120 SortedSet sorted_visible_items_; |
| 118 | 121 |
| 119 // Current search terms. | 122 // Current search terms. |
| 120 std::vector<base::string16> search_terms_; | 123 std::vector<base::string16> search_terms_; |
| 121 | 124 |
| 122 DISALLOW_COPY_AND_ASSIGN(DownloadsListTracker); | 125 DISALLOW_COPY_AND_ASSIGN(DownloadsListTracker); |
| 123 }; | 126 }; |
| 124 | 127 |
| 125 #endif // CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ | 128 #endif // CHROME_BROWSER_UI_WEBUI_MD_DOWNLOADS_DOWNLOADS_LIST_TRACKER_H_ |
| OLD | NEW |