Commit 9437a886 authored by Theresa's avatar Theresa Committed by Commit Bot

Introduce FeatureUtilities#isContextualSuggestionsBottomSheetEnabled

Contextual suggestions should only be enabled for phones and when modern
is enabled. A follow-up CL will also add other relevant checks.

BUG=823987

Change-Id: Iadf323534a03b65fe27b1d8fdc64f625096db334
Reviewed-on: https://chromium-review.googlesource.com/982244
Commit-Queue: Theresa <twellington@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#546234}
parent 337a57b9
...@@ -1249,7 +1249,7 @@ public abstract class ChromeActivity extends AsyncInitializationActivity ...@@ -1249,7 +1249,7 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
VrShellDelegate.onNativeLibraryAvailable(); VrShellDelegate.onNativeLibraryAvailable();
super.finishNativeInitialization(); super.finishNativeInitialization();
if (FeatureUtilities.isChromeDuplexEnabled()) { if (FeatureUtilities.isContextualSuggestionsBottomSheetEnabled()) {
ViewGroup coordinator = (ViewGroup) findViewById(R.id.coordinator); ViewGroup coordinator = (ViewGroup) findViewById(R.id.coordinator);
getLayoutInflater().inflate(R.layout.bottom_sheet, coordinator); getLayoutInflater().inflate(R.layout.bottom_sheet, coordinator);
mBottomSheet = coordinator.findViewById(R.id.bottom_sheet); mBottomSheet = coordinator.findViewById(R.id.bottom_sheet);
...@@ -1262,13 +1262,10 @@ public abstract class ChromeActivity extends AsyncInitializationActivity ...@@ -1262,13 +1262,10 @@ public abstract class ChromeActivity extends AsyncInitializationActivity
mFadingBackgroundView.addObserver(mBottomSheet); mFadingBackgroundView.addObserver(mBottomSheet);
if (ChromeFeatureList.isEnabled(
ChromeFeatureList.CONTEXTUAL_SUGGESTIONS_BOTTOM_SHEET)) {
mContextualSuggestionsCoordinator = new ContextualSuggestionsCoordinator( mContextualSuggestionsCoordinator = new ContextualSuggestionsCoordinator(
this, mBottomSheetController, getTabModelSelector()); this, mBottomSheetController, getTabModelSelector());
} }
} }
}
/** /**
* @return Whether native initialization has been completed for this activity. * @return Whether native initialization has been completed for this activity.
......
...@@ -323,6 +323,15 @@ public class FeatureUtilities { ...@@ -323,6 +323,15 @@ public class FeatureUtilities {
return sIsChromeModernDesignEnabled; return sIsChromeModernDesignEnabled;
} }
/** @return Whether the contextual suggestions bottom sheet is enabled. */
public static boolean isContextualSuggestionsBottomSheetEnabled() {
// TODO(twellington): Also check for enterprise users and users with history sync enabled
// without encryption.
return !DeviceFormFactor.isTablet() && isChromeModernDesignEnabled()
&& ChromeFeatureList.isEnabled(
ChromeFeatureList.CONTEXTUAL_SUGGESTIONS_BOTTOM_SHEET);
}
private static native void nativeSetCustomTabVisible(boolean visible); private static native void nativeSetCustomTabVisible(boolean visible);
private static native void nativeSetIsInMultiWindowMode(boolean isInMultiWindowMode); private static native void nativeSetIsInMultiWindowMode(boolean isInMultiWindowMode);
} }
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