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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java

Issue 2839253002: ❄ Introduce header and footer logic to search engine promos (Closed)
Patch Set: 🔍 Introduce header and footer logic to search engine promos 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/locale/LocaleManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java b/chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java
index 8a3b246393261a907c1314bbf108010fe2192804..ba033bff8b4431c2d7b12a5a75338e90ec92946a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/locale/LocaleManager.java
@@ -8,6 +8,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.annotation.IntDef;
+import android.support.annotation.Nullable;
import org.chromium.base.ContextUtils;
import org.chromium.base.ThreadUtils;
@@ -176,16 +177,26 @@ public class LocaleManager {
* Shows a promotion dialog about search engines depending on Locale and other conditions.
* See {@link LocaleManager#getSearchEnginePromoShowType()} for possible types and logic.
*
+ * @param context Context showing the dialog.
+ * @param onDismissed Run when the dialog has been dismissed.
* @return Whether such dialog is needed.
*/
- public boolean showSearchEnginePromoIfNeeded(Context context) {
+ public boolean showSearchEnginePromoIfNeeded(Context context, @Nullable Runnable onDismissed) {
int shouldShow = getSearchEnginePromoShowType();
-
- if (shouldShow == SEARCH_ENGINE_PROMO_SHOW_SOGOU) {
- new SogouPromoDialog(context, this).show();
- return true;
+ switch (shouldShow) {
+ case SEARCH_ENGINE_PROMO_DONT_SHOW:
+ return false;
+ case SEARCH_ENGINE_PROMO_SHOW_SOGOU:
+ new SogouPromoDialog(context, this, onDismissed).show();
+ return true;
+ case SEARCH_ENGINE_PROMO_SHOW_EXISTING:
+ case SEARCH_ENGINE_PROMO_SHOW_NEW:
+ // TODO(dfalcantara): Show the search engine dialog.
+ return false;
+ default:
+ assert false;
+ return false;
}
- return false;
}
/**

Powered by Google App Engine
This is Rietveld 408576698