diff options
author | jered@chromium.org <jered@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 03:17:12 +0000 |
---|---|---|
committer | jered@chromium.org <jered@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-13 03:17:12 +0000 |
commit | e80c0fd597cb8c85a9610b01534e7607ddf5874d (patch) | |
tree | 0389b1638e23b554cb4a7f84773764dd92f07752 /chrome/browser/instant | |
parent | ccdb28c8f978e712d84d866b3cf1e991ebcde0fb (diff) | |
download | chromium_src-e80c0fd597cb8c85a9610b01534e7607ddf5874d.zip chromium_src-e80c0fd597cb8c85a9610b01534e7607ddf5874d.tar.gz chromium_src-e80c0fd597cb8c85a9610b01534e7607ddf5874d.tar.bz2 |
InstantExtended: Fix improper calls to OnSubmit.
An invalid assumption in InstantController::Update() caused it to send
OnSubmit() for URLs during navigation. This caused the page to navigate
to search results during the browser's navigation, result being that
search results were shown instead of navigating to the URL.
Also, Update() was being called with the original query text during
navigation, possibly causing a flash; this is never correct and an
existing bool, in_revert_, was supposed to guard against it but did not.
BUG=165580
Review URL: https://chromiumcodereview.appspot.com/11558028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172800 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/instant')
-rw-r--r-- | chrome/browser/instant/instant_controller.cc | 10 | ||||
-rw-r--r-- | chrome/browser/instant/instant_controller.h | 3 |
2 files changed, 9 insertions, 4 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index f024191..303c5e9 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -170,7 +170,8 @@ bool InstantController::Update(const AutocompleteMatch& match, size_t selection_end, bool verbatim, bool user_input_in_progress, - bool omnibox_popup_is_open) { + bool omnibox_popup_is_open, + bool escape_pressed) { if (!extended_enabled_ && !instant_enabled_) return false; @@ -178,7 +179,8 @@ bool InstantController::Update(const AutocompleteMatch& match, << " user_text='" << user_text << "' full_text='" << full_text << "'" << " selection_start=" << selection_start << " selection_end=" << selection_end << " verbatim=" << verbatim << " typing=" - << user_input_in_progress << " popup=" << omnibox_popup_is_open; + << user_input_in_progress << " popup=" << omnibox_popup_is_open + << " escape_pressed=" << escape_pressed; // If the popup is open, the user has to be typing. DCHECK(!omnibox_popup_is_open || user_input_in_progress); @@ -229,8 +231,10 @@ bool InstantController::Update(const AutocompleteMatch& match, // be pointing to the previous tab (which was a search results page). // Ensure we don't send the omnibox text to a random webpage (the new // tab), by comparing the old and new WebContents. - if (instant_tab_->contents() == browser_->GetActiveWebContents()) + if (escape_pressed && + instant_tab_->contents() == browser_->GetActiveWebContents()) { instant_tab_->Submit(full_text); + } } else if (!full_text.empty()) { // If |full_text| is empty, the user is on the NTP. The preview may // be showing custom NTP content; hide only if that's not the case. diff --git a/chrome/browser/instant/instant_controller.h b/chrome/browser/instant/instant_controller.h index 3830fa9..1c1d804 100644 --- a/chrome/browser/instant/instant_controller.h +++ b/chrome/browser/instant/instant_controller.h @@ -61,7 +61,8 @@ class InstantController { size_t selection_end, bool verbatim, bool user_input_in_progress, - bool omnibox_popup_is_open); + bool omnibox_popup_is_open, + bool escape_pressed); // Sets the bounds of the omnibox dropdown, in screen coordinates. void SetOmniboxBounds(const gfx::Rect& bounds); |