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

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

Issue 3071005: Download code cleanup patch of death: (Closed)
Patch Set: inline the dtor Created 10 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/automation_provider.cc
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index 2e5d0fb060efef6a2343664682b7547b8e37f82c..f635916ce15f2dfd2c224acc111656ec5f7e3e33 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -2099,8 +2099,6 @@ void AutomationProvider::AddHistoryItem(Browser* browser,
void AutomationProvider::GetDownloadsInfo(Browser* browser,
DictionaryValue* args,
IPC::Message* reply_message) {
- AutomationProviderDownloadManagerObserver observer;
- std::vector<DownloadItem*> downloads;
scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
AutomationJSONReply reply(this, reply_message);
@@ -2108,11 +2106,9 @@ void AutomationProvider::GetDownloadsInfo(Browser* browser,
reply.SendError("no download manager");
return;
}
- // Use DownloadManager's GetDownloads() method and not GetCurrentDownloads()
- // since that would be transient; a download might enter and empty out
- // the current download queue too soon to be noticed.
- profile_->GetDownloadManager()->GetDownloads(&observer, L"");
- downloads = observer.Downloads();
+
+ std::vector<DownloadItem*> downloads;
+ profile_->GetDownloadManager()->GetAllDownloads(FilePath(), &downloads);
std::map<DownloadItem::DownloadState, std::string> state_to_string;
state_to_string[DownloadItem::IN_PROGRESS] = std::string("IN_PROGRESS");
@@ -2160,8 +2156,6 @@ void AutomationProvider::WaitForDownloadsToComplete(
Browser* browser,
DictionaryValue* args,
IPC::Message* reply_message) {
- AutomationProviderDownloadManagerObserver observer;
- std::vector<DownloadItem*> downloads;
AutomationJSONReply reply(this, reply_message);
// Look for a quick return.
@@ -2169,9 +2163,9 @@ void AutomationProvider::WaitForDownloadsToComplete(
reply.SendSuccess(NULL); // No download manager.
return;
}
- profile_->GetDownloadManager()->GetCurrentDownloads(&observer, FilePath());
- downloads = observer.Downloads();
- if (downloads.size() == 0) {
+ std::vector<DownloadItem*> downloads;
+ profile_->GetDownloadManager()->GetCurrentDownloads(FilePath(), &downloads);
+ if (downloads.empty()) {
reply.SendSuccess(NULL);
return;
}
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698