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

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

Issue 11889003: Fixing ESC in instant-extended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Reverted back to asvitkine's fix. REALLY answered PK's comments. :) Created 7 years, 10 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/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 1e1c3fc06acc3106c88bd1add494cd9eba160727..056ea890ea4b584bf865db0ed8e4cca2fc123980 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;
}
@@ -1179,6 +1179,14 @@ void OmniboxEditModel::RevertTemporaryText(bool revert_popup) {
just_deleted_text_ = false;
has_temporary_text_ = false;
is_temporary_text_set_by_instant_ = false;
+
+ InstantController* instant = controller_->GetInstant();
+ if (instant) {
+ // Update the view text, do not notify the model in order not to trigger an
+ // unwanted call to instant->Update().
+ view_->OnTemporaryTextMaybeChanged(user_text_, false, false);
+ instant->OnCancel(user_text_);
sreeram 2013/02/12 18:12:29 It took me some time to figure out what's going on
beaudoin 2013/02/12 20:27:30 Now using your comment. 1) --> discussed over chat
+ }
if (revert_popup)
popup_->ResetToDefaultMatch();
view_->OnRevertTemporaryText();

Powered by Google App Engine
This is Rietveld 408576698