Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
=================================================================== |
--- chrome/browser/ui/views/omnibox/omnibox_view_win.cc (revision 122471) |
+++ chrome/browser/ui/views/omnibox/omnibox_view_win.cc (working copy) |
@@ -689,22 +689,16 @@ |
ScopedFreeze freeze(this, GetTextObjectModel()); |
model_->SetUserText(text); |
saved_selection_for_focus_change_.cpMin = -1; |
- SetWindowTextAndCaretPos(display_text, display_text.length(), update_popup, |
- true); |
+ SetWindowTextAndCaretPos(display_text, display_text.length()); |
+ if (update_popup) |
+ UpdatePopup(); |
+ TextChanged(); |
} |
void OmniboxViewWin::SetWindowTextAndCaretPos(const string16& text, |
- size_t caret_pos, |
- bool update_popup, |
- bool notify_text_changed) { |
+ size_t caret_pos) { |
SetWindowText(text.c_str()); |
PlaceCaretAt(caret_pos); |
- |
- if (update_popup) |
- UpdatePopup(); |
- |
- if (notify_text_changed) |
- TextChanged(); |
} |
void OmniboxViewWin::SetForcedQuery() { |
@@ -744,8 +738,9 @@ |
void OmniboxViewWin::RevertAll() { |
ScopedFreeze freeze(this, GetTextObjectModel()); |
ClosePopup(); |
- saved_selection_for_focus_change_.cpMin = -1; |
model_->Revert(); |
+ saved_selection_for_focus_change_.cpMin = -1; |
+ TextChanged(); |
} |
void OmniboxViewWin::UpdatePopup() { |
@@ -840,7 +835,8 @@ |
// text and then arrowed to another entry with the same text, we'd still want |
// to move the caret. |
ScopedFreeze freeze(this, GetTextObjectModel()); |
- SetWindowTextAndCaretPos(display_text, display_text.length(), false, true); |
+ SetWindowTextAndCaretPos(display_text, display_text.length()); |
+ TextChanged(); |
} |
bool OmniboxViewWin::OnInlineAutocompleteTextMaybeChanged( |
@@ -2091,17 +2087,17 @@ |
} |
case VK_TAB: { |
- const bool shift_pressed = GetKeyState(VK_SHIFT) < 0; |
- if (model_->is_keyword_hint() && !shift_pressed) { |
+ if (model_->is_keyword_hint()) { |
// Accept the keyword. |
ScopedFreeze freeze(this, GetTextObjectModel()); |
model_->AcceptKeyword(); |
- } else if (shift_pressed && |
- model_->popup_model()->selected_line_state() == |
- AutocompletePopupModel::KEYWORD) { |
- model_->ClearKeyword(GetText()); |
+ } else if (!IsCaretAtEnd()) { |
+ ScopedFreeze freeze(this, GetTextObjectModel()); |
+ OnBeforePossibleChange(); |
+ PlaceCaretAt(GetTextLength()); |
+ OnAfterPossibleChange(); |
} else { |
- model_->OnUpOrDownKeyPressed(shift_pressed ? -count : count); |
+ model_->CommitSuggestedText(true); |
} |
return true; |
} |