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_))); |
} |