Commit bd7a0b67 authored by Gang Wu's avatar Gang Wu Committed by Commit Bot

Do not call CachedZeroSuggestion if native is initialized

In this CL, we update two parts.
1. If native is initialized, autocomplete mediator call ZeroSuggestion
instead of CachedZeroSuggestion.
2. When SearchActivity lost focus, mUrlBar should lost focus as
well.

Bug: 1101696
Change-Id: I7ce3638a8f9572ce89fa8e9627d1060fecb0226a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2281155Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarEnder <ender@google.com>
Commit-Queue: Gang Wu <gangwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#786194}
parent f7d8c61b
......@@ -160,7 +160,8 @@ public class SearchActivityLocationBarLayout extends LocationBarLayout {
// is finalized after native has been initialized.
private void focusTextBox() {
if (!mUrlBar.hasFocus()) mUrlBar.requestFocus();
getAutocompleteCoordinator().setShowCachedZeroSuggestResults(true);
// Use cached suggestions only if native is not yet ready.
getAutocompleteCoordinator().setShowCachedZeroSuggestResults(!mNativeLibraryReady);
new Handler().post(new Runnable() {
@Override
......@@ -169,4 +170,10 @@ public class SearchActivityLocationBarLayout extends LocationBarLayout {
}
});
}
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (!hasFocus) mUrlBar.clearFocus();
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment