summaryrefslogtreecommitdiffstats
path: root/chrome/browser/search_engines
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 22:16:33 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-09-01 22:16:33 +0000
commitd676ada02e99177139faf901276fc88cf095c0a9 (patch)
tree42221a45a8de88eed9707b86617104217e40494b /chrome/browser/search_engines
parent3ff02c65de89409db4b2036b00f89d3f535711ad (diff)
downloadchromium_src-d676ada02e99177139faf901276fc88cf095c0a9.zip
chromium_src-d676ada02e99177139faf901276fc88cf095c0a9.tar.gz
chromium_src-d676ada02e99177139faf901276fc88cf095c0a9.tar.bz2
Don't treat input with a scheme that's not "http" or "https" as a potential keyword search.
BUG=27038 TEST=Type in "site:yahoo.com foo". You should not go into keyword search mode. Review URL: http://codereview.chromium.org/3259010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@58248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/search_engines')
-rw-r--r--chrome/browser/search_engines/template_url_model.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/browser/search_engines/template_url_model.cc b/chrome/browser/search_engines/template_url_model.cc
index 5a119e2..8b2c362 100644
--- a/chrome/browser/search_engines/template_url_model.cc
+++ b/chrome/browser/search_engines/template_url_model.cc
@@ -131,6 +131,15 @@ std::wstring TemplateURLModel::CleanUserInputKeyword(
if (url_parse::ExtractScheme(WideToUTF8(keyword).c_str(),
static_cast<int>(keyword.length()),
&scheme_component)) {
+ // If the scheme isn't "http" or "https", bail. The user isn't trying to
+ // type a web address, but rather an FTP, file:, or other scheme URL, or a
+ // search query with some sort of initial operator (e.g. "site:").
+ if (result.compare(0, scheme_component.end(),
+ ASCIIToWide(chrome::kHttpScheme)) &&
+ result.compare(0, scheme_component.end(),
+ ASCIIToWide(chrome::kHttpsScheme)))
+ return std::wstring();
+
// Include trailing ':'.
result.erase(0, scheme_component.end() + 1);
// Many schemes usually have "//" after them, so strip it too.