Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6987)

Unified Diff: chrome/browser/safe_browsing/client_side_detection_service.cc

Issue 23625015: Consolidate TestURLFetcherFactory::SetFakeResponse (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/client_side_detection_service.cc
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.cc b/chrome/browser/safe_browsing/client_side_detection_service.cc
index 543779f253ca69f911e90b929bff7600ee99f16c..46d01450641e7a0e5a3843b5e48a465714007469 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.cc
+++ b/chrome/browser/safe_browsing/client_side_detection_service.cc
@@ -367,7 +367,7 @@ void ClientSideDetectionService::StartClientReportPhishingRequest(
net::URLFetcher* fetcher = net::URLFetcher::Create(
0 /* ID used for testing */,
- GURL(GetClientReportUrl(kClientReportPhishingUrl)),
+ GetClientReportUrl(kClientReportPhishingUrl),
net::URLFetcher::POST, this);
// Remember which callback and URL correspond to the current fetcher object.
@@ -417,7 +417,7 @@ void ClientSideDetectionService::StartClientReportMalwareRequest(
net::URLFetcher* fetcher = net::URLFetcher::Create(
0 /* ID used for testing */,
- GURL(GetClientReportUrl(kClientReportMalwareUrl)),
+ GetClientReportUrl(kClientReportMalwareUrl),
net::URLFetcher::POST, this);
// Remember which callback and URL correspond to the current fetcher object.
@@ -706,14 +706,13 @@ bool ClientSideDetectionService::ModelHasValidHashIds(
}
// static
-std::string ClientSideDetectionService::GetClientReportUrl(
+GURL ClientSideDetectionService::GetClientReportUrl(
const std::string& report_url) {
- std::string url = report_url;
+ GURL url(report_url);
std::string api_key = google_apis::GetAPIKey();
- if (!api_key.empty()) {
- base::StringAppendF(&url, "?key=%s",
- net::EscapeQueryParamValue(api_key, true).c_str());
- }
+ if (!api_key.empty())
+ url = url.Resolve("?key=" + net::EscapeQueryParamValue(api_key, true));
+
return url;
}
} // namespace safe_browsing

Powered by Google App Engine
This is Rietveld 408576698