Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/safe_browsing/download_protection_service.h" | 5 #include "chrome/browser/safe_browsing/download_protection_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 661 << item_->GetUrlChain().back(); | 661 << item_->GetUrlChain().back(); |
| 662 fetcher_.reset(net::URLFetcher::Create(0 /* ID used for testing */, | 662 fetcher_.reset(net::URLFetcher::Create(0 /* ID used for testing */, |
| 663 GURL(GetDownloadRequestUrl()), | 663 GURL(GetDownloadRequestUrl()), |
| 664 net::URLFetcher::POST, | 664 net::URLFetcher::POST, |
| 665 this)); | 665 this)); |
| 666 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 666 fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
| 667 fetcher_->SetAutomaticallyRetryOn5xx(false); // Don't retry on error. | 667 fetcher_->SetAutomaticallyRetryOn5xx(false); // Don't retry on error. |
| 668 fetcher_->SetRequestContext(service_->request_context_getter_.get()); | 668 fetcher_->SetRequestContext(service_->request_context_getter_.get()); |
| 669 fetcher_->SetUploadData("application/octet-stream", | 669 fetcher_->SetUploadData("application/octet-stream", |
| 670 client_download_request_data_); | 670 client_download_request_data_); |
| 671 UMA_HISTOGRAM_COUNTS("SBClientDownload.DownloadRequestPayloadSize", | |
| 672 client_download_request_data_.size()); | |
|
Ilya Sherman
2013/07/30 01:27:39
Are you sure that a histogram mapping [1, 1,000,00
mattm
2013/07/30 01:53:23
This is actually the size of the ping we send to t
| |
| 671 fetcher_->Start(); | 673 fetcher_->Start(); |
| 672 } | 674 } |
| 673 | 675 |
| 674 void PostFinishTask(DownloadCheckResult result, | 676 void PostFinishTask(DownloadCheckResult result, |
| 675 DownloadCheckResultReason reason) { | 677 DownloadCheckResultReason reason) { |
| 676 BrowserThread::PostTask( | 678 BrowserThread::PostTask( |
| 677 BrowserThread::UI, | 679 BrowserThread::UI, |
| 678 FROM_HERE, | 680 FROM_HERE, |
| 679 base::Bind(&CheckClientDownloadRequest::FinishRequest, this, result, | 681 base::Bind(&CheckClientDownloadRequest::FinishRequest, this, result, |
| 680 reason)); | 682 reason)); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 969 std::string url = kDownloadRequestUrl; | 971 std::string url = kDownloadRequestUrl; |
| 970 std::string api_key = google_apis::GetAPIKey(); | 972 std::string api_key = google_apis::GetAPIKey(); |
| 971 if (!api_key.empty()) { | 973 if (!api_key.empty()) { |
| 972 base::StringAppendF(&url, "?key=%s", | 974 base::StringAppendF(&url, "?key=%s", |
| 973 net::EscapeQueryParamValue(api_key, true).c_str()); | 975 net::EscapeQueryParamValue(api_key, true).c_str()); |
| 974 } | 976 } |
| 975 return url; | 977 return url; |
| 976 } | 978 } |
| 977 | 979 |
| 978 } // namespace safe_browsing | 980 } // namespace safe_browsing |
| OLD | NEW |