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 if (!focusedFromFakebox) { | |
Ted C
2017/07/11 16:21:46
I wonder if this should instead be NewTabPage.isNT
mattcary
2017/07/12 10:39:17
Done.
I tested on a tablet, and using focusedFrom
| |
165 // Proactively start up a renderer, to reduce the time to display se arch results, | |
166 // especially if a Service Worker is used. | |
167 WarmupManager.getInstance().createSpareRenderProcessHost(profile); | |
168 } | |
162 mNativeAutocompleteControllerAndroid = nativeInit(profile); | 169 mNativeAutocompleteControllerAndroid = nativeInit(profile); |
163 if (mNativeAutocompleteControllerAndroid != 0) { | 170 if (mNativeAutocompleteControllerAndroid != 0) { |
164 if (mUseCachedZeroSuggestResults) mWaitingForSuggestionsToCache = tr ue; | 171 if (mUseCachedZeroSuggestResults) mWaitingForSuggestionsToCache = tr ue; |
165 nativeOnOmniboxFocused( | 172 nativeOnOmniboxFocused( |
166 mNativeAutocompleteControllerAndroid, omniboxText, url, focu sedFromFakebox); | 173 mNativeAutocompleteControllerAndroid, omniboxText, url, focu sedFromFakebox); |
167 } | 174 } |
168 } | 175 } |
169 | 176 |
170 /** | 177 /** |
171 * Stops generating autocomplete suggestions for the currently specified tex t from | 178 * 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. | 377 * @param query The query to be expanded into a fully qualified URL if appro priate. |
371 * @return The fully qualified URL or null. | 378 * @return The fully qualified URL or null. |
372 */ | 379 */ |
373 public static native String nativeQualifyPartialURLQuery(String query); | 380 public static native String nativeQualifyPartialURLQuery(String query); |
374 | 381 |
375 /** | 382 /** |
376 * Sends a zero suggest request to the server in order to pre-populate the r esult cache. | 383 * Sends a zero suggest request to the server in order to pre-populate the r esult cache. |
377 */ | 384 */ |
378 public static native void nativePrefetchZeroSuggestResults(); | 385 public static native void nativePrefetchZeroSuggestResults(); |
379 } | 386 } |
OLD | NEW |