Index: chrome/browser/automation/testing_automation_provider.cc |
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc |
index b5ca26246f59a08f438f150221a1a52eee7e59e7..a041a0da0623757f81403e930ec8762daa19cf3d 100644 |
--- a/chrome/browser/automation/testing_automation_provider.cc |
+++ b/chrome/browser/automation/testing_automation_provider.cc |
@@ -2643,8 +2643,8 @@ void TestingAutomationProvider::GetDownloadsInfo(Browser* browser, |
if (download_service->HasCreatedDownloadManager()) { |
std::vector<DownloadItem*> downloads; |
- BrowserContext::GetDownloadManager(browser->profile())-> |
- GetAllDownloads(FilePath(), &downloads); |
+ BrowserContext::GetDownloadManager(browser->profile())->GetAllDownloads( |
+ &downloads); |
for (std::vector<DownloadItem*>::iterator it = downloads.begin(); |
it != downloads.end(); |
@@ -2684,27 +2684,6 @@ void TestingAutomationProvider::WaitForAllDownloadsToComplete( |
pre_download_ids); |
} |
-namespace { |
- |
-DownloadItem* GetDownloadItemFromId(int id, DownloadManager* download_manager) { |
- std::vector<DownloadItem*> downloads; |
- download_manager->GetAllDownloads(FilePath(), &downloads); |
- DownloadItem* selected_item = NULL; |
- |
- for (std::vector<DownloadItem*>::iterator it = downloads.begin(); |
- it != downloads.end(); |
- it++) { |
- DownloadItem* curr_item = *it; |
- if (curr_item->GetId() == id) { |
- selected_item = curr_item; |
- break; |
- } |
- } |
- return selected_item; |
-} |
- |
-} // namespace |
- |
// See PerformActionOnDownload() in chrome/test/pyautolib/pyauto.py for sample |
// json input and output. |
void TestingAutomationProvider::PerformActionOnDownload( |
@@ -2728,7 +2707,7 @@ void TestingAutomationProvider::PerformActionOnDownload( |
DownloadManager* download_manager = |
BrowserContext::GetDownloadManager(browser->profile()); |
- DownloadItem* selected_item = GetDownloadItemFromId(id, download_manager); |
+ DownloadItem* selected_item = download_manager->GetDownload(id); |
if (!selected_item) { |
AutomationJSONReply(this, reply_message) |
.SendError(StringPrintf("No download with an id of %d\n", id)); |