summaryrefslogtreecommitdiffstats
path: root/chrome/browser/automation/testing_automation_provider.cc
diff options
context:
space:
mode:
authorbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-10 21:18:04 +0000
committerbenjhayden@chromium.org <benjhayden@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-10 21:18:04 +0000
commit9f1f409f8d22573c5f3d1b4c486c582d89da9e77 (patch)
tree4739fae77e6b1920a1f64c7d511b6f2e001bb718 /chrome/browser/automation/testing_automation_provider.cc
parentfa7e889d9a7cb5b0b9bc7c0f89fb4e496663db4b (diff)
downloadchromium_src-9f1f409f8d22573c5f3d1b4c486c582d89da9e77.zip
chromium_src-9f1f409f8d22573c5f3d1b4c486c582d89da9e77.tar.gz
chromium_src-9f1f409f8d22573c5f3d1b4c486c582d89da9e77.tar.bz2
Reland Make DownloadManager::GetAllDownloads return all downloads regardless of state, persistence, temporariness, or save page.
Callers such as download_status_updater_mac now need to explicitly check whether filenames are empty. Also change some callers from SearchDownloads() over to GetAllDownloads(). This is an experiment in preparation for DownloadHistory-that-is-an-Observer, which removes the persisted concept from content. http://codereview.chromium.org/10665049/ I tried to inspect each caller in this CL to check that it would be ok with this change, but I might have missed something. Reviewers breakdown: Done: rdsmith: * jam: chrome/browser/automation michaeln: chrome/browser/browsing_data jcivelli: content/public/test Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=155351 BUG=147359 Review URL: https://chromiumcodereview.appspot.com/10913015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155829 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/testing_automation_provider.cc')
-rw-r--r--chrome/browser/automation/testing_automation_provider.cc27
1 files changed, 3 insertions, 24 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index b5ca262..a041a0d 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));