Chromium Code Reviews| Index: chrome/browser/history/scored_history_match.cc |
| diff --git a/chrome/browser/history/scored_history_match.cc b/chrome/browser/history/scored_history_match.cc |
| index d8ee0b9aa0b76acbcab2cf6e99e2728bdf7d5a7a..ee400f845d9f11b9af9b57561fb5f2cb8da2939a 100644 |
| --- a/chrome/browser/history/scored_history_match.cc |
| +++ b/chrome/browser/history/scored_history_match.cc |
| @@ -97,19 +97,17 @@ ScoredHistoryMatch::ScoredHistoryMatch(const URLRow& row, |
| // We can inline autocomplete a result if: |
| // 1) there is only one search term |
| - // 2) AND EITHER: |
| - // 2a) the first match starts at the beginning of the candidate URL, OR |
| - // 2b) the candidate URL starts with one of the standard URL prefixes with |
| - // the URL match immediately following that prefix. |
| + // 2) AND a match begins immediately after a implicit / inlineable |
|
Peter Kasting
2012/09/11 21:57:48
Nit: a -> an, but maybe this would be clearer as "
Mark P
2012/09/11 22:05:00
I like your suggestion a lot. I took it entirely
|
| + // prefix such as http://www or https:// |
| // 3) AND the search string does not end in whitespace (making it look to |
| // the IMUI as though there is a single search term when actually there |
| // is a second, empty term). |
| - can_inline = !url_matches.empty() && |
| - terms.size() == 1 && |
| - (url_matches[0].offset == 0 || |
| - URLPrefix::IsURLPrefix(url.substr(0, url_matches[0].offset))) && |
| - !IsWhitespace(*(lower_string.rbegin())); |
| - match_in_scheme = can_inline && url_matches[0].offset == 0; |
| + // |best_prefix| stores the inlineable prefix computed in clause (2) or |
| + // NULL if no such prefix exists. (The URL is not inlineable.) |
| + const URLPrefix* best_prefix = (!url_matches.empty()) && (terms.size() == 1) ? |
|
Peter Kasting
2012/09/11 21:57:48
Nit: No need for parens around unary expression --
Mark P
2012/09/11 22:05:00
Rearranged parens.
|
| + URLPrefix::BestURLPrefix(UTF8ToUTF16(gurl.spec()), terms[0]) : NULL; |
| + can_inline = (best_prefix != NULL) && !IsWhitespace(*(lower_string.rbegin())); |
| + match_in_scheme = can_inline && best_prefix->prefix.empty(); |
| // Determine if the associated URLs is referenced by any bookmarks. |
| float bookmark_boost = |