diff options
author | noelutz@google.com <noelutz@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-10 19:09:37 +0000 |
---|---|---|
committer | noelutz@google.com <noelutz@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-10 19:09:37 +0000 |
commit | ac4af82ff0e12f045f2b0b4625718ed4e56ed21e (patch) | |
tree | b28b9bc762a85bc85e99e56b65e956cd56e5952d /chrome | |
parent | 80394db7b2a5bb1dbe696fa8a07489ac42bb8bb7 (diff) | |
download | chromium_src-ac4af82ff0e12f045f2b0b4625718ed4e56ed21e.zip chromium_src-ac4af82ff0e12f045f2b0b4625718ed4e56ed21e.tar.gz chromium_src-ac4af82ff0e12f045f2b0b4625718ed4e56ed21e.tar.bz2 |
Store the download file hash in the DownloadItem. This will be useful
for the improved SafeBrowsing download protection later.
BUG=102540
TEST=No visible change. Run DownloadItemTest, DownloadManagerTest
Review URL: http://codereview.chromium.org/8511020
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109471 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
3 files changed, 5 insertions, 8 deletions
diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index deaa40c..b7b4af6 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -200,14 +200,12 @@ bool ChromeDownloadManagerDelegate::GenerateFileHash() { #endif } -void ChromeDownloadManagerDelegate::OnResponseCompleted( - DownloadItem* item, - const std::string& hash) { +void ChromeDownloadManagerDelegate::OnResponseCompleted(DownloadItem* item) { #if defined(ENABLE_SAFE_BROWSING) // When hash is not available, it means either it is not calculated // or there is error while it is calculated. We will skip the download hash // check in that case. - if (hash.empty()) + if (item->hash().empty()) return; scoped_refptr<DownloadSBClient> sb_client = @@ -217,7 +215,7 @@ void ChromeDownloadManagerDelegate::OnResponseCompleted( profile_->GetPrefs()->GetBoolean( prefs::kSafeBrowsingEnabled)); sb_client->CheckDownloadHash( - hash, + item->hash(), base::Bind(&ChromeDownloadManagerDelegate::CheckDownloadHashDone, base::Unretained(this))); #endif diff --git a/chrome/browser/download/chrome_download_manager_delegate.h b/chrome/browser/download/chrome_download_manager_delegate.h index ffc486d..c5c4007 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.h +++ b/chrome/browser/download/chrome_download_manager_delegate.h @@ -62,8 +62,7 @@ class ChromeDownloadManagerDelegate virtual bool ShouldCompleteDownload(DownloadItem* item) OVERRIDE; virtual bool ShouldOpenDownload(DownloadItem* item) OVERRIDE; virtual bool GenerateFileHash() OVERRIDE; - virtual void OnResponseCompleted(DownloadItem* item, - const std::string& hash) OVERRIDE; + virtual void OnResponseCompleted(DownloadItem* item) OVERRIDE; virtual void AddItemToPersistentStore(DownloadItem* item) OVERRIDE; virtual void UpdateItemInPersistentStore(DownloadItem* item) OVERRIDE; virtual void UpdatePathForItemInPersistentStore( diff --git a/chrome/browser/download/download_item_unittest.cc b/chrome/browser/download/download_item_unittest.cc index 45f634b..85edae9 100644 --- a/chrome/browser/download/download_item_unittest.cc +++ b/chrome/browser/download/download_item_unittest.cc @@ -147,7 +147,7 @@ TEST_F(DownloadItemTest, NotificationAfterComplete) { MockObserver observer(item); // Calling OnAllDataSaved does not trigger notification - item->OnAllDataSaved(kDownloadChunkSize); + item->OnAllDataSaved(kDownloadChunkSize, DownloadItem::kEmptyFileHash); ASSERT_FALSE(observer.CheckUpdated()); item->MarkAsComplete(); |