summaryrefslogtreecommitdiffstats
path: root/chrome/browser/safe_browsing
diff options
context:
space:
mode:
authorlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 23:01:05 +0000
committerlzheng@chromium.org <lzheng@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-04 23:01:05 +0000
commit05a46357ae3242d583b87db562eb21e7de03aad9 (patch)
tree96e549ee6581f059beaaf7f4f627f92548633316 /chrome/browser/safe_browsing
parente9bdf5333ff6527d4f3c490ad0582e54ff4ca638 (diff)
downloadchromium_src-05a46357ae3242d583b87db562eb21e7de03aad9.zip
chromium_src-05a46357ae3242d583b87db562eb21e7de03aad9.tar.gz
chromium_src-05a46357ae3242d583b87db562eb21e7de03aad9.tar.bz2
Use string for hash in callbacks from safebrowsing. This makes the API more consistent since we pass in string in checkdownloadhash.
Also DCHECK empty hashes and handle it nicely when it happens. TEST=safebrowsing related tests stays green. BUG=none Review URL: http://codereview.chromium.org/6627017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76988 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/safe_browsing')
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.cc5
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service.h2
-rw-r--r--chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc2
3 files changed, 5 insertions, 4 deletions
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index 904e488..04ec974 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -138,7 +138,7 @@ void SafeBrowsingService::Client::OnSafeBrowsingResult(
OnBrowseUrlCheckResult(*(check.url), check.result);
OnDownloadUrlCheckResult(*(check.url), check.result);
} else if (check.full_hash.get()) {
- OnDownloadHashCheckResult(*(check.full_hash), check.result);
+ OnDownloadHashCheckResult(check.full_hash->full_hash, check.result);
} else {
NOTREACHED();
}
@@ -219,7 +219,8 @@ bool SafeBrowsingService::CheckDownloadUrl(const GURL& url,
bool SafeBrowsingService::CheckDownloadHash(const std::string& full_hash,
Client* client) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (!enabled_ || !enable_download_protection_)
+ DCHECK(!full_hash.empty());
+ if (!enabled_ || !enable_download_protection_ || full_hash.empty())
return true;
// We need to check the database for url prefix, and later may fetch the url
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h
index eea01ee..2e4a596 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -115,7 +115,7 @@ class SafeBrowsingService
UrlCheckResult result) {}
// Called when the result of checking a download binary hash is known.
- virtual void OnDownloadHashCheckResult(const SBFullHash& hash,
+ virtual void OnDownloadHashCheckResult(const std::string& hash,
UrlCheckResult result) {}
};
diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
index f39d386..44c4be8 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc
@@ -433,7 +433,7 @@ class TestSBClient
}
// Called when the result of checking a download hash is known.
- void OnDownloadHashCheckResult(const SBFullHash& hash,
+ void OnDownloadHashCheckResult(const std::string& hash,
SafeBrowsingService::UrlCheckResult result) {
result_ = result;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,