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

Unified Diff: components/search_provider_logos/google_logo_api.cc

Issue 1066923002: [LogoTracker] Correct fingerprint append in async parameter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change append_fingerprint_func_ to append_queryparams_func_. Created 5 years, 8 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: components/search_provider_logos/google_logo_api.cc
diff --git a/components/search_provider_logos/google_logo_api.cc b/components/search_provider_logos/google_logo_api.cc
index 90067c2345fac17abe09cb4c97f28dc10c7b794a..afed6dfe535cb08e9662d351a3f5fb5628932c58 100644
--- a/components/search_provider_logos/google_logo_api.cc
+++ b/components/search_provider_logos/google_logo_api.cc
@@ -16,24 +16,33 @@ namespace {
const char kResponsePreamble[] = ")]}'";
}
-GURL GoogleAppendFingerprintToLogoURL(const GURL& logo_url,
- const std::string& fingerprint) {
+GURL GoogleAppendQueryparamsToLogoURL(const GURL& logo_url,
+ const std::string& fingerprint,
+ bool wants_cta) {
// Note: we can't just use net::AppendQueryParameter() because it escapes
// ":" to "%3A", but the server requires the colon not to be escaped.
// See: http://crbug.com/413845
// TODO(newt): Switch to using net::AppendQueryParameter once it no longer
// escapes ":"
+ if (!fingerprint.empty() || wants_cta) {
+ std::string query(logo_url.query());
+ if (!query.empty())
+ query += "&";
+
+ query += "async=";
+ if (!fingerprint.empty()) {
+ query += "es_dfp:" + fingerprint + ",";
+ }
+ if (wants_cta) {
+ query += "cta:1";
+ }
+ GURL::Replacements replacements;
+ replacements.SetQueryStr(query);
+ return logo_url.ReplaceComponents(replacements);
+ }
- std::string query(logo_url.query());
- if (!query.empty())
- query += "&";
-
- query += "async=es_dfp:";
- query += fingerprint;
- GURL::Replacements replacements;
- replacements.SetQueryStr(query);
- return logo_url.ReplaceComponents(replacements);
+ return logo_url;
}
scoped_ptr<EncodedLogo> GoogleParseLogoResponse(

Powered by Google App Engine
This is Rietveld 408576698