diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-16 23:39:42 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-16 23:39:42 +0000 |
commit | d3b129003402bb0f37d0f22803efa1960bee90a3 (patch) | |
tree | 3f6d62d040162549f699df4f67ac6368b4f6edf4 /chrome/browser/download/download_history.cc | |
parent | eb997422bde4133da7db0e1e3ff82d18890de218 (diff) | |
download | chromium_src-d3b129003402bb0f37d0f22803efa1960bee90a3.zip chromium_src-d3b129003402bb0f37d0f22803efa1960bee90a3.tar.gz chromium_src-d3b129003402bb0f37d0f22803efa1960bee90a3.tar.bz2 |
Regression fix: Downloads page in Incognito mode works fine now.
Additionally, it fixes another ancient bug that prevented downloads search
from working in Incognito mode.
The design of DownloadHistory is also nicer now, with no dependencies
on DownloadManager.
TEST=see bug
BUG=51955
Review URL: http://codereview.chromium.org/3112011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56266 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_history.cc')
-rw-r--r-- | chrome/browser/download/download_history.cc | 42 |
1 files changed, 2 insertions, 40 deletions
diff --git a/chrome/browser/download/download_history.cc b/chrome/browser/download/download_history.cc index 1f59338..d232a87 100644 --- a/chrome/browser/download/download_history.cc +++ b/chrome/browser/download/download_history.cc @@ -17,12 +17,10 @@ // static const int DownloadHistory::kUninitializedHandle = 0; -DownloadHistory::DownloadHistory(Profile* profile, DownloadItemMapper* mapper) +DownloadHistory::DownloadHistory(Profile* profile) : profile_(profile), - next_fake_db_handle_(kUninitializedHandle - 1), - download_item_mapper_(mapper) { + next_fake_db_handle_(kUninitializedHandle - 1) { DCHECK(profile); - DCHECK(mapper); } void DownloadHistory::Load(HistoryService::DownloadQueryCallback* callback) { @@ -38,21 +36,6 @@ void DownloadHistory::Load(HistoryService::DownloadQueryCallback* callback) { hs->CleanUpInProgressEntries(); } -void DownloadHistory::Search(const string16& query, - DownloadSearchCallback* callback) { - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); - if (!hs) { - delete callback; - return; - } - - HistoryService::Handle handle = hs->SearchDownloads( - query, - &history_consumer_, - NewCallback(this, &DownloadHistory::OnSearchDownloadsComplete)); - history_consumer_.SetClientData(hs, handle, callback); -} - void DownloadHistory::AddEntry( const DownloadCreateInfo& info, DownloadItem* download_item, @@ -126,27 +109,6 @@ void DownloadHistory::RemoveEntriesBetween(const base::Time remove_begin, hs->RemoveDownloadsBetween(remove_begin, remove_end); } -void DownloadHistory::OnSearchDownloadsComplete(HistoryService::Handle handle, - std::vector<int64>* results) { - HistoryService* hs = profile_->GetHistoryService(Profile::EXPLICIT_ACCESS); - DownloadSearchCallback* callback = - history_consumer_.GetClientData(hs, handle); - if (!callback) - return; - - std::vector<DownloadItem*> download_items; - for (std::vector<int64>::iterator i = results->begin(); - i != results->end(); ++i) { - DownloadItem* download_item = - download_item_mapper_->GetDownloadItemFromDbHandle(*i); - if (download_item) - download_items.push_back(download_item); - } - - callback->RunWithParams(MakeTuple(download_items)); - delete callback; -} - int64 DownloadHistory::GetNextFakeDbHandle() { return next_fake_db_handle_--; } |