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

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: '' Created 7 years, 8 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 734223f576163de72022b539f28ce94622af602d..ef13eb7b684cc01cba3dbeb11c5388f6261debcf 100644
--- a/chrome/browser/ui/search/instant_controller.cc
+++ b/chrome/browser/ui/search/instant_controller.cc
@@ -364,10 +364,14 @@ bool InstantController::Update(const AutocompleteMatch& match,
// 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())
- instant_tab_->Update(string16(), 0, 0, true);
- else
+ if (full_text.empty()) {
+ if (UsingLocalPage())
samarth 2013/05/04 01:04:17 Let's send the right event for both local and remo
kmadhusu 2013/05/04 03:34:38 Done.
+ OnEscKeyPressed();
samarth 2013/05/04 01:04:17 Just call instant_tab_->OnEscKeyPressed() here. No
kmadhusu 2013/05/04 03:34:38 Done.
+ else
+ instant_tab_->Update(string16(), 0, 0, true);
+ } 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
@@ -1687,3 +1691,14 @@ bool InstantController::UsingLocalPage() const {
return (instant_tab_ && instant_tab_->IsLocal()) ||
(!instant_tab_ && overlay_ && overlay_->IsLocal());
}
+
+void InstantController::OnEscKeyPressed() const {
+ DCHECK(extended_enabled_);
+ if (!instant_tab_ && !overlay_)
+ return;
+
+ if (instant_tab_)
+ instant_tab_->EscKeyPressed();
+ else
+ overlay_->EscKeyPressed();
+}

Powered by Google App Engine
This is Rietveld 408576698