| Index: chrome/browser/safe_browsing/download_protection_service.cc
|
| diff --git a/chrome/browser/safe_browsing/download_protection_service.cc b/chrome/browser/safe_browsing/download_protection_service.cc
|
| index afb797dde920be29e8f6d63643e4ee06224dfd4d..ce10f137fcff2cf52b7fa54408f52bc43352c596 100644
|
| --- a/chrome/browser/safe_browsing/download_protection_service.cc
|
| +++ b/chrome/browser/safe_browsing/download_protection_service.cc
|
| @@ -186,26 +186,27 @@ class DownloadProtectionService::CheckClientDownloadRequest
|
| << info_.download_url_chain.back() << ": success="
|
| << source->GetStatus().is_success() << " response_code="
|
| << source->GetResponseCode();
|
| - DownloadCheckResultReason reason = REASON_MAX;
|
| - reason = REASON_SERVER_PING_FAILED;
|
| + DownloadCheckResultReason reason = REASON_SERVER_PING_FAILED;
|
| + DownloadCheckResult result = SAFE;
|
| if (source->GetStatus().is_success() &&
|
| RC_REQUEST_OK == source->GetResponseCode()) {
|
| + ClientDownloadResponse response;
|
| std::string data;
|
| - source->GetResponseAsString(&data);
|
| - if (data.size() > 0) {
|
| - // For now no matter what we'll always say the download is safe.
|
| - // TODO(noelutz): Parse the response body to see exactly what's going
|
| - // on.
|
| + bool got_data = source->GetResponseAsString(&data);
|
| + DCHECK(got_data);
|
| + if (!response.ParseFromString(data)) {
|
| reason = REASON_INVALID_RESPONSE_PROTO;
|
| + } else if (response.verdict() == ClientDownloadResponse::DANGEROUS) {
|
| + reason = REASON_DOWNLOAD_DANGEROUS;
|
| + result = DANGEROUS;
|
| + } else {
|
| + reason = REASON_DOWNLOAD_SAFE;
|
| }
|
| }
|
| -
|
| - if (reason != REASON_MAX) {
|
| - RecordStats(reason);
|
| - }
|
| // We don't need the fetcher anymore.
|
| fetcher_.reset();
|
| - FinishRequest(SAFE);
|
| + RecordStats(reason);
|
| + FinishRequest(result);
|
| }
|
|
|
| private:
|
|
|