OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.chrome.browser.omnibox; | 5 package org.chromium.chrome.browser.omnibox; |
6 | 6 |
7 import android.os.Bundle; | 7 import android.os.Bundle; |
8 import android.text.TextUtils; | 8 import android.text.TextUtils; |
9 | 9 |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
11 import org.chromium.base.annotations.CalledByNative; | 11 import org.chromium.base.annotations.CalledByNative; |
12 import org.chromium.chrome.browser.WarmupManager; | |
12 import org.chromium.chrome.browser.omnibox.OmniboxSuggestion.MatchClassification ; | 13 import org.chromium.chrome.browser.omnibox.OmniboxSuggestion.MatchClassification ; |
13 import org.chromium.chrome.browser.omnibox.VoiceSuggestionProvider.VoiceResult; | 14 import org.chromium.chrome.browser.omnibox.VoiceSuggestionProvider.VoiceResult; |
14 import org.chromium.chrome.browser.profiles.Profile; | 15 import org.chromium.chrome.browser.profiles.Profile; |
15 import org.chromium.content_public.browser.WebContents; | 16 import org.chromium.content_public.browser.WebContents; |
16 | 17 |
17 import java.util.ArrayList; | 18 import java.util.ArrayList; |
18 import java.util.List; | 19 import java.util.List; |
19 | 20 |
20 /** | 21 /** |
21 * Bridge to the native AutocompleteControllerAndroid. | 22 * Bridge to the native AutocompleteControllerAndroid. |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 * | 153 * |
153 * @param profile The profile to use for starting the AutocompleteController . | 154 * @param profile The profile to use for starting the AutocompleteController . |
154 * @param omniboxText The text displayed in the omnibox. | 155 * @param omniboxText The text displayed in the omnibox. |
155 * @param url The url of the currently loaded web page. | 156 * @param url The url of the currently loaded web page. |
156 * @param focusedFromFakebox Whether the user entered the omnibox by tapping the fakebox on the | 157 * @param focusedFromFakebox Whether the user entered the omnibox by tapping the fakebox on the |
157 * native NTP. This should be false on all other p ages. | 158 * native NTP. This should be false on all other p ages. |
158 */ | 159 */ |
159 public void startZeroSuggest(Profile profile, String omniboxText, String url , | 160 public void startZeroSuggest(Profile profile, String omniboxText, String url , |
160 boolean focusedFromFakebox) { | 161 boolean focusedFromFakebox) { |
161 if (profile == null || TextUtils.isEmpty(url)) return; | 162 if (profile == null || TextUtils.isEmpty(url)) return; |
163 | |
164 // Proactively start up a renderer, to reduce the time to display search results, | |
165 // especially if a Service Worker is used. | |
166 WarmupManager.getInstance().createSpareRenderProcessHost(profile); | |
Ted C
2017/06/30 16:16:56
Is OmniboxPrerender fully disabled at this point?
mattcary
2017/07/03 08:03:02
It's 99% disabled, but that's a good point. Added
mattcary
2017/07/03 08:08:33
Actually, on further reflection, the spare rendere
| |
167 | |
162 mNativeAutocompleteControllerAndroid = nativeInit(profile); | 168 mNativeAutocompleteControllerAndroid = nativeInit(profile); |
163 if (mNativeAutocompleteControllerAndroid != 0) { | 169 if (mNativeAutocompleteControllerAndroid != 0) { |
164 if (mUseCachedZeroSuggestResults) mWaitingForSuggestionsToCache = tr ue; | 170 if (mUseCachedZeroSuggestResults) mWaitingForSuggestionsToCache = tr ue; |
165 nativeOnOmniboxFocused( | 171 nativeOnOmniboxFocused( |
166 mNativeAutocompleteControllerAndroid, omniboxText, url, focu sedFromFakebox); | 172 mNativeAutocompleteControllerAndroid, omniboxText, url, focu sedFromFakebox); |
167 } | 173 } |
168 } | 174 } |
169 | 175 |
170 /** | 176 /** |
171 * Stops generating autocomplete suggestions for the currently specified tex t from | 177 * Stops generating autocomplete suggestions for the currently specified tex t from |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 * @param query The query to be expanded into a fully qualified URL if appro priate. | 376 * @param query The query to be expanded into a fully qualified URL if appro priate. |
371 * @return The fully qualified URL or null. | 377 * @return The fully qualified URL or null. |
372 */ | 378 */ |
373 public static native String nativeQualifyPartialURLQuery(String query); | 379 public static native String nativeQualifyPartialURLQuery(String query); |
374 | 380 |
375 /** | 381 /** |
376 * Sends a zero suggest request to the server in order to pre-populate the r esult cache. | 382 * Sends a zero suggest request to the server in order to pre-populate the r esult cache. |
377 */ | 383 */ |
378 public static native void nativePrefetchZeroSuggestResults(); | 384 public static native void nativePrefetchZeroSuggestResults(); |
379 } | 385 } |
OLD | NEW |