Commit b5fff4e4 authored by Theresa Wellington's avatar Theresa Wellington Committed by Commit Bot

Remove ImmersiveModeManager and related code.

BUG=949819

Change-Id: I09e3546e3e14f469e3a68fcddfd840ec3fd76e8e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2140928Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Theresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#758248}
parent aca5dba6
...@@ -1753,7 +1753,6 @@ chrome_java_sources = [ ...@@ -1753,7 +1753,6 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/translate/TranslateUtils.java", "java/src/org/chromium/chrome/browser/translate/TranslateUtils.java",
"java/src/org/chromium/chrome/browser/ui/BottomContainer.java", "java/src/org/chromium/chrome/browser/ui/BottomContainer.java",
"java/src/org/chromium/chrome/browser/ui/BottomSheetManager.java", "java/src/org/chromium/chrome/browser/ui/BottomSheetManager.java",
"java/src/org/chromium/chrome/browser/ui/ImmersiveModeManager.java",
"java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java", "java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java",
"java/src/org/chromium/chrome/browser/ui/TabObscuringHandler.java", "java/src/org/chromium/chrome/browser/ui/TabObscuringHandler.java",
"java/src/org/chromium/chrome/browser/ui/system/StatusBarColorController.java", "java/src/org/chromium/chrome/browser/ui/system/StatusBarColorController.java",
......
...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser; ...@@ -6,7 +6,6 @@ package org.chromium.chrome.browser;
import android.content.pm.PackageInfo; import android.content.pm.PackageInfo;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.view.View;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting; import androidx.annotation.VisibleForTesting;
...@@ -46,7 +45,6 @@ import org.chromium.chrome.browser.signin.GoogleActivityController; ...@@ -46,7 +45,6 @@ import org.chromium.chrome.browser.signin.GoogleActivityController;
import org.chromium.chrome.browser.survey.SurveyController; import org.chromium.chrome.browser.survey.SurveyController;
import org.chromium.chrome.browser.sync.TrustedVaultClient; import org.chromium.chrome.browser.sync.TrustedVaultClient;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.chrome.browser.usage_stats.DigitalWellbeingClient; import org.chromium.chrome.browser.usage_stats.DigitalWellbeingClient;
import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate; import org.chromium.chrome.browser.webapps.GooglePlayWebApkInstallDelegate;
import org.chromium.chrome.browser.webauth.Fido2ApiHandler; import org.chromium.chrome.browser.webauth.Fido2ApiHandler;
...@@ -360,14 +358,6 @@ public abstract class AppHooks { ...@@ -360,14 +358,6 @@ public abstract class AppHooks {
return ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED; return ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED;
} }
/**
* @param contentView The root content view for the containing activity.
* @return A new {@link ImmersiveModeManager} or null if there isn't one.
*/
public @Nullable ImmersiveModeManager createImmersiveModeManager(View contentView) {
return null;
}
/** /**
* Returns a new {@link TrustedVaultClient.Backend} instance. * Returns a new {@link TrustedVaultClient.Backend} instance.
*/ */
......
...@@ -9,7 +9,6 @@ import android.annotation.TargetApi; ...@@ -9,7 +9,6 @@ import android.annotation.TargetApi;
import android.content.res.Resources; import android.content.res.Resources;
import android.graphics.Color; import android.graphics.Color;
import android.os.Build; import android.os.Build;
import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
...@@ -29,7 +28,6 @@ import org.chromium.chrome.browser.tabmodel.TabModel; ...@@ -29,7 +28,6 @@ import org.chromium.chrome.browser.tabmodel.TabModel;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver; import org.chromium.chrome.browser.tabmodel.TabModelSelectorObserver;
import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities; import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.chrome.browser.vr.VrModuleProvider; import org.chromium.chrome.browser.vr.VrModuleProvider;
import org.chromium.ui.UiUtils; import org.chromium.ui.UiUtils;
import org.chromium.ui.vr.VrModeObserver; import org.chromium.ui.vr.VrModeObserver;
...@@ -59,12 +57,10 @@ class TabbedNavigationBarColorController implements VrModeObserver { ...@@ -59,12 +57,10 @@ class TabbedNavigationBarColorController implements VrModeObserver {
* @param window The {@link Window} this controller should operate on. * @param window The {@link Window} this controller should operate on.
* @param tabModelSelector The {@link TabModelSelector} used to determine which tab model is * @param tabModelSelector The {@link TabModelSelector} used to determine which tab model is
* selected. * selected.
* @param immersiveModeManager The {@link ImmersiveModeManager} for the containing activity.
* @param overviewModeBehaviorSupplier An {@link ObservableSupplier} for the * @param overviewModeBehaviorSupplier An {@link ObservableSupplier} for the
* {@link OverviewModeBehavior} associated with the containing activity. * {@link OverviewModeBehavior} associated with the containing activity.
*/ */
TabbedNavigationBarColorController(Window window, TabModelSelector tabModelSelector, TabbedNavigationBarColorController(Window window, TabModelSelector tabModelSelector,
@Nullable ImmersiveModeManager immersiveModeManager,
ObservableSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier) { ObservableSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier) {
assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1; assert Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1;
...@@ -72,22 +68,6 @@ class TabbedNavigationBarColorController implements VrModeObserver { ...@@ -72,22 +68,6 @@ class TabbedNavigationBarColorController implements VrModeObserver {
mRootView = (ViewGroup) mWindow.getDecorView().getRootView(); mRootView = (ViewGroup) mWindow.getDecorView().getRootView();
mResources = mRootView.getResources(); mResources = mRootView.getResources();
if (immersiveModeManager != null && immersiveModeManager.isImmersiveModeSupported()) {
// TODO(https://crbug.com/937946): Hook up immersive mode observer.
mTabModelSelector = null;
mTabModelSelectorObserver = null;
window.setNavigationBarColor(Color.TRANSPARENT);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
window.setNavigationBarDividerColor(Color.TRANSPARENT);
}
int visibility =
mRootView.getSystemUiVisibility() & ~View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
mRootView.setSystemUiVisibility(visibility);
return;
}
// If we're not using a light navigation bar, it will always be black so there's no need // If we're not using a light navigation bar, it will always be black so there's no need
// to register observers and manipulate coloring. // to register observers and manipulate coloring.
if (!mResources.getBoolean(R.bool.window_light_navigation_bar)) { if (!mResources.getBoolean(R.bool.window_light_navigation_bar)) {
...@@ -169,7 +149,6 @@ class TabbedNavigationBarColorController implements VrModeObserver { ...@@ -169,7 +149,6 @@ class TabbedNavigationBarColorController implements VrModeObserver {
public void onExitVr() { public void onExitVr() {
// The platform ignores the light navigation bar system UI flag when launching an Activity // The platform ignores the light navigation bar system UI flag when launching an Activity
// in VR mode, so we need to restore it when VR is exited. // in VR mode, so we need to restore it when VR is exited.
// TODO(https://crbug.com/937946): How does this interact with immersive mode?
UiUtils.setNavigationBarIconColor(mRootView, mUseLightNavigation); UiUtils.setNavigationBarIconColor(mRootView, mUseLightNavigation);
} }
......
...@@ -20,7 +20,6 @@ import org.chromium.base.supplier.Supplier; ...@@ -20,7 +20,6 @@ import org.chromium.base.supplier.Supplier;
import org.chromium.base.task.PostTask; import org.chromium.base.task.PostTask;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.ActivityTabProvider; import org.chromium.chrome.browser.ActivityTabProvider;
import org.chromium.chrome.browser.AppHooks;
import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeActivity;
import org.chromium.chrome.browser.compositor.bottombar.ephemeraltab.EphemeralTabCoordinator; import org.chromium.chrome.browser.compositor.bottombar.ephemeraltab.EphemeralTabCoordinator;
import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.compositor.layouts.LayoutManager;
...@@ -44,7 +43,6 @@ import org.chromium.chrome.browser.tab.Tab; ...@@ -44,7 +43,6 @@ import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities; import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.chrome.browser.toolbar.ToolbarButtonInProductHelpController; import org.chromium.chrome.browser.toolbar.ToolbarButtonInProductHelpController;
import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration; import org.chromium.chrome.browser.toolbar.bottom.BottomToolbarConfiguration;
import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.chrome.browser.ui.RootUiCoordinator; import org.chromium.chrome.browser.ui.RootUiCoordinator;
import org.chromium.chrome.browser.ui.appmenu.AppMenuHandler; import org.chromium.chrome.browser.ui.appmenu.AppMenuHandler;
import org.chromium.chrome.browser.ui.tablet.emptybackground.EmptyBackgroundViewWrapper; import org.chromium.chrome.browser.ui.tablet.emptybackground.EmptyBackgroundViewWrapper;
...@@ -62,7 +60,6 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator implements Native ...@@ -62,7 +60,6 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator implements Native
private static final int STATUS_INDICATOR_WAIT_BEFORE_HIDE_DURATION_MS = 2000; private static final int STATUS_INDICATOR_WAIT_BEFORE_HIDE_DURATION_MS = 2000;
private final ObservableSupplierImpl<EphemeralTabCoordinator> mEphemeralTabCoordinatorSupplier; private final ObservableSupplierImpl<EphemeralTabCoordinator> mEphemeralTabCoordinatorSupplier;
private @Nullable ImmersiveModeManager mImmersiveModeManager;
private TabbedSystemUiCoordinator mSystemUiCoordinator; private TabbedSystemUiCoordinator mSystemUiCoordinator;
private @Nullable EmptyBackgroundViewWrapper mEmptyBackgroundViewWrapper; private @Nullable EmptyBackgroundViewWrapper mEmptyBackgroundViewWrapper;
...@@ -94,7 +91,6 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator implements Native ...@@ -94,7 +91,6 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator implements Native
@Override @Override
public void destroy() { public void destroy() {
if (mImmersiveModeManager != null) mImmersiveModeManager.destroy();
if (mSystemUiCoordinator != null) mSystemUiCoordinator.destroy(); if (mSystemUiCoordinator != null) mSystemUiCoordinator.destroy();
if (mEmptyBackgroundViewWrapper != null) mEmptyBackgroundViewWrapper.destroy(); if (mEmptyBackgroundViewWrapper != null) mEmptyBackgroundViewWrapper.destroy();
...@@ -115,15 +111,8 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator implements Native ...@@ -115,15 +111,8 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator implements Native
public void onPostInflationStartup() { public void onPostInflationStartup() {
super.onPostInflationStartup(); super.onPostInflationStartup();
mImmersiveModeManager = AppHooks.get().createImmersiveModeManager(
mActivity.getWindow().getDecorView().findViewById(android.R.id.content));
mSystemUiCoordinator = new TabbedSystemUiCoordinator(mActivity.getWindow(), mSystemUiCoordinator = new TabbedSystemUiCoordinator(mActivity.getWindow(),
mActivity.getTabModelSelector(), mImmersiveModeManager, mActivity.getTabModelSelector(), mActivity.getOverviewModeBehaviorSupplier());
mActivity.getOverviewModeBehaviorSupplier());
if (mImmersiveModeManager != null) {
getToolbarManager().setImmersiveModeManager(mImmersiveModeManager);
}
} }
@Override @Override
......
...@@ -12,7 +12,6 @@ import androidx.annotation.Nullable; ...@@ -12,7 +12,6 @@ import androidx.annotation.Nullable;
import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.ObservableSupplier;
import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior; import org.chromium.chrome.browser.compositor.layouts.OverviewModeBehavior;
import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.tabmodel.TabModelSelector;
import org.chromium.chrome.browser.ui.ImmersiveModeManager;
/** /**
* A UI coordinator that manages the system status bar and bottom navigation bar for * A UI coordinator that manages the system status bar and bottom navigation bar for
...@@ -29,17 +28,15 @@ public class TabbedSystemUiCoordinator { ...@@ -29,17 +28,15 @@ public class TabbedSystemUiCoordinator {
* *
* @param window The {@link Window} associated with the containing activity. * @param window The {@link Window} associated with the containing activity.
* @param tabModelSelector The {@link TabModelSelector} for the containing activity. * @param tabModelSelector The {@link TabModelSelector} for the containing activity.
* @param immersiveModeManager The {@link ImmersiveModeManager} for the containing activity.
* @param overviewModeBehaviorSupplier An {@link ObservableSupplier} for the * @param overviewModeBehaviorSupplier An {@link ObservableSupplier} for the
* {@link OverviewModeBehavior} associated with the containing activity. * {@link OverviewModeBehavior} associated with the containing activity.
*/ */
public TabbedSystemUiCoordinator(Window window, TabModelSelector tabModelSelector, public TabbedSystemUiCoordinator(Window window, TabModelSelector tabModelSelector,
@Nullable ImmersiveModeManager immersiveModeManager,
@Nullable ObservableSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier) { @Nullable ObservableSupplier<OverviewModeBehavior> overviewModeBehaviorSupplier) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
assert overviewModeBehaviorSupplier != null; assert overviewModeBehaviorSupplier != null;
mNavigationBarColorController = new TabbedNavigationBarColorController( mNavigationBarColorController = new TabbedNavigationBarColorController(
window, tabModelSelector, immersiveModeManager, overviewModeBehaviorSupplier); window, tabModelSelector, overviewModeBehaviorSupplier);
} }
} }
......
...@@ -94,7 +94,6 @@ import org.chromium.chrome.browser.toolbar.top.ToolbarControlContainer; ...@@ -94,7 +94,6 @@ import org.chromium.chrome.browser.toolbar.top.ToolbarControlContainer;
import org.chromium.chrome.browser.toolbar.top.ToolbarLayout; import org.chromium.chrome.browser.toolbar.top.ToolbarLayout;
import org.chromium.chrome.browser.toolbar.top.TopToolbarCoordinator; import org.chromium.chrome.browser.toolbar.top.TopToolbarCoordinator;
import org.chromium.chrome.browser.toolbar.top.ViewShiftingActionBarDelegate; import org.chromium.chrome.browser.toolbar.top.ViewShiftingActionBarDelegate;
import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.chrome.browser.ui.TabObscuringHandler; import org.chromium.chrome.browser.ui.TabObscuringHandler;
import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper;
import org.chromium.chrome.browser.ui.appmenu.AppMenuCoordinator; import org.chromium.chrome.browser.ui.appmenu.AppMenuCoordinator;
...@@ -1577,15 +1576,6 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe ...@@ -1577,15 +1576,6 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
} }
} }
/**
* @param immersiveModeManager The {@link ImmersiveModeManager} for the containing activity.
*/
public void setImmersiveModeManager(ImmersiveModeManager immersiveModeManager) {
if (mBottomControlsCoordinator != null) {
mBottomControlsCoordinator.setImmersiveModeManager(immersiveModeManager);
}
}
/** /**
* Reverts any pending edits of the location bar and reset to the page state. This does not * Reverts any pending edits of the location bar and reset to the page state. This does not
* change the focus state of the location bar. * change the focus state of the location bar.
......
...@@ -30,7 +30,6 @@ import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities; ...@@ -30,7 +30,6 @@ import org.chromium.chrome.browser.tasks.tab_management.TabUiFeatureUtilities;
import org.chromium.chrome.browser.toolbar.IncognitoStateProvider; import org.chromium.chrome.browser.toolbar.IncognitoStateProvider;
import org.chromium.chrome.browser.toolbar.TabCountProvider; import org.chromium.chrome.browser.toolbar.TabCountProvider;
import org.chromium.chrome.browser.toolbar.bottom.BottomControlsViewBinder.ViewHolder; import org.chromium.chrome.browser.toolbar.bottom.BottomControlsViewBinder.ViewHolder;
import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper; import org.chromium.chrome.browser.ui.appmenu.AppMenuButtonHelper;
import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModel;
...@@ -91,22 +90,18 @@ public class BottomControlsCoordinator { ...@@ -91,22 +90,18 @@ public class BottomControlsCoordinator {
model, new ViewHolder(root), BottomControlsViewBinder::bind); model, new ViewHolder(root), BottomControlsViewBinder::bind);
int bottomToolbarHeightId; int bottomToolbarHeightId;
int bottomToolbarHeightWithShadowId;
if (BottomToolbarConfiguration.isLabeledBottomToolbarEnabled()) { if (BottomToolbarConfiguration.isLabeledBottomToolbarEnabled()) {
bottomToolbarHeightId = R.dimen.labeled_bottom_toolbar_height; bottomToolbarHeightId = R.dimen.labeled_bottom_toolbar_height;
bottomToolbarHeightWithShadowId = R.dimen.labeled_bottom_toolbar_height_with_shadow;
} else { } else {
bottomToolbarHeightId = R.dimen.bottom_toolbar_height; bottomToolbarHeightId = R.dimen.bottom_toolbar_height;
bottomToolbarHeightWithShadowId = R.dimen.bottom_toolbar_height_with_shadow;
} }
View toolbar = root.findViewById(R.id.bottom_container_slot); View toolbar = root.findViewById(R.id.bottom_container_slot);
ViewGroup.LayoutParams params = toolbar.getLayoutParams(); ViewGroup.LayoutParams params = toolbar.getLayoutParams();
params.height = root.getResources().getDimensionPixelOffset(bottomToolbarHeightId); params.height = root.getResources().getDimensionPixelOffset(bottomToolbarHeightId);
mMediator = new BottomControlsMediator(model, fullscreenManager, mMediator = new BottomControlsMediator(model, fullscreenManager,
root.getResources().getDimensionPixelOffset(bottomToolbarHeightId), root.getResources().getDimensionPixelOffset(bottomToolbarHeightId));
root.getResources().getDimensionPixelOffset(bottomToolbarHeightWithShadowId));
if (TabManagementModuleProvider.getDelegate() != null if (TabManagementModuleProvider.getDelegate() != null
&& TabUiFeatureUtilities.isTabGroupsAndroidEnabled() && TabUiFeatureUtilities.isTabGroupsAndroidEnabled()
...@@ -127,13 +122,6 @@ public class BottomControlsCoordinator { ...@@ -127,13 +122,6 @@ public class BottomControlsCoordinator {
: R.dimen.bottom_toolbar_height)); : R.dimen.bottom_toolbar_height));
} }
/**
* @param immersiveModeManager The {@link ImmersiveModeManager} for the containing activity.
*/
public void setImmersiveModeManager(ImmersiveModeManager immersiveModeManager) {
mMediator.setImmersiveModeManager(immersiveModeManager);
}
/** /**
* Initialize the bottom controls with the components that had native initialization * Initialize the bottom controls with the components that had native initialization
* dependencies. * dependencies.
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
package org.chromium.chrome.browser.toolbar.bottom; package org.chromium.chrome.browser.toolbar.bottom;
import androidx.annotation.Nullable;
import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager; import org.chromium.chrome.browser.compositor.bottombar.OverlayPanelManager;
import org.chromium.chrome.browser.compositor.layouts.Layout; import org.chromium.chrome.browser.compositor.layouts.Layout;
import org.chromium.chrome.browser.compositor.layouts.LayoutManager; import org.chromium.chrome.browser.compositor.layouts.LayoutManager;
...@@ -13,7 +11,6 @@ import org.chromium.chrome.browser.compositor.layouts.SceneChangeObserver; ...@@ -13,7 +11,6 @@ import org.chromium.chrome.browser.compositor.layouts.SceneChangeObserver;
import org.chromium.chrome.browser.compositor.layouts.ToolbarSwipeLayout; import org.chromium.chrome.browser.compositor.layouts.ToolbarSwipeLayout;
import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandler; import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandler;
import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager; import org.chromium.chrome.browser.fullscreen.ChromeFullscreenManager;
import org.chromium.chrome.browser.ui.ImmersiveModeManager;
import org.chromium.ui.KeyboardVisibilityDelegate; import org.chromium.ui.KeyboardVisibilityDelegate;
import org.chromium.ui.base.WindowAndroid; import org.chromium.ui.base.WindowAndroid;
import org.chromium.ui.modelutil.PropertyModel; import org.chromium.ui.modelutil.PropertyModel;
...@@ -27,8 +24,7 @@ import org.chromium.ui.resources.ResourceManager; ...@@ -27,8 +24,7 @@ import org.chromium.ui.resources.ResourceManager;
class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListener, class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListener,
KeyboardVisibilityDelegate.KeyboardVisibilityListener, KeyboardVisibilityDelegate.KeyboardVisibilityListener,
SceneChangeObserver, SceneChangeObserver,
OverlayPanelManager.OverlayPanelManagerObserver, OverlayPanelManager.OverlayPanelManagerObserver {
ImmersiveModeManager.ImmersiveModeObserver {
/** The model for the bottom controls component that holds all of its view state. */ /** The model for the bottom controls component that holds all of its view state. */
private final PropertyModel mModel; private final PropertyModel mModel;
...@@ -36,23 +32,10 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen ...@@ -36,23 +32,10 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen
private final ChromeFullscreenManager mFullscreenManager; private final ChromeFullscreenManager mFullscreenManager;
/** /**
* The height of the bottom bar in pixels including any adjustments for immersive mode, but not * The height of the bottom bar in pixels, not including the top shadow.
* including the top shadow.
*/ */
private int mBottomControlsHeight; private int mBottomControlsHeight;
/**
* The base height of the bottom bar in pixels not including adjustments for immersive mode or
* the top shadow.
*/
private final int mBottomControlsBaseHeight;
/**
* The height of the bottom bar container (which includes the top shadow) in pixels not
* including any offset for immersive mode.
*/
private final int mBottomControlsContainerBaseHeight;
/** A {@link WindowAndroid} for watching keyboard visibility events. */ /** A {@link WindowAndroid} for watching keyboard visibility events. */
private WindowAndroid mWindowAndroid; private WindowAndroid mWindowAndroid;
...@@ -68,9 +51,6 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen ...@@ -68,9 +51,6 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen
/** Whether the soft keyboard is visible. */ /** Whether the soft keyboard is visible. */
private boolean mIsKeyboardVisible; private boolean mIsKeyboardVisible;
/** The {@link ImmersiveModeManager} for the containing activity.*/
private @Nullable ImmersiveModeManager mImmersiveModeManager;
/** /**
* Build a new mediator that handles events from outside the bottom controls component. * Build a new mediator that handles events from outside the bottom controls component.
* @param model The {@link BottomControlsProperties} that holds all the view state for the * @param model The {@link BottomControlsProperties} that holds all the view state for the
...@@ -78,20 +58,15 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen ...@@ -78,20 +58,15 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen
* @param fullscreenManager A {@link ChromeFullscreenManager} for events related to the browser * @param fullscreenManager A {@link ChromeFullscreenManager} for events related to the browser
* controls. * controls.
* @param bottomControlsHeight The height of the bottom bar in pixels. * @param bottomControlsHeight The height of the bottom bar in pixels.
* @param bottomControlsContainerHeight The height of the bottom bar container in px. This
* should be the height of {@code bottomControlsHeight}
* plus the height of the top shadow.
*/ */
BottomControlsMediator(PropertyModel model, ChromeFullscreenManager fullscreenManager, BottomControlsMediator(PropertyModel model, ChromeFullscreenManager fullscreenManager,
int bottomControlsHeight, int bottomControlsContainerHeight) { int bottomControlsHeight) {
mModel = model; mModel = model;
mFullscreenManager = fullscreenManager; mFullscreenManager = fullscreenManager;
mFullscreenManager.addListener(this); mFullscreenManager.addListener(this);
mBottomControlsBaseHeight = bottomControlsHeight; mBottomControlsHeight = bottomControlsHeight;
mBottomControlsHeight = mBottomControlsBaseHeight;
mBottomControlsContainerBaseHeight = bottomControlsContainerHeight;
} }
/** /**
...@@ -128,20 +103,6 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen ...@@ -128,20 +103,6 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen
updateAndroidViewVisibility(); updateAndroidViewVisibility();
} }
/**
* @param immersiveModeManager The {@link ImmersiveModeManager} for the containing activity.
*/
void setImmersiveModeManager(ImmersiveModeManager immersiveModeManager) {
if (!immersiveModeManager.isImmersiveModeSupported()) return;
mImmersiveModeManager = immersiveModeManager;
mImmersiveModeManager.addObserver(this);
if (mImmersiveModeManager.getBottomUiInsetPx() != 0) {
onBottomUiInsetChanged(mImmersiveModeManager.getBottomUiInsetPx());
}
}
/** /**
* Clean up anything that needs to be when the bottom controls component is destroyed. * Clean up anything that needs to be when the bottom controls component is destroyed.
*/ */
...@@ -156,8 +117,6 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen ...@@ -156,8 +117,6 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen
manager.getOverlayPanelManager().removeObserver(this); manager.getOverlayPanelManager().removeObserver(this);
manager.removeSceneChangeObserver(this); manager.removeSceneChangeObserver(this);
} }
if (mImmersiveModeManager != null) mImmersiveModeManager.removeObserver(this);
} }
@Override @Override
...@@ -238,17 +197,4 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen ...@@ -238,17 +197,4 @@ class BottomControlsMediator implements ChromeFullscreenManager.FullscreenListen
&& !mIsInSwipeLayout && mFullscreenManager.getBottomControlOffset() == 0 && !mIsInSwipeLayout && mFullscreenManager.getBottomControlOffset() == 0
&& !isInFullscreenMode()); && !isInFullscreenMode());
} }
@Override
public void onImmersiveModeChanged(boolean inImmersiveMode) {}
@Override
public void onBottomUiInsetChanged(int bottomUiInsetPx) {
mBottomControlsHeight = mBottomControlsBaseHeight + bottomUiInsetPx;
mModel.set(BottomControlsProperties.BOTTOM_CONTROLS_HEIGHT_PX, mBottomControlsHeight);
mModel.set(BottomControlsProperties.BOTTOM_CONTROLS_CONTAINER_HEIGHT_PX,
mBottomControlsContainerBaseHeight + bottomUiInsetPx);
updateCompositedViewVisibility();
}
} }
\ No newline at end of file
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.ui;
/**
* Manages drawing an immersive UI mode. The lifecycle of the immersive mode manager is tied
* to the activity. There is exactly one per activity and once created it lives until the activity
* is destroyed.
*/
public interface ImmersiveModeManager {
/**
* An observer to be notified about changes related to immersive UI mode.
*/
interface ImmersiveModeObserver {
/**
* Called when entering or exiting immersive mode.
* @param inImmersiveMode Whether the UI is currently in immersive mode.
*/
void onImmersiveModeChanged(boolean inImmersiveMode);
/**
* Called when the inset to apply to bottom anchored UI elements changes.
* @param bottomUiInsetPx The inset to apply in pixels.
*/
void onBottomUiInsetChanged(int bottomUiInsetPx);
}
/**
* @return Whether immersive UI mode is supported. If not supported, observers may still be
* registered, but they will never be called.
*/
boolean isImmersiveModeSupported();
/**
* @return The inset to apply to bottom anchored UI elements in pixels.
*/
default int getBottomUiInsetPx() {
return 0;
}
/**
* Add an observer to be notified of changes related to immersive UI mode.
* @param observer The observer to add.
*/
void addObserver(ImmersiveModeObserver observer);
/**
* Remove a previously registered observer.
* @param observer The observer to remove.
*/
void removeObserver(ImmersiveModeObserver observer);
/**
* Called when the containing activity is destroyed to clean up state.
*/
void destroy();
}
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