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

Unified Diff: chrome/browser/ui/search/instant_controller.cc

Issue 14562006: Handle Esc key press event in Local NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git cl upload Created 7 years, 7 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/search/instant_controller.cc
diff --git a/chrome/browser/ui/search/instant_controller.cc b/chrome/browser/ui/search/instant_controller.cc
index 7a549c757ec3de271af234cddc3066d3480f521b..b66bf251fc92b1c63c129f8f96af21a2f056e30d 100644
--- a/chrome/browser/ui/search/instant_controller.cc
+++ b/chrome/browser/ui/search/instant_controller.cc
@@ -379,16 +379,16 @@ bool InstantController::Update(const AutocompleteMatch& match,
// tab), by comparing the old and new WebContents.
if (escape_pressed &&
instant_tab_->contents() == browser_->GetActiveWebContents()) {
- // If the omnibox is blank, send an onchange("") instead of an
- // onsubmit(""). This is to avoid confusion with the onsubmit("")
- // that we send when the user hits Enter to navigate to a URL.
- // onchange("") is used for a similar situation with the overlay
- // (when the overlay is dismissed because the user hit Escape); it
- // does the right thing for committed tabs as well.
- if (full_text.empty())
+ // TODO(kmadhusu): If the |full_text| is not empty, send an
+ // onkeypress(esc) to the Instant page. Do not call
+ // onsubmit(full_text). Fix.
+ if (full_text.empty()) {
+ // Call onchange("") to clear the query for the page.
instant_tab_->Update(string16(), 0, 0, true);
- else
+ instant_tab_->EscKeyPressed();
+ } else {
instant_tab_->Submit(full_text);
+ }
}
} else if (!full_text.empty()) {
// If |full_text| is empty, the user is on the NTP. The overlay may
« no previous file with comments | « chrome/browser/resources/local_ntp/local_ntp.js ('k') | chrome/browser/ui/search/instant_extended_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698