summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/download_history.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/download/download_history.cc')
-rw-r--r--chrome/browser/download/download_history.cc27
1 files changed, 16 insertions, 11 deletions
diff --git a/chrome/browser/download/download_history.cc b/chrome/browser/download/download_history.cc
index 0398a3c..426a434 100644
--- a/chrome/browser/download/download_history.cc
+++ b/chrome/browser/download/download_history.cc
@@ -28,20 +28,23 @@ DownloadHistory::~DownloadHistory() {
}
void DownloadHistory::GetNextId(
- const HistoryService::DownloadNextIdCallback& callback) {
+ HistoryService::DownloadNextIdCallback* callback) {
+ DCHECK(callback);
HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
- if (!hs)
+ if (!hs) {
+ delete callback;
return;
-
+ }
hs->GetNextDownloadId(&history_consumer_, callback);
}
-void DownloadHistory::Load(
- const HistoryService::DownloadQueryCallback& callback) {
+void DownloadHistory::Load(HistoryService::DownloadQueryCallback* callback) {
+ DCHECK(callback);
HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS);
- if (!hs)
+ if (!hs) {
+ delete callback;
return;
-
+ }
hs->QueryDownloads(&history_consumer_, callback);
// This is the initial load, so do a cleanup of corrupt in-progress entries.
@@ -59,8 +62,7 @@ void DownloadHistory::CheckVisitedReferrerBefore(
if (hs) {
HistoryService::Handle handle =
hs->GetVisibleVisitCountToHost(referrer_url, &history_consumer_,
- base::Bind(&DownloadHistory::OnGotVisitCountToHost,
- base::Unretained(this)));
+ NewCallback(this, &DownloadHistory::OnGotVisitCountToHost));
visited_before_requests_[handle] = std::make_pair(download_id, callback);
return;
}
@@ -71,7 +73,7 @@ void DownloadHistory::CheckVisitedReferrerBefore(
void DownloadHistory::AddEntry(
DownloadItem* download_item,
- const HistoryService::DownloadCreateCallback& callback) {
+ HistoryService::DownloadCreateCallback* callback) {
DCHECK(download_item);
// Do not store the download in the history database for a few special cases:
// - incognito mode (that is the point of this mode)
@@ -86,7 +88,10 @@ void DownloadHistory::AddEntry(
if (download_item->is_otr() ||
ChromeDownloadManagerDelegate::IsExtensionDownload(download_item) ||
download_item->is_temporary() || !hs) {
- callback.Run(download_item->id(), GetNextFakeDbHandle());
+ callback->RunWithParams(
+ history::DownloadCreateRequest::TupleType(download_item->id(),
+ GetNextFakeDbHandle()));
+ delete callback;
return;
}