| Index: chrome/browser/android/omnibox/autocomplete_controller_android.cc
|
| diff --git a/chrome/browser/android/omnibox/autocomplete_controller_android.cc b/chrome/browser/android/omnibox/autocomplete_controller_android.cc
|
| index 1bd65ad7c062339fb85008aba5783597de706cf5..ffbb3ebcea5ccea50b418689f51c32c57d3eb298 100644
|
| --- a/chrome/browser/android/omnibox/autocomplete_controller_android.cc
|
| +++ b/chrome/browser/android/omnibox/autocomplete_controller_android.cc
|
| @@ -16,6 +16,7 @@
|
| #include "chrome/browser/autocomplete/autocomplete_controller.h"
|
| #include "chrome/browser/autocomplete/autocomplete_input.h"
|
| #include "chrome/browser/autocomplete/autocomplete_match.h"
|
| +#include "chrome/browser/autocomplete/search_provider.h"
|
| #include "chrome/browser/autocomplete/shortcuts_backend_factory.h"
|
| #include "chrome/browser/browser_process.h"
|
| #include "chrome/browser/chrome_notification_types.h"
|
| @@ -24,11 +25,14 @@
|
| #include "chrome/browser/profiles/incognito_helpers.h"
|
| #include "chrome/browser/profiles/profile_android.h"
|
| #include "chrome/browser/profiles/profile_manager.h"
|
| +#include "chrome/browser/search/search.h"
|
| #include "chrome/browser/search_engines/template_url_service.h"
|
| #include "chrome/browser/search_engines/template_url_service_factory.h"
|
| #include "chrome/browser/sessions/session_id.h"
|
| +#include "chrome/browser/ui/search/instant_search_prerenderer.h"
|
| #include "chrome/browser/ui/toolbar/toolbar_model.h"
|
| #include "chrome/common/autocomplete_match_type.h"
|
| +#include "chrome/common/instant_types.h"
|
| #include "chrome/common/pref_names.h"
|
| #include "chrome/common/url_constants.h"
|
| #include "components/keyed_service/content/browser_context_dependency_manager.h"
|
| @@ -329,7 +333,31 @@ void AutocompleteControllerAndroid::InitJNI(JNIEnv* env, jobject obj) {
|
|
|
| void AutocompleteControllerAndroid::OnResultChanged(
|
| bool default_match_changed) {
|
| - if (autocomplete_controller_.get() != NULL && !inside_synchronous_start_)
|
| + if (!autocomplete_controller_)
|
| + return;
|
| +
|
| + const AutocompleteResult& result = autocomplete_controller_->result();
|
| + const AutocompleteResult::const_iterator default_match(
|
| + result.default_match());
|
| + if ((default_match != result.end()) && default_match_changed &&
|
| + chrome::IsInstantExtendedAPIEnabled() &&
|
| + chrome::ShouldPrefetchSearchResults()) {
|
| + InstantSuggestion prefetch_suggestion;
|
| + // If the default match should be prefetched, do that.
|
| + if (SearchProvider::ShouldPrefetch(*default_match)) {
|
| + prefetch_suggestion.text = default_match->contents;
|
| + prefetch_suggestion.metadata =
|
| + SearchProvider::GetSuggestMetadata(*default_match);
|
| + }
|
| + // Send the prefetch suggestion unconditionally to the Instant search base
|
| + // page. If there is no suggestion to prefetch, we need to send a blank
|
| + // query to clear the prefetched results.
|
| + InstantSearchPrerenderer* prerenderer =
|
| + InstantSearchPrerenderer::GetForProfile(profile_);
|
| + if (prerenderer)
|
| + prerenderer->Prerender(prefetch_suggestion);
|
| + }
|
| + if (!inside_synchronous_start_)
|
| NotifySuggestionsReceived(autocomplete_controller_->result());
|
| }
|
|
|
|
|