Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(462)

Unified Diff: chrome/browser/automation/automation_provider_observers.cc

Issue 10913015: Reland DownloadManager::GetAllDownloads actually does now (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/automation/automation_provider_observers.cc
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 7c26b5bc2caeeefb650e9f9119fafbe2f6b5d144..c5d1a043f422864153c1c3ab8b8651bee25c0bb3 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -1431,21 +1431,13 @@ AllDownloadsCompleteObserver::AllDownloadsCompleteObserver(
AllDownloadsCompleteObserver::~AllDownloadsCompleteObserver() {}
-void AllDownloadsCompleteObserver::ModelChanged(DownloadManager* manager) {
- DCHECK_EQ(manager, download_manager_);
- // The set of downloads in the download manager has changed. If there are
- // any new downloads that are still in progress, add them to the pending list.
- std::vector<DownloadItem*> downloads;
- download_manager_->GetAllDownloads(FilePath(), &downloads);
- for (std::vector<DownloadItem*>::iterator it = downloads.begin();
- it != downloads.end(); ++it) {
- if ((*it)->GetState() == DownloadItem::IN_PROGRESS &&
- pre_download_ids_.find((*it)->GetId()) == pre_download_ids_.end()) {
- (*it)->AddObserver(this);
- pending_downloads_.insert(*it);
- }
+
+void AllDownloadsCompleteObserver::OnDownloadCreated(
+ DownloadManager* manager, DownloadItem* item) {
+ if (pre_download_ids_.find(item->GetId()) == pre_download_ids_.end()) {
+ item->AddObserver(this);
+ pending_downloads_.insert(item);
}
- ReplyIfNecessary();
}
void AllDownloadsCompleteObserver::OnDownloadUpdated(DownloadItem* download) {
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.h ('k') | chrome/browser/automation/testing_automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698