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

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

Issue 19197005: Omnibox: Change |inline_autocomplete_offset| to |inline_autocompletion| (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix issue with using a reference in a place we shouldn't 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/search_provider.cc
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 2f304504aedc799592c70a674e19c82aaa784837..2c3a68d6ad91adb222a1772a2ef618ac6a8a570b 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -326,8 +326,7 @@ AutocompleteMatch SearchProvider::CreateSearchSuggestion(
match.fill_into_edit.append(match.keyword + char16(' '));
if (!input.prevent_inline_autocomplete() &&
StartsWith(query_string, input_text, false)) {
- match.inline_autocomplete_offset =
- match.fill_into_edit.length() + input_text.length();
+ match.inline_autocompletion = query_string.substr(input_text.length());
}
match.fill_into_edit.append(query_string);
@@ -1079,7 +1078,7 @@ bool SearchProvider::IsTopMatchNotInlinable() const {
return
matches_.front().type != AutocompleteMatchType::SEARCH_WHAT_YOU_TYPED &&
matches_.front().type != AutocompleteMatchType::SEARCH_OTHER_ENGINE &&
- matches_.front().inline_autocomplete_offset == string16::npos &&
+ matches_.front().inline_autocompletion.empty() &&
matches_.front().fill_into_edit != input_.text();
}
@@ -1449,10 +1448,12 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
net::FormatUrl(navigation.url(), languages, format_types,
net::UnescapeRule::SPACES, NULL, NULL,
&inline_autocomplete_offset));
- if (!input_.prevent_inline_autocomplete())
- match.inline_autocomplete_offset = inline_autocomplete_offset;
- DCHECK((match.inline_autocomplete_offset == string16::npos) ||
- (match.inline_autocomplete_offset <= match.fill_into_edit.length()));
+ if (!input_.prevent_inline_autocomplete() &&
+ (inline_autocomplete_offset != string16::npos)) {
+ DCHECK(inline_autocomplete_offset <= match.fill_into_edit.length());
+ match.inline_autocompletion =
+ match.fill_into_edit.substr(inline_autocomplete_offset);
+ }
match.contents = net::FormatUrl(navigation.url(), languages,
format_types, net::UnescapeRule::SPACES, NULL, NULL, &match_start);

Powered by Google App Engine
This is Rietveld 408576698