Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4065)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java

Issue 2957443002: Dont show search suggestions until search engine promo dialog checks (Closed)
Patch Set: rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java
index d16e3d00d0f5995f136b9a4237683edf9a2b3e2c..995ffa48db9cfa6ee44a93f5ed59a1b5d89fad45 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivityLocationBarLayout.java
@@ -13,9 +13,12 @@ import android.view.View;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.omnibox.LocationBarLayout;
+import org.chromium.chrome.browser.omnibox.OmniboxSuggestion;
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.ui.UiUtils;
+import java.util.List;
+
/** Implementation of the {@link LocationBarLayout} that is displayed for widget searches. */
public class SearchActivityLocationBarLayout extends LocationBarLayout {
/** Delegates calls out to the containing Activity. */
@@ -28,10 +31,12 @@ public class SearchActivityLocationBarLayout extends LocationBarLayout {
}
private Delegate mDelegate;
+ private boolean mShowSuggestions;
public SearchActivityLocationBarLayout(Context context, AttributeSet attrs) {
super(context, attrs, R.layout.location_bar_base);
setUrlBarFocusable(true);
+ mShowSuggestions = !LocaleManager.getInstance().needToCheckForSearchEnginePromo();
}
/** Set the {@link Delegate}. */
@@ -65,6 +70,14 @@ public class SearchActivityLocationBarLayout extends LocationBarLayout {
super.onNativeLibraryReady();
setAutocompleteProfile(Profile.getLastUsedProfile().getOriginalProfile());
setShowCachedZeroSuggestResults(true);
+ mShowSuggestions = !LocaleManager.getInstance().needToCheckForSearchEnginePromo();
+ }
+
+ @Override
+ public void onSuggestionsReceived(
+ List<OmniboxSuggestion> newSuggestions, String inlineAutocompleteText) {
+ if (!mShowSuggestions) return;
+ super.onSuggestionsReceived(newSuggestions, inlineAutocompleteText);
}
/** Called when the SearchActivity has finished initialization. */
@@ -72,6 +85,7 @@ public class SearchActivityLocationBarLayout extends LocationBarLayout {
SearchWidgetProvider.updateCachedVoiceSearchAvailability(isVoiceSearchEnabled());
if (isVoiceSearchIntent && mUrlBar.isFocused()) onUrlFocusChange(true);
if (!TextUtils.isEmpty(mUrlBar.getText())) onTextChangedForAutocomplete();
+ mShowSuggestions = true;
}
/** Begins a new query. */
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698