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

Unified Diff: chrome/browser/autocomplete/search_provider.cc

Issue 12386019: Instant: Use only one hidden WebContents per profile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/autocomplete/search_provider.cc
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 0a71ecfa364c69c9d7987375811d9fd327f4b024..bfc973e642c42c932a88aed4f095223635fd08d8 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -37,7 +37,6 @@
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
-#include "chrome/browser/ui/browser_instant_controller.h"
#include "chrome/browser/ui/search/search.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
@@ -174,8 +173,8 @@ void SearchProvider::FinalizeInstantQuery(const string16& input_text,
}
}
- // Add the new instant suggest result.
- if (suggestion.type == INSTANT_SUGGESTION_SEARCH) {
+ // Add the new Instant suggest result.
+ if (!suggestion.is_url) {
// Instant has a query suggestion. Rank it higher than SEARCH_WHAT_YOU_TYPED
// so that it gets autocompleted.
const int verbatim_relevance = GetVerbatimRelevance();
@@ -283,13 +282,13 @@ void SearchProvider::Start(const AutocompleteInput& input,
input_ = input;
- // Don't run the normal provider flow when the Instant Extended API is
- // enabled. (When the Extended API is enabled, the embedded page will handle
- // all search suggestions itself.)
- // TODO(dcblack): once we are done refactoring the omnibox so we don't need to
+ // When Instant is enabled in the extended mode, the embedded page will handle
+ // all search suggestions itself, so don't run the normal provider flow.
+ // TODO(dcblack): Once we are done refactoring the omnibox so we don't need to
// use FinalizeInstantQuery anymore, we can take out this check and remove
// this provider from kInstantExtendedOmniboxProviders.
- if (!chrome::search::IsInstantExtendedAPIEnabled(profile_)) {
+ if (!chrome::search::IsInstantExtendedAPIEnabled(profile_) ||
+ !chrome::search::IsInstantEnabled(profile_)) {
DoHistoryQuery(minimal_changes);
StartOrStopSuggestQuery(minimal_changes);
}
@@ -713,8 +712,7 @@ bool SearchProvider::ParseSuggestResults(Value* root_val, bool is_keyword) {
extras->GetList("google:suggesttype", &types);
// Only accept relevance suggestions if Instant is disabled.
- if (!is_keyword &&
- !chrome::BrowserInstantController::IsInstantEnabled(profile_)) {
+ if (!is_keyword && !chrome::search::IsInstantEnabled(profile_)) {
// Discard this list if its size does not match that of the suggestions.
if (extras->GetList("google:suggestrelevance", &relevances) &&
relevances->GetSize() != results->GetSize())
@@ -814,7 +812,7 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() {
}
const size_t verbatim_matches_size = map.size();
if (!default_provider_suggestion_.text.empty() &&
- default_provider_suggestion_.type == INSTANT_SUGGESTION_SEARCH &&
+ !default_provider_suggestion_.is_url &&
!input_.prevent_inline_autocomplete())
AddMatchToMap(input_.text() + default_provider_suggestion_.text,
input_.text(), verbatim_relevance + 1,
@@ -835,7 +833,7 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() {
matches_.push_back(i->second);
if (!default_provider_suggestion_.text.empty() &&
- default_provider_suggestion_.type == INSTANT_SUGGESTION_URL &&
+ default_provider_suggestion_.is_url &&
!input_.prevent_inline_autocomplete()) {
// See comment in FinalizeInstantQuery() for why we don't use
// |verbatim_relevance| here.
@@ -1347,9 +1345,7 @@ AutocompleteMatch SearchProvider::NavigationToMatch(
void SearchProvider::UpdateDone() {
// We're done when the timer isn't running, there are no suggest queries
- // pending, and we're not waiting on instant.
+ // pending, and we're not waiting on Instant.
done_ = (!timer_.IsRunning() && (suggest_results_pending_ == 0) &&
- (instant_finalized_ ||
- (!chrome::BrowserInstantController::IsInstantEnabled(profile_) &&
- !chrome::search::IsInstantExtendedAPIEnabled(profile_))));
+ (instant_finalized_ || !chrome::search::IsInstantEnabled(profile_)));
}

Powered by Google App Engine
This is Rietveld 408576698