Index: chrome/browser/autocomplete/builtin_provider.cc |
diff --git a/chrome/browser/autocomplete/builtin_provider.cc b/chrome/browser/autocomplete/builtin_provider.cc |
index 5b35c75fa0317aa646997e622f0d0e11c2f752a2..faf8769c93d5dd0cb8059aea002c2e3222d091fc 100644 |
--- a/chrome/browser/autocomplete/builtin_provider.cc |
+++ b/chrome/browser/autocomplete/builtin_provider.cc |
@@ -105,6 +105,21 @@ void BuiltinProvider::Start(const AutocompleteInput& input, |
// extensions to chrome: URLs. |
if (url.SchemeIs(content::kChromeUIScheme) && url.has_host() && |
!url.has_query() && !url.has_ref()) { |
+ // Suggest about:blank for substrings, taking URL fixup into account. |
Mark P
2014/05/29 23:48:05
Note that this was of doing it will put about:blan
msw
2014/05/30 00:29:49
It might be considered alphabetical if you're comp
Mark P
2014/05/30 18:16:41
Okay.
|
+ const base::string16 blank_host = base::ASCIIToUTF16("blank"); |
+ const base::string16 host = base::UTF8ToUTF16(url.host()); |
+ if (StartsWith(text, base::ASCIIToUTF16(content::kAboutScheme), false) && |
+ StartsWith(blank_host, host, false) && url.path().length() <= 1 && |
Mark P
2014/05/29 23:48:05
nit: parens around binary operator <=
msw
2014/05/30 00:29:49
Done.
|
+ !EndsWith(text, base::ASCIIToUTF16("/"), false)) { |
Mark P
2014/05/29 23:48:05
please comment on the need for this final EndsWith
msw
2014/05/30 00:29:49
Done.
|
+ ACMatchClassifications styles; |
+ styles.push_back(ACMatchClassification(0, kMatch)); |
+ base::string16 match = base::ASCIIToUTF16(content::kAboutBlankURL); |
+ const size_t corrected_input_length = 6 + host.length(); |
Mark P
2014/05/29 23:48:05
comment on the "6"
(and if it's 6 because this is
msw
2014/05/30 00:29:49
Done (used kAboutSchemeLength + 1) and added a com
|
+ if (blank_host.length() > host.length()) |
+ styles.push_back(ACMatchClassification(corrected_input_length, kUrl)); |
+ AddMatch(match, match.substr(corrected_input_length), styles); |
+ } |
+ |
// Include the path for sub-pages (e.g. "chrome://settings/browser"). |
base::string16 host_and_path = base::UTF8ToUTF16(url.host() + url.path()); |
base::TrimString(host_and_path, base::ASCIIToUTF16("/").c_str(), |