| 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_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_ |
| 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_ | 6 #define CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Methods inherited from content::DownloadManager::Observer. | 35 // Methods inherited from content::DownloadManager::Observer. |
| 36 virtual void ModelChanged(content::DownloadManager* manager) OVERRIDE; | 36 virtual void ModelChanged(content::DownloadManager* manager) OVERRIDE; |
| 37 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE; | 37 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE; |
| 38 | 38 |
| 39 // Methods inherited from content::DownloadItem::Observer. | 39 // Methods inherited from content::DownloadItem::Observer. |
| 40 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; | 40 virtual void OnDownloadUpdated(content::DownloadItem* download) OVERRIDE; |
| 41 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE; | 41 virtual void OnDownloadOpened(content::DownloadItem* download) OVERRIDE; |
| 42 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; | 42 virtual void OnDownloadDestroyed(content::DownloadItem* download) OVERRIDE; |
| 43 | 43 |
| 44 protected: | 44 protected: |
| 45 // Update the app icon. Virtual to be overridable for testing. | 45 // Platform-specific function to update the platform UI for download progress. |
| 46 virtual void UpdateAppIconDownloadProgress(); | 46 // |download| is the download item that changed. Implementations should not |
| 47 // hold the value of |download| as it is not guaranteed to remain valid. |
| 48 // Virtual to be overridable for testing. |
| 49 virtual void UpdateAppIconDownloadProgress(content::DownloadItem* download); |
| 47 | 50 |
| 48 private: | 51 private: |
| 49 // Update the internal state tracking an item. | 52 // Update the internal state tracking an item. Returns true if the item was |
| 50 void UpdateItem(content::DownloadItem* download); | 53 // added to the set of tracked items. |
| 54 bool UpdateItem(content::DownloadItem* download); |
| 51 | 55 |
| 52 std::set<content::DownloadManager*> managers_; | 56 std::set<content::DownloadManager*> managers_; |
| 53 std::set<content::DownloadItem*> items_; | 57 std::set<content::DownloadItem*> items_; |
| 54 | 58 |
| 55 DISALLOW_COPY_AND_ASSIGN(DownloadStatusUpdater); | 59 DISALLOW_COPY_AND_ASSIGN(DownloadStatusUpdater); |
| 56 }; | 60 }; |
| 57 | 61 |
| 58 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_ | 62 #endif // CHROME_BROWSER_DOWNLOAD_DOWNLOAD_STATUS_UPDATER_H_ |
| OLD | NEW |