Chromium Code Reviews| 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 ea6cfc703780f4cf852d2ec56594f7edeb718f93..0966358a197e26d7cb673a41733723d971fc016f 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,6 +333,28 @@ void AutocompleteControllerAndroid::InitJNI(JNIEnv* env, jobject obj) { |
| void AutocompleteControllerAndroid::OnResultChanged( |
| bool default_match_changed) { |
| + if (default_match_changed && |
|
Jered
2014/06/13 16:53:20
AutocompleteController::OnResultChanged() does not
kmadhusu
2014/06/13 17:42:13
It wasn't intentional. Updated the code to look th
|
| + chrome::IsInstantExtendedAPIEnabled() && |
| + chrome::ShouldPrefetchSearchResults()) { |
| + InstantSuggestion prefetch_suggestion; |
| + const AutocompleteResult& result = autocomplete_controller_->result(); |
| + // If the default match should be prefetched, do that. |
| + const AutocompleteResult::const_iterator default_match( |
| + result.default_match()); |
| + if ((default_match != result.end()) && |
| + 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 (autocomplete_controller_.get() != NULL && !inside_synchronous_start_) |
| NotifySuggestionsReceived(autocomplete_controller_->result()); |
| } |