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

Unified Diff: chrome/browser/autocomplete/history_quick_provider.cc

Issue 19197005: Omnibox: Change |inline_autocomplete_offset| to |inline_autocompletion| (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: drop user_text() in omnibox_edit_model Created 7 years, 5 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
Index: chrome/browser/autocomplete/history_quick_provider.cc
diff --git a/chrome/browser/autocomplete/history_quick_provider.cc b/chrome/browser/autocomplete/history_quick_provider.cc
index 073aa18ec4ddca9f23dd425d7c68a4e0f1378283..fc74e13834ee470f3b6722ccf798fefe925282b8 100644
--- a/chrome/browser/autocomplete/history_quick_provider.cc
+++ b/chrome/browser/autocomplete/history_quick_provider.cc
@@ -272,17 +272,18 @@ AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch(
match.contents_class =
SpansFromTermMatch(new_matches, match.contents.length(), true);
- if (!history_match.can_inline) {
- match.inline_autocomplete_offset = string16::npos;
- } else {
+ if (history_match.can_inline) {
DCHECK(!new_matches.empty());
- match.inline_autocomplete_offset = new_matches[0].offset +
+ size_t inline_autocomplete_offset = new_matches[0].offset +
new_matches[0].length;
- // The following will happen if the user has typed an URL with a scheme
- // and the last character typed is a slash because that slash is removed
- // by the FormatURLWithOffsets call above.
- if (match.inline_autocomplete_offset > match.fill_into_edit.length())
- match.inline_autocomplete_offset = match.fill_into_edit.length();
+ // |inline_autocomplete_offset| may be beyond the end of the
+ // |fill_into_edit| if the user has typed an URL with a scheme and the
+ // last character typed is a slash. That slash is removed by the
+ // FormatURLWithOffsets call above.
+ if (inline_autocomplete_offset < match.fill_into_edit.length()) {
+ match.inline_autocompletion =
+ match.fill_into_edit.substr(inline_autocomplete_offset);
+ }
}
// Format the description autocomplete presentation.
« no previous file with comments | « chrome/browser/autocomplete/extension_app_provider.cc ('k') | chrome/browser/autocomplete/history_quick_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698