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

Unified Diff: content/browser/download/download_manager.cc

Issue 7825035: Implement chrome.experimental.downloads.search() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: " Created 9 years, 2 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: content/browser/download/download_manager.cc
diff --git a/content/browser/download/download_manager.cc b/content/browser/download/download_manager.cc
index e3235aea22fd6ecfb8f37603ce14f577d2ef4352..e5878cfbca574d32cdd54b28b1d9e5040d3fa1db 100644
--- a/content/browser/download/download_manager.cc
+++ b/content/browser/download/download_manager.cc
@@ -25,6 +25,7 @@
#include "content/browser/download/download_item.h"
#include "content/browser/download/download_manager_delegate.h"
#include "content/browser/download/download_persistent_store_info.h"
+#include "content/browser/download/download_query.h"
#include "content/browser/download/download_status_updater.h"
#include "content/browser/renderer_host/render_process_host.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -172,6 +173,21 @@ void DownloadManager::GetAllDownloads(
}
}
+bool DownloadManager::Search(const download_util::DownloadQuery& query,
+ std::string* error_msg,
+ DownloadVector* results,
+ base::ListValue* json_results) const {
+ DownloadVector default_results;
+ if (results== NULL)
+ results = &default_results;
+ results->clear();
cbentzel 2011/10/10 14:35:30 How big is this? Is downloads_ unbounded?
benjhayden 2011/10/13 14:07:34 AFAIK yes.
+ for (DownloadSet::const_iterator it = downloads_.begin();
+ it != downloads_.end(); ++it) {
+ results->push_back(*it);
+ }
+ return query.Search(results, error_msg, json_results);
+}
+
void DownloadManager::SearchDownloads(const string16& query,
DownloadVector* result) {
string16 query_lower(base::i18n::ToLower(query));

Powered by Google App Engine
This is Rietveld 408576698