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

Unified Diff: chrome/browser/history/scored_history_match.cc

Issue 10907176: Omnibox: Fix HistoryQuick provider can_inline bug (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revise comment. Created 8 years, 3 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 | « no previous file | chrome/browser/history/scored_history_match_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fe6a72b8f30b94b9a9a9fcc51abb2a652f2520d6 100644
--- a/chrome/browser/history/scored_history_match.cc
+++ b/chrome/browser/history/scored_history_match.cc
@@ -97,19 +97,20 @@ 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 droppabled (inlineable)
Peter Kasting 2012/09/11 17:52:50 Nit: droppabled?
Mark P 2012/09/11 21:52:17 Not sure if you wanted me to fix the word (drop ty
+ // 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).
+ // |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 = NULL;
mrossetti 2012/09/11 17:36:10 I'm okay with doing the assignment within the cond
Peter Kasting 2012/09/11 17:52:50 I dislike assignments inside conditionals, so I'm
Mark P 2012/09/11 21:52:17 Took your suggestion (with a bit more explicit log
Mark P 2012/09/11 21:52:17 I don't like them either, but I've seen enough Chr
can_inline = !url_matches.empty() &&
terms.size() == 1 &&
- (url_matches[0].offset == 0 ||
- URLPrefix::IsURLPrefix(url.substr(0, url_matches[0].offset))) &&
+ ((best_prefix = URLPrefix::
+ BestURLPrefix(UTF8ToUTF16(gurl.spec()), terms[0])) != NULL) &&
!IsWhitespace(*(lower_string.rbegin()));
- match_in_scheme = can_inline && url_matches[0].offset == 0;
+ match_in_scheme = can_inline && (best_prefix->prefix.length() == 0);
// Determine if the associated URLs is referenced by any bookmarks.
float bookmark_boost =
« no previous file with comments | « no previous file | chrome/browser/history/scored_history_match_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698