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

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: Always switch on form factor when substituting {yandex:searchPath} 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
« no previous file with comments | « components/search_engines/prepopulated_engines.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/search_engines/template_url.cc
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc
index fc2c6f187fa4e0e25bf300cfc1132d9f2cb9c2fc..a30907a20652ced3575f32e417b5ff3a655a3a7e 100644
--- a/components/search_engines/template_url.cc
+++ b/components/search_engines/template_url.cc
@@ -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) {
« no previous file with comments | « components/search_engines/prepopulated_engines.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698