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

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: Fix tests and comment nits 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
« no previous file with comments | « components/search_provider_logos/google_logo_api.h ('k') | components/search_provider_logos/logo_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..0e7501fde21dc45e978fc6d9a647535fa5a3e1ee 100644
--- a/components/search_provider_logos/google_logo_api.cc
+++ b/components/search_provider_logos/google_logo_api.cc
@@ -16,24 +16,35 @@ 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 += ",";
+ }
+ 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(
« no previous file with comments | « components/search_provider_logos/google_logo_api.h ('k') | components/search_provider_logos/logo_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698