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

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

Issue 5966006: Hitting Tab should always move cursor to end of omnibox text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Mac build. Created 9 years, 11 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/autocomplete_edit_view_views.cc
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_views.cc b/chrome/browser/autocomplete/autocomplete_edit_view_views.cc
index 2b77099e0ae567152f9a148477d215ff6de1ff83..509387387bc28fb55cb047d334c29a953523b496 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_views.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_views.cc
@@ -197,10 +197,20 @@ bool AutocompleteEditViewViews::HandleAfterKeyEvent(
event.GetKeyCode() == ui::VKEY_TAB &&
!event.IsShiftDown() &&
!event.IsControlDown()) {
- if (model_->is_keyword_hint() && !model_->keyword().empty()) {
- model_->AcceptKeyword();
- handled = true;
+ if (model_->is_keyword_hint()) {
+ handled = model_->AcceptKeyword();
} else {
+ string16::size_type start = 0;
+ string16::size_type end = 0;
+ size_t length = GetTextLength();
+ GetSelectionBounds(&start, &end);
+ if (start != end || start < length) {
+ OnBeforePossibleChange();
+ SelectRange(length, length);
+ OnAfterPossibleChange();
+ handled = true;
+ }
+
// TODO(Oshima): handle instant
}
}
@@ -527,10 +537,13 @@ CommandUpdater* AutocompleteEditViewViews::GetCommandUpdater() {
return command_updater_;
}
-views::View* AutocompleteEditViewViews::AddToView(views::View* parent) {
- parent->AddChildView(this);
- AddChildView(textfield_);
- return this;
+void AutocompleteEditViewViews::SetInstantSuggestion(const string16& input) {
+ NOTIMPLEMENTED();
+}
+
+string16 AutocompleteEditViewViews::GetInstantSuggestion() const {
+ NOTIMPLEMENTED();
+ return string16();
}
int AutocompleteEditViewViews::TextWidth() const {
@@ -542,15 +555,10 @@ bool AutocompleteEditViewViews::IsImeComposing() const {
return false;
}
-bool AutocompleteEditViewViews::CommitInstantSuggestion(
- const string16& typed_text,
- const string16& suggested_text) {
- model_->FinalizeInstantQuery(typed_text, suggested_text);
- return true;
-}
-
-void AutocompleteEditViewViews::SetInstantSuggestion(const string16& input) {
- NOTIMPLEMENTED();
+views::View* AutocompleteEditViewViews::AddToView(views::View* parent) {
+ parent->AddChildView(this);
+ AddChildView(textfield_);
+ return this;
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit_view_views.h ('k') | chrome/browser/autocomplete/autocomplete_edit_view_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698