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

Unified Diff: components/search_engines/template_url.cc

Issue 1141743003: [Mobile] Upstream fix for yandex search engine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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_engines/template_url.cc
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc
index 8c565f285cfd548bb472decb5b8c79d4a82efa05..4effcc0db8d3356c56ede62d8214afed3c9be5b7 100644
--- a/components/search_engines/template_url.cc
+++ b/components/search_engines/template_url.cc
@@ -103,6 +103,11 @@ const char kGoogleUnescapedSearchTermsParameter[] =
const char kGoogleUnescapedSearchTermsParameterFull[] =
"{google:unescapedSearchTerms}";
+// Yandex reported that mobile should use a different path for the search
+// to avoid one additional redirect, this is used to encode the path in
+// the URL template.
+const char kYandexSearchPathParameter[] = "yandex:searchPath";
Peter Kasting 2015/05/13 22:56:55 I'm not a fan of the ton of constants we have up h
sdefresne 2015/05/18 12:35:45 Done. Followup CL https://codereview.chromium.org/
+
// Display value for kSearchTermsParameter.
const char kDisplaySearchTerms[] = "%s";
@@ -686,6 +691,12 @@ bool TemplateURLRef::ParseParameter(size_t start,
replacements->push_back(Replacement(GOOGLE_SUGGEST_REQUEST_ID, start));
} else if (parameter == kGoogleUnescapedSearchTermsParameter) {
replacements->push_back(Replacement(GOOGLE_UNESCAPED_SEARCH_TERMS, start));
+ } else if (parameter == kYandexSearchPathParameter) {
+#if defined(OS_ANDROID) || defined(OS_IOS)
Peter Kasting 2015/05/13 22:56:55 Is OS_ANDROID correct here for tablets running And
sdefresne 2015/05/18 12:35:45 I've tested and tablet are redirected to "padsearc
+ url->insert(start, "touchsearch");
+#else
+ url->insert(start, "yandsearch");
+#endif
} else if (parameter == kInputEncodingParameter) {
replacements->push_back(Replacement(ENCODING, start));
} else if (parameter == kLanguageParameter) {

Powered by Google App Engine
This is Rietveld 408576698