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

Unified Diff: chrome/browser/instant/instant_controller.cc

Issue 11889003: Fixing ESC in instant-extended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Answered Sreeram's comment, fixed Jeremy's problem and updated tests. 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/instant/instant_controller.cc
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 80f9b796a4cf181a57ac371c9af2bab3abe1c1df..82afb84f3351f4f932c7688b1811e80cff773c90 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -509,6 +509,24 @@ bool InstantController::OnUpOrDownKeyPressed(int count) {
return true;
}
+void InstantController::OnCancel(const string16& user_text) {
+ if (!extended_enabled_)
+ return;
+
+ if (!instant_tab_ && !overlay_)
+ return;
+
+ // We manually reset the state here since the JS is not expected to do it.
+ last_match_was_search_ = !user_text.empty();
sreeram 2013/02/12 20:52:59 This isn't totally correct. Consider: I type [face
beaudoin 2013/02/12 21:34:41 Added TODO. Done.
+ last_omnibox_text_ = user_text;
+ last_suggestion_ = InstantSuggestion();
+
+ if (instant_tab_)
+ instant_tab_->CancelSelection(user_text);
+ else
+ overlay_->CancelSelection(user_text);
+}
+
content::WebContents* InstantController::GetPreviewContents() const {
return overlay_ ? overlay_->contents() : NULL;
}
@@ -522,7 +540,6 @@ bool InstantController::IsPreviewingSearchResults() const {
bool InstantController::CommitIfPossible(InstantCommitType type) {
if (!extended_enabled_ && !instant_enabled_)
return false;
-
LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf(
"CommitIfPossible: type=%d last_omnibox_text_='%s' "
"last_match_was_search_=%d instant_tab_=%d", type,

Powered by Google App Engine
This is Rietveld 408576698