Commit 84f58537 authored by Matt Jones's avatar Matt Jones Committed by Commit Bot

Add getter for display position to SceneOverlay

This patch adds the concept of display priority to SceneOverlays but
does not yet use them. The new method on the interface will determine
the layering of the overlays, removing the need for the various
case-specific "add overlay" methods.

Bug: 1070281
Change-Id: I518f0324fb154a78bc47f01c6256d9fc3abd0c17
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2354529Reviewed-by: default avatarJinsuk Kim <jinsukkim@chromium.org>
Reviewed-by: default avatarMei Liang <meiliang@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806353}
parent 9dd88801
......@@ -961,4 +961,9 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
closePanel(StateChangeReason.BACK_PRESS, true);
return true;
}
@Override
public int getPosition() {
return Position.FRONT;
}
}
......@@ -6,18 +6,36 @@ package org.chromium.chrome.browser.compositor.overlays;
import android.graphics.RectF;
import androidx.annotation.IntDef;
import org.chromium.chrome.browser.compositor.LayerTitleCache;
import org.chromium.chrome.browser.compositor.layouts.components.VirtualView;
import org.chromium.chrome.browser.compositor.layouts.eventfilter.EventFilter;
import org.chromium.chrome.browser.compositor.scene_layer.SceneOverlayLayer;
import org.chromium.ui.resources.ResourceManager;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.List;
/**
* An interface which positions the actual tabs and adds additional UI to the them.
*/
public interface SceneOverlay {
/** Positioning information for when overlays are added to the tree. */
@IntDef({Position.FRONT, Position.DEFAULT, Position.BACK})
@Retention(RetentionPolicy.SOURCE)
@interface Position {
/** The overlay will be one the of front-most layers. */
int FRONT = 0;
/** The overlay will be between the front and back layers in the order it was added. */
int DEFAULT = 1;
/** The overlay will be one of the back-most layers. */
int BACK = 2;
}
/**
* Updates and gets a {@link SceneOverlayLayer} that represents an scene overlay.
*
......@@ -81,4 +99,10 @@ public interface SceneOverlay {
* @return True if this overlay handles tab creation.
*/
boolean handlesTabCreating();
/**
* @return Where this overlay should be positioned relative to the other overlays.
*/
@Position
int getPosition();
}
......@@ -507,6 +507,11 @@ public class StripLayoutHelperManager implements SceneOverlay {
return false;
}
@Override
public int getPosition() {
return Position.BACK;
}
private void tabModelSwitched(boolean incognito) {
if (incognito == mIsIncognito) return;
mIsIncognito = incognito;
......
......@@ -111,4 +111,9 @@ public class TopToolbarOverlayCoordinator implements SceneOverlay {
public boolean handlesTabCreating() {
return false;
}
@Override
public int getPosition() {
return Position.BACK;
}
}
......@@ -158,6 +158,11 @@ public class ScrollingBottomViewSceneLayer extends SceneOverlayLayer implements
@Override
public void getVirtualViews(List<VirtualView> views) {}
@Override
public int getPosition() {
return Position.DEFAULT;
}
@NativeMethods
interface Natives {
long init(ScrollingBottomViewSceneLayer caller);
......
......@@ -117,4 +117,9 @@ class OverscrollGlowOverlay extends NavigationGlow implements SceneOverlay {
public boolean handlesTabCreating() {
return false;
}
@Override
public int getPosition() {
return Position.BACK;
}
}
......@@ -121,6 +121,11 @@ class StatusIndicatorSceneLayer extends SceneOverlayLayer implements SceneOverla
@Override
public void getVirtualViews(List<VirtualView> views) {}
@Override
public int getPosition() {
return Position.DEFAULT;
}
@NativeMethods
interface Natives {
long init(StatusIndicatorSceneLayer caller);
......
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