Chromium Code Reviews| 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 aa807baab416e269cd497d8b13d4947ebaeef6eb..0271e37451b85f42b18b39c6ddfb56a8eaa6ccc6 100644 |
| --- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
| +++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
| @@ -220,7 +220,7 @@ void OmniboxEditModel::SetInstantSuggestion( |
| keyword_ = string16(); |
| is_keyword_hint_ = false; |
| view_->OnTemporaryTextMaybeChanged(suggestion.text, |
| - save_original_selection); |
| + save_original_selection, false); |
|
beaudoin
2013/02/07 22:34:59
This is my new way of fixing the problem Alexei so
|
| break; |
| } |
| } |
| @@ -717,7 +717,7 @@ bool OmniboxEditModel::AcceptKeyword() { |
| is_temporary_text_set_by_instant_ = false; |
| view_->OnTemporaryTextMaybeChanged( |
| DisplayTextFromUserText(CurrentMatch().fill_into_edit), |
| - save_original_selection); |
| + save_original_selection, true); |
| content::RecordAction(UserMetricsAction("AcceptedKeywordHint")); |
| return true; |
| @@ -807,7 +807,7 @@ void OmniboxEditModel::OnKillFocus() { |
| } |
| bool OmniboxEditModel::OnEscapeKeyPressed() { |
| - if (has_temporary_text_ && !is_temporary_text_set_by_instant_) { |
| + if (has_temporary_text_) { |
| AutocompleteMatch match; |
| InfoForCurrentSelection(&match, NULL); |
| if (match.destination_url != original_url_) { |
| @@ -932,7 +932,7 @@ void OmniboxEditModel::OnPopupDataChanged( |
| // right answer here :( |
| } |
| view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text), |
| - save_original_selection); |
| + save_original_selection, true); |
| return; |
| } |
| @@ -1191,8 +1191,15 @@ void OmniboxEditModel::RevertTemporaryText(bool revert_popup) { |
| just_deleted_text_ = false; |
| has_temporary_text_ = false; |
| is_temporary_text_set_by_instant_ = false; |
| - if (revert_popup) |
| + |
| + InstantController* instant = controller_->GetInstant(); |
| + if (instant) { |
| + // Update the view text, but ensure |
| + view_->OnTemporaryTextMaybeChanged(user_text_, false, false); |
| + instant->OnCancel(); |
| + } else if (revert_popup) { |
| popup_->ResetToDefaultMatch(); |
| + } |
| view_->OnRevertTemporaryText(); |
| } |
| @@ -1250,11 +1257,6 @@ bool OmniboxEditModel::DoInstant(const AutocompleteMatch& match) { |
| if (!instant || in_revert_) |
| return false; |
| - // Don't call Update() if the change is a result of a |
| - // INSTANT_COMPLETE_REPLACE instant suggestion. |
| - if (has_temporary_text_ && is_temporary_text_set_by_instant_) |
| - return false; |
| - |
|
beaudoin
2013/02/07 22:34:59
This basically reverts Alexei's fix of crbug.com/1
|
| // The two pieces of text we want to send Instant, viz., what the user has |
| // typed, and the full omnibox text including any inline autocompletion. |
| string16 user_text = has_temporary_text_ ? |