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

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

Issue 2838833002: 🔍 Introduce default search engine dialog (Closed)
Patch Set: Redo how the dialog is created Created 3 years, 8 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
Index: chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
index d73eca445f83090e79e0ed682b2c6f695dca7395..69e8164c87b72223048076c50a3ad15d2ebd1a40 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/searchwidget/SearchActivity.java
@@ -19,6 +19,7 @@ import org.chromium.chrome.browser.WebContentsFactory;
import org.chromium.chrome.browser.WindowDelegate;
import org.chromium.chrome.browser.customtabs.CustomTabsConnection;
import org.chromium.chrome.browser.init.AsyncInitializationActivity;
+import org.chromium.chrome.browser.locale.LocaleManager;
import org.chromium.chrome.browser.omnibox.AutocompleteController;
import org.chromium.chrome.browser.snackbar.SnackbarManager;
import org.chromium.chrome.browser.snackbar.SnackbarManager.SnackbarManageable;
@@ -37,6 +38,16 @@ public class SearchActivity extends AsyncInitializationActivity
/** Setting this field causes the Activity to finish itself immediately for tests. */
private static boolean sIsDisabledForTest;
+ /** Run when the SearchActivity knows what info it needs to display to the user. */
+ private final Runnable mSearchEngineAvailableRunnable = new Runnable() {
+ @Override
+ public void run() {
+ AutocompleteController.nativePrefetchZeroSuggestResults();
+ CustomTabsConnection.getInstance(getApplication()).warmup(0);
Ted C 2017/04/26 20:21:52 wha?
gone 2017/04/26 21:45:15 /me shrugs. It was already there. It's been push
+ mSearchBox.onDeferredStartup(isVoiceSearchIntent());
+ }
+ };
+
/** Main content view. */
private ViewGroup mContentView;
@@ -89,6 +100,10 @@ public class SearchActivity extends AsyncInitializationActivity
setContentView(mContentView);
// Kick off everything needed for the user to type into the box.
+ // TODO(dfalcantara): We should prevent the user from doing anything while we're running the
+ // logic to determine if they need to see a search engine promo. Given
+ // that the logic requires native to be loaded, we'll have to make some
+ // easy Java-only first-pass checks.
beginQuery();
mSearchBox.showCachedZeroSuggestResultsIfAvailable();
@@ -130,9 +145,11 @@ public class SearchActivity extends AsyncInitializationActivity
public void onDeferredStartup() {
super.onDeferredStartup();
- AutocompleteController.nativePrefetchZeroSuggestResults();
- CustomTabsConnection.getInstance(getApplication()).warmup(0);
- mSearchBox.onDeferredStartup(isVoiceSearchIntent());
+ // Force the user to choose a search engine if they have to.
+ if (!LocaleManager.getInstance().showSearchEnginePromoIfNeeded(
+ this, mSearchEngineAvailableRunnable)) {
+ mSearchEngineAvailableRunnable.run();
+ }
}
@Override

Powered by Google App Engine
This is Rietveld 408576698