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 698fba63810c25971a46ea5f19297955ebca1fb1..ea0a2faba4e8f7a78242b65d2ec2f07cbc0216aa 100644 |
--- a/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
+++ b/chrome/browser/ui/omnibox/omnibox_edit_model.cc |
@@ -627,7 +627,17 @@ void OmniboxEditModel::OpenMatch(const AutocompleteMatch& match, |
TemplateURLPrepopulateData::kMaxPrepopulatedEngineID); |
} |
- if (disposition != NEW_BACKGROUND_TAB) { |
+ // Text in the omnibox needs to be reverted in the following cases: |
+ // (1) Non-instant-extended query is committed (except to a background tab, |
+ // where the query stays in the omnibox e.g. middle-click). |
+ // (2) Instant-extended query is committed on a new tab (foreground or |
+ // background). Current tab should show previous, reverted query. |
+ bool is_instant_extended_search = |
+ controller()->GetInstant()->IsInstantExtendedSearch(); |
sky
2012/12/12 22:41:57
null check GetInstant()
Mathieu
2012/12/12 23:37:24
Done.
|
+ if ((disposition != NEW_BACKGROUND_TAB && !is_instant_extended_search) || |
+ (is_instant_extended_search && |
+ (disposition == NEW_BACKGROUND_TAB || |
+ disposition == NEW_FOREGROUND_TAB))) { |
in_revert_ = true; |
view_->RevertAll(); // Revert the box to its unedited state |
in_revert_ = false; |