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

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: Reworked to send ESC down to JS, added test. 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 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_ ?

Powered by Google App Engine
This is Rietveld 408576698