Commit 0ea1107b authored by sdefresne's avatar sdefresne Committed by Commit bot

[Mobile] Upstream fix for yandex search engine

Use a different path for template URL for yandex search on mobile to avoid an
extra redirection. Mobile should use http://yandex.ru/touchsearch?text=${query}
or http://yandex.ru/padsearch?text=${query} depending on the device form factor
instead of http://yandex.ru/yandsearch?text=${query}.

The issue was reported by yandex and fixed in downstream iOS fork. Upstream
it now that the code is componentized.

TEST=Set your locale to Russian, launch Chrome for iOS, select Yandex as the
search engine, type a query in the omnibox to do a search, check that you're
sent to /touchsearch directly, not via /yandsearch first.

BUG=b/7024148

Review URL: https://codereview.chromium.org/1141743003

Cr-Commit-Position: refs/heads/master@{#330500}
parent 0af976c4
......@@ -30,7 +30,7 @@
// Increment this if you change the data in ways that mean users with
// existing data should get a new version.
"kCurrentDataVersion": 82
"kCurrentDataVersion": 83
},
// The following engines are included in country lists and are added to the
......@@ -585,7 +585,7 @@
"name": "\u042f\u043d\u0434\u0435\u043a\u0441",
"keyword": "yandex.ru",
"favicon_url": "http://yandex.st/lego/_/pDu9OWAQKB0s2J9IojKpiS_Eho.ico",
"search_url": "http://yandex.ru/yandsearch?text={searchTerms}",
"search_url": "http://yandex.ru/{yandex:searchPath}?text={searchTerms}",
"suggest_url": "http://suggest.yandex.net/suggest-ff.cgi?part={searchTerms}",
"image_url": "http://yandex.ru/images/search/?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
......@@ -597,7 +597,7 @@
"name": "Yandex",
"keyword": "yandex.com.tr",
"favicon_url": "http://yastatic.net/islands-icons/_/6jyHGXR8-HAc8oJ1bU8qMUQQz_g.ico",
"search_url": "http://www.yandex.com.tr/yandsearch?text={searchTerms}",
"search_url": "http://www.yandex.com.tr/{yandex:searchPath}?text={searchTerms}",
"suggest_url": "http://suggest.yandex.com.tr/suggest-ff.cgi?part={searchTerms}",
"image_url": "http://yandex.com.tr/gorsel/search?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
......@@ -609,7 +609,7 @@
"name": "\u042f\u043d\u0434\u0435\u043a\u0441",
"keyword": "yandex.ua",
"favicon_url": "http://yastatic.net/islands-icons/_/aKnllxm-gQhidpzbZqub7qe641g.ico",
"search_url": "http://yandex.ua/yandsearch?text={searchTerms}",
"search_url": "http://yandex.ua/{yandex:searchPath}?text={searchTerms}",
"suggest_url": "http://suggest.yandex.ua/suggest-ff.cgi?part={searchTerms}",
"image_url": "http://yandex.ua/images/search/?rpt=imageview",
"image_url_post_params": "upfile={google:imageThumbnail},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight},prg=1",
......
......@@ -28,6 +28,7 @@
#include "net/base/escape.h"
#include "net/base/mime_util.h"
#include "net/base/net_util.h"
#include "ui/base/device_form_factor.h"
#include "url/gurl.h"
namespace {
......@@ -686,6 +687,18 @@ 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 == "yandex:searchPath") {
switch (ui::GetDeviceFormFactor()) {
case ui::DEVICE_FORM_FACTOR_DESKTOP:
url->insert(start, "yandsearch");
break;
case ui::DEVICE_FORM_FACTOR_PHONE:
url->insert(start, "touchsearch");
break;
case ui::DEVICE_FORM_FACTOR_TABLET:
url->insert(start, "padsearch");
break;
}
} else if (parameter == kInputEncodingParameter) {
replacements->push_back(Replacement(ENCODING, start));
} else if (parameter == kLanguageParameter) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment