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 5de37c2ee5205b95956ad55e2e7ae72b74bcd30a..90ca8889e60b8c341cc41c90cfed6564daeaab5c 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, true); |
break; |
} |
} |
@@ -705,7 +705,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; |
@@ -795,7 +795,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_) { |
@@ -920,7 +920,7 @@ void OmniboxEditModel::OnPopupDataChanged( |
// right answer here :( |
} |
view_->OnTemporaryTextMaybeChanged(DisplayTextFromUserText(text), |
- save_original_selection); |
+ save_original_selection, true); |
return; |
} |
@@ -1176,9 +1176,25 @@ void OmniboxEditModel::RevertTemporaryText(bool revert_popup) { |
// The user typed something, then selected a different item. Restore the |
// text they typed and change back to the default item. |
// NOTE: This purposefully does not reset paste_state_. |
+ bool notify_instant = is_temporary_text_set_by_instant_; |
just_deleted_text_ = false; |
has_temporary_text_ = false; |
is_temporary_text_set_by_instant_ = false; |
+ |
+ InstantController* instant = controller_->GetInstant(); |
+ if (instant && notify_instant) { |
+ // Mormally, popup_->ResetToDefaultMatch() will cause the view text to be |
sreeram
2013/02/12 20:52:59
Mormally? :)
beaudoin
2013/02/12 21:34:41
:}
Done.
|
+ // updated. In Instant Extended mode however, the popup_ is not used, so it |
+ // won't do anything. So, update the view ourselves. Even if Instant is not |
+ // in extended mode (i.e., it's enabled in non-extended mode, or disabled |
+ // altogether), this is okay to do, since the call to |
+ // popup_->ResetToDefaultMatch() will just override whatever we do here. |
+ // |
+ // The two "false" arguments make sure that our shenanigans don't cause any |
+ // previously saved selection to be erased nor OnChanged() to be called. |
+ view_->OnTemporaryTextMaybeChanged(user_text_, false, false); |
sreeram
2013/02/12 20:56:51
You need to set this to user_text_ + inline_autoco
beaudoin
2013/02/12 21:34:41
Done.
|
+ instant->OnCancel(user_text_); |
+ } |
if (revert_popup) |
popup_->ResetToDefaultMatch(); |
view_->OnRevertTemporaryText(); |