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

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: comments 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 0a9337cf5327e003c6f093bcc60e3bbc4a2bdc72..29b8f22cd2cc60864dca855845c36ffe8e74f6e2 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/download/interrupt_reasons.h"
#include "content/browser/renderer_host/render_process_host.h"
@@ -173,6 +174,18 @@ void DownloadManager::GetAllDownloads(
}
}
+void DownloadManager::Search(const download_util::DownloadQuery& query,
+ DownloadVector* results) const {
+ CHECK(results);
+ results->clear();
+ DownloadVector all_items;
+ for (DownloadSet::const_iterator it = downloads_.begin();
+ it != downloads_.end(); ++it) {
+ all_items.push_back(*it);
+ }
+ query.Search(all_items, results);
Randy Smith (Not in Mondays) 2011/10/13 23:23:11 Potentially tacky, but may be worth considering: C
benjhayden 2011/10/14 19:31:02 Done.
+}
+
void DownloadManager::SearchDownloads(const string16& query,
DownloadVector* result) {
string16 query_lower(base::i18n::ToLower(query));
@@ -825,7 +838,7 @@ void DownloadManager::OnPersistentStoreQueryComplete(
largest_db_handle_in_history_ = 0;
for (size_t i = 0; i < entries->size(); ++i) {
- DownloadItem* download = new DownloadItem(this, entries->at(i));
+ DownloadItem* download = new DownloadItem(this, entries->at(i), -1 - i);
// TODO(rdsmith): Remove after http://crbug.com/85408 resolved.
CHECK(!ContainsKey(history_downloads_, download->db_handle()));
downloads_.insert(download);

Powered by Google App Engine
This is Rietveld 408576698