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

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

Issue 11421079: Persist the Instant API to committed search result pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes 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
Index: chrome/browser/ui/search/search_tab_helper.cc
diff --git a/chrome/browser/ui/search/search_tab_helper.cc b/chrome/browser/ui/search/search_tab_helper.cc
index d74e9efa99ffd6a00ffbd2c12648efcbea631998..6b46fd73ec85d5d80e4576fbce15c79706d20139 100644
--- a/chrome/browser/ui/search/search_tab_helper.cc
+++ b/chrome/browser/ui/search/search_tab_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -39,6 +39,7 @@ SearchTabHelper::SearchTabHelper(content::WebContents* web_contents)
: WebContentsObserver(web_contents),
is_search_enabled_(IsSearchEnabled(web_contents)),
is_initial_navigation_commit_(true),
+ user_input_in_progress_(false),
model_(web_contents) {
if (!is_search_enabled_)
return;
@@ -58,13 +59,11 @@ void SearchTabHelper::OmniboxEditModelChanged(bool user_input_in_progress,
if (!is_search_enabled_)
return;
- if (user_input_in_progress) {
- const Mode new_mode = Mode(Mode::MODE_SEARCH_SUGGESTIONS,
- model_.mode().origin, true);
- model_.SetMode(new_mode);
- } else if (cancelling) {
- UpdateModelBasedOnURL(web_contents()->GetURL(), true);
- }
+ user_input_in_progress_ = user_input_in_progress;
+ if (!user_input_in_progress && !cancelling)
+ return;
+
+ UpdateModelBasedOnURL(web_contents()->GetURL(), true);
}
void SearchTabHelper::NavigationEntryUpdated() {
@@ -112,6 +111,8 @@ void SearchTabHelper::UpdateModelBasedOnURL(const GURL& url, bool animate) {
type = Mode::MODE_SEARCH_RESULTS;
origin = Mode::ORIGIN_SEARCH;
}
+ if (user_input_in_progress_)
+ type = Mode::MODE_SEARCH_SUGGESTIONS;
model_.SetMode(Mode(type, origin, animate));
}

Powered by Google App Engine
This is Rietveld 408576698