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

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

Issue 11570020: Fix search terms handling on commit (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/instant/instant_controller.cc
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index e0fc9e77fef1b23103ee22eca53921410a28aee3..1f08fa03263605f81dc30db43c62e95f36788000 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -652,10 +652,6 @@ void InstantController::SetSuggestions(
const std::vector<InstantSuggestion>& suggestions) {
DVLOG(1) << "SetSuggestions";
- // Ignore if we are not currently accepting search suggestions.
- if (!search_mode_.is_search_suggestions() || last_omnibox_text_.empty())
- return;
-
// Ignore if the message is from an unexpected source.
if (instant_tab_) {
if (instant_tab_->contents() != contents)
@@ -669,6 +665,17 @@ void InstantController::SetSuggestions(
if (!suggestions.empty())
suggestion = suggestions[0];
+ if (instant_tab_ && instant_tab_->contents() == contents &&
beaudoin 2012/12/14 15:36:20 Nit: the "instant_tab_->contents() == contents" pa
samarth 2012/12/14 17:48:59 Done.
+ search_mode_.is_search_results()) {
+ // Treat any calls to SetSuggestions in committed search mode as a REPLACE.
beaudoin 2012/12/14 15:36:20 Not sure that the comment here describes the next
samarth 2012/12/14 17:48:59 Done.
+ browser_->SetInstantSuggestion(suggestion);
+ return;
+ }
+
+ // Ignore if we are not currently accepting search suggestions.
+ if (!search_mode_.is_search_suggestions() || last_omnibox_text_.empty())
+ return;
+
if (suggestion.behavior == INSTANT_COMPLETE_REPLACE) {
// We don't get an Update() when changing the omnibox due to a REPLACE
// suggestion (so that we don't inadvertently cause the preview to change
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698