Chromium Code Reviews| Index: components/omnibox/browser/autocomplete_input.cc |
| diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc |
| index 7207fc8b5e68ba44e4e354bbc79b4f3317e4d5d1..73e8844c351e8d2faf08c0335cf367561f913183 100644 |
| --- a/components/omnibox/browser/autocomplete_input.cc |
| +++ b/components/omnibox/browser/autocomplete_input.cc |
| @@ -155,6 +155,12 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse( |
| if (first_non_white == base::string16::npos) |
| return metrics::OmniboxInputType::INVALID; // All whitespace. |
| + // Treat input that begins with a colon as a query. Otherwise the URL |
| + // formatter will attempt to fix it by prepending a scheme, which the user |
| + // probably did not want if they explicitly typed a colon at the beginning. |
| + if (text[first_non_white] == ':') |
| + return metrics::OmniboxInputType::QUERY; |
|
Peter Kasting
2016/10/05 00:56:30
I'm fine with doing what you did to the URLFixerUp
brettw
2016/10/05 05:10:12
It does return UNKNOWN at the bottom, and I was tr
|
| + |
| // Ask our parsing back-end to help us understand what the user typed. We |
| // use the URLFixerUpper here because we want to be smart about what we |
| // consider a scheme. For example, we shouldn't consider www.google.com:80 |
| @@ -254,13 +260,6 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse( |
| // between an HTTP URL and a query, or the scheme is HTTP or HTTPS, in which |
| // case we should reject invalid formulations. |
| - // If we have an empty host it can't be a valid HTTP[S] URL. (This should |
| - // only trigger for input that begins with a colon, which GURL will parse as a |
| - // valid, non-standard URL; for standard URLs, an empty host would have |
| - // resulted in an invalid |canonicalized_url| above.) |
| - if (!canonicalized_url->has_host()) |
| - return metrics::OmniboxInputType::QUERY; |
| - |
| // Determine the host family. We get this information by (re-)canonicalizing |
| // the already-canonicalized host rather than using the user's original input, |
| // in case fixup affected the result here (e.g. an input that looks like an |