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

Unified Diff: chrome/browser/dom_ui/downloads_dom_handler.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 | « chrome/browser/dom_ui/downloads_dom_handler.h ('k') | chrome/browser/dom_ui/filebrowse_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/downloads_dom_handler.cc
diff --git a/chrome/browser/dom_ui/downloads_dom_handler.cc b/chrome/browser/dom_ui/downloads_dom_handler.cc
index 581ab209612bef2def3aea36d9817935529ed01b..c1ba9d2b38087c221c6fc5d01c5e0e5c216fc043 100644
--- a/chrome/browser/dom_ui/downloads_dom_handler.cc
+++ b/chrome/browser/dom_ui/downloads_dom_handler.cc
@@ -9,11 +9,13 @@
#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/thread.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/browser/dom_ui/fileicon_source.h"
+#include "chrome/browser/download/download_history.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/metrics/user_metrics.h"
@@ -110,15 +112,16 @@ void DownloadsDOMHandler::OnDownloadUpdated(DownloadItem* download) {
}
// A download has started or been deleted. Query our DownloadManager for the
-// current set of downloads, which will call us back in SetDownloads once it
-// has retrieved them.
+// current set of downloads.
void DownloadsDOMHandler::ModelChanged() {
ClearDownloadItems();
- download_manager_->GetDownloads(this, search_text_);
+ download_manager_->download_history()->Search(
+ WideToUTF16(search_text_),
+ NewCallback(this, &DownloadsDOMHandler::OnSearchDownloadsComplete));
}
-void DownloadsDOMHandler::SetDownloads(
- std::vector<DownloadItem*>& downloads) {
+void DownloadsDOMHandler::OnSearchDownloadsComplete(
+ std::vector<DownloadItem*> downloads) {
ClearDownloadItems();
// Swap new downloads in.
@@ -149,7 +152,9 @@ void DownloadsDOMHandler::HandleGetDownloads(const Value* value) {
if (search_text_.compare(new_search) != 0) {
search_text_ = new_search;
ClearDownloadItems();
- download_manager_->GetDownloads(this, search_text_);
+ download_manager_->download_history()->Search(
+ WideToUTF16(search_text_),
+ NewCallback(this, &DownloadsDOMHandler::OnSearchDownloadsComplete));
} else {
SendCurrentDownloads();
}
« no previous file with comments | « chrome/browser/dom_ui/downloads_dom_handler.h ('k') | chrome/browser/dom_ui/filebrowse_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698