Commit 2749f796 authored by Colin Blundell's avatar Colin Blundell Committed by Commit Bot

[WebLayer] Reuse componentized InfoBarContainerLayout

//chrome's InfoBarContainerLayout.java has now been componentized and
WebLayer can reuse it. As part of that componentization, the
InfoBarAnimationListener interface was pulled out of //chrome's
InfoBarContainer.java to live in a standalone //components-level file.
This CL changes WebLayer to use the componentized
InfoBarContainerLayout and the componentized InfoBarAnimationListener
on which the former depends. There are no behavioral changes, as none
of the code being deleted was changed from the now-componentized
//chrome versions.

Bug: 1099169
Change-Id: Ic443dc5cd266da1add574e85caf100a809111e2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2275895
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: default avatarClark DuVall <cduvall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784365}
parent 5c6fac42
......@@ -93,7 +93,6 @@ android_library("java") {
"org/chromium/weblayer_private/FragmentWindowAndroid.java",
"org/chromium/weblayer_private/FullscreenCallbackProxy.java",
"org/chromium/weblayer_private/InfoBarContainer.java",
"org/chromium/weblayer_private/InfoBarContainerLayout.java",
"org/chromium/weblayer_private/InfoBarContainerView.java",
"org/chromium/weblayer_private/IntentUtils.java",
"org/chromium/weblayer_private/InterceptNavigationDelegateClientImpl.java",
......
......@@ -17,6 +17,7 @@ import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.chrome.browser.infobar.InfoBarIdentifier;
import org.chromium.components.infobars.InfoBar;
import org.chromium.components.infobars.InfoBarAnimationListener;
import org.chromium.components.infobars.InfoBarUiItem;
import org.chromium.content_public.browser.NavigationHandle;
import org.chromium.content_public.browser.WebContents;
......@@ -50,26 +51,6 @@ public class InfoBarContainer implements KeyboardVisibilityListener, InfoBar.Con
sAccessibilityObserver = (enabled) -> setIsAllowedToAutoHide(!enabled);
}
/**
* A listener for the InfoBar animations.
*/
public interface InfoBarAnimationListener {
public static final int ANIMATION_TYPE_SHOW = 0;
public static final int ANIMATION_TYPE_SWAP = 1;
public static final int ANIMATION_TYPE_HIDE = 2;
/**
* Notifies the subscriber when an animation is completed.
*/
void notifyAnimationFinished(int animationType);
/**
* Notifies the subscriber when all animations are finished.
* @param frontInfoBar The frontmost infobar or {@code null} if none are showing.
*/
void notifyAllAnimationsFinished(InfoBarUiItem frontInfoBar);
}
/**
* An observer that is notified of changes to a {@link InfoBarContainer} object.
*/
......
......@@ -19,6 +19,8 @@ import androidx.annotation.VisibleForTesting;
import org.chromium.base.MathUtils;
import org.chromium.components.browser_ui.banners.SwipableOverlayView;
import org.chromium.components.infobars.InfoBar;
import org.chromium.components.infobars.InfoBarAnimationListener;
import org.chromium.components.infobars.InfoBarContainerLayout;
import org.chromium.components.infobars.InfoBarUiItem;
import org.chromium.ui.display.DisplayAndroid;
import org.chromium.ui.display.DisplayUtil;
......@@ -30,7 +32,7 @@ public class InfoBarContainerView extends SwipableOverlayView {
/**
* Observes container view changes.
*/
public interface ContainerViewObserver extends InfoBarContainer.InfoBarAnimationListener {
public interface ContainerViewObserver extends InfoBarAnimationListener {
/**
* Called when the height of shown content changed.
* @param shownFraction The ratio of height of shown content to the height of the container
......@@ -85,8 +87,8 @@ public class InfoBarContainerView extends SwipableOverlayView {
updateLayoutParams(context, isTablet);
Runnable makeContainerVisibleRunnable = () -> runUpEventAnimation(true);
mLayout = new InfoBarContainerLayout(context, makeContainerVisibleRunnable,
new InfoBarContainer.InfoBarAnimationListener() {
mLayout = new InfoBarContainerLayout(
context, makeContainerVisibleRunnable, new InfoBarAnimationListener() {
@Override
public void notifyAnimationFinished(int animationType) {
mContainerViewObserver.notifyAnimationFinished(animationType);
......
......@@ -9,6 +9,7 @@ import android.os.IBinder;
import org.chromium.base.annotations.JNINamespace;
import org.chromium.base.annotations.NativeMethods;
import org.chromium.base.annotations.UsedByReflection;
import org.chromium.components.infobars.InfoBarAnimationListener;
import org.chromium.components.infobars.InfoBarUiItem;
import org.chromium.components.location.LocationUtils;
import org.chromium.components.permissions.PermissionDialogController;
......@@ -116,7 +117,7 @@ public final class TestWebLayerImpl extends ITestWebLayer.Stub {
TabImpl tabImpl = (TabImpl) tab;
InfoBarContainer infoBarContainer = tabImpl.getInfoBarContainerForTesting();
infoBarContainer.addAnimationListener(new InfoBarContainer.InfoBarAnimationListener() {
infoBarContainer.addAnimationListener(new InfoBarAnimationListener() {
@Override
public void notifyAnimationFinished(int animationType) {}
@Override
......
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