Chromium Code Reviews| 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..972415b5fa70cc1fd1aa3ae1107b47c9f0419db1 100644 |
| --- a/chrome/browser/instant/instant_controller.cc |
| +++ b/chrome/browser/instant/instant_controller.cc |
| @@ -509,6 +509,27 @@ bool InstantController::OnUpOrDownKeyPressed(int count) { |
| return true; |
| } |
| +void InstantController::OnCancel(const AutocompleteMatch& match, |
| + const string16& full_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. |
| + // TODO(sreeram): Handle the case where user_text is now a URL |
| + last_match_was_search_ = AutocompleteMatch::IsSearchType(match.type) && |
| + !full_text.empty(); |
| + last_omnibox_text_ = full_text; |
| + last_suggestion_ = InstantSuggestion(); |
| + |
| + if (instant_tab_) |
| + instant_tab_->CancelSelection(full_text); |
| + else |
| + overlay_->CancelSelection(full_text); |
| +} |
| + |
| content::WebContents* InstantController::GetPreviewContents() const { |
| return overlay_ ? overlay_->contents() : NULL; |
| } |
| @@ -522,7 +543,6 @@ bool InstantController::IsPreviewingSearchResults() const { |
| bool InstantController::CommitIfPossible(InstantCommitType type) { |
| if (!extended_enabled_ && !instant_enabled_) |
| return false; |
| - |
|
sreeram
2013/02/14 17:56:41
Nit: Don't remove this blank line.
|
| LOG_INSTANT_DEBUG_EVENT(this, base::StringPrintf( |
| "CommitIfPossible: type=%d last_omnibox_text_='%s' " |
| "last_match_was_search_=%d instant_tab_=%d", type, |