Index: chrome/browser/download/download_status_updater.cc |
diff --git a/chrome/browser/download/download_status_updater.cc b/chrome/browser/download/download_status_updater.cc |
index a8dde9bc561020cd4e156d21df5ccf8791f5e5dd..afde1eeb5c1aa77bb748ca777106a2d5b5b91850 100644 |
--- a/chrome/browser/download/download_status_updater.cc |
+++ b/chrome/browser/download/download_status_updater.cc |
@@ -55,12 +55,19 @@ void DownloadStatusUpdater::ModelChanged(content::DownloadManager* manager) { |
std::vector<content::DownloadItem*> downloads; |
manager->SearchDownloads(string16(), &downloads); |
+ std::vector<content::DownloadItem*> added_downloads; |
for (std::vector<content::DownloadItem*>::iterator it = downloads.begin(); |
it != downloads.end(); ++it) { |
- UpdateItem(*it); |
+ if (UpdateItem(*it)) |
+ added_downloads.push_back(*it); |
} |
- UpdateAppIconDownloadProgress(); |
+ for (std::vector<content::DownloadItem*>::iterator it = |
+ added_downloads.begin(); |
+ it != added_downloads.end(); |
+ ++it) { |
+ UpdateAppIconDownloadProgress(*it); |
+ } |
} |
void DownloadStatusUpdater::ManagerGoingDown( |
@@ -74,7 +81,7 @@ void DownloadStatusUpdater::ManagerGoingDown( |
void DownloadStatusUpdater::OnDownloadUpdated( |
content::DownloadItem* download) { |
UpdateItem(download); |
- UpdateAppIconDownloadProgress(); |
+ UpdateAppIconDownloadProgress(download); |
} |
void DownloadStatusUpdater::OnDownloadDestroyed( |
@@ -83,30 +90,30 @@ void DownloadStatusUpdater::OnDownloadDestroyed( |
items_.erase(download); |
download->RemoveObserver(this); |
} |
- UpdateAppIconDownloadProgress(); |
+ UpdateAppIconDownloadProgress(download); |
} |
void DownloadStatusUpdater::OnDownloadOpened(content::DownloadItem* download) { |
} |
-void DownloadStatusUpdater::UpdateAppIconDownloadProgress() { |
- float progress = 0; |
- int download_count = 0; |
- bool progress_known = GetProgress(&progress, &download_count); |
- download_util::UpdateAppIconDownloadProgress(download_count, |
- progress_known, |
- progress); |
+#if defined(USE_AURA) || defined(ANDROID) |
Randy Smith (Not in Mondays)
2012/08/10 18:38:44
Avi: Happy to go with your opinion on this, but wa
Avi (use Gerrit)
2012/08/10 19:25:43
There are two other options that I can think of:
Randy Smith (Not in Mondays)
2012/08/10 19:35:14
SG; just wanted to ask the question.
|
+void DownloadStatusUpdater::UpdateAppIconDownloadProgress( |
+ content::DownloadItem* download) { |
+ // TODO(davemoore): Implement once UX for aura download is decided <104742> |
+ // TODO(avi): Implement for Android? |
} |
+#endif |
// React to a transition that a download associated with one of our |
// download managers has made. Our goal is to have only IN_PROGRESS |
// items on our set list, as they're the only ones that have relevance |
// to GetProgress() return values. |
-void DownloadStatusUpdater::UpdateItem(content::DownloadItem* download) { |
+bool DownloadStatusUpdater::UpdateItem(content::DownloadItem* download) { |
if (download->GetState() == content::DownloadItem::IN_PROGRESS) { |
if (!ContainsKey(items_, download)) { |
items_.insert(download); |
download->AddObserver(this); |
+ return true; |
} |
} else { |
if (ContainsKey(items_, download)) { |
@@ -114,4 +121,6 @@ void DownloadStatusUpdater::UpdateItem(content::DownloadItem* download) { |
download->RemoveObserver(this); |
} |
} |
+ |
+ return false; |
} |