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

Unified Diff: chrome/browser/ui/omnibox/omnibox_edit_model.cc

Issue 11414303: Make Google Search autocomplete provider cursor aware. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressed comments. Created 8 years 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/ui/omnibox/omnibox_edit_model.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_edit_model.cc b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
index 5a896518b4950c158196721bb311b55483a2f4cf..3e3471878805a9aef2e01d8837537b24dcab82eb 100644
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc
@@ -447,15 +447,18 @@ void OmniboxEditModel::StartAutocomplete(
bool keyword_is_selected = KeywordIsSelected();
popup_->SetHoveredLine(OmniboxPopupModel::kNoMatch);
+ // Get cursor position, which is equivalent to the current selection's end.
+ size_t start, end;
+ view_->GetSelectionBounds(&start, &end);
// We don't explicitly clear OmniboxPopupModel::manually_selected_match, as
// Start ends up invoking OmniboxPopupModel::OnResultChanged which clears it.
- autocomplete_controller_->Start(
- user_text_, GetDesiredTLD(),
+ autocomplete_controller_->Start(AutocompleteInput(
+ user_text_, end, GetDesiredTLD(),
prevent_inline_autocomplete || just_deleted_text_ ||
(has_selected_text && inline_autocomplete_text_.empty()) ||
(paste_state_ != NONE), keyword_is_selected,
keyword_is_selected || allow_exact_keyword_match_,
- AutocompleteInput::ALL_MATCHES);
+ AutocompleteInput::ALL_MATCHES));
}
void OmniboxEditModel::StopAutocomplete() {

Powered by Google App Engine
This is Rietveld 408576698