Commit 5aa0ecd0 authored by Matt Jones's avatar Matt Jones Committed by Commit Bot

Ensure scrim was shown prior to hiding

This patch adds a flag to the ToolbarManager to check whether the
scrim was actually shown since the timing of the show request can
vary.

Bug: 1065480
Change-Id: I254d1425c58bfe05ae97a609097a2e75b6908933
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2129847Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Commit-Queue: Matthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754962}
parent daa6b810
......@@ -299,6 +299,9 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
/** The params used to control how the scrim behaves when shown for the omnibox. */
private PropertyModel mScrimModel;
/** Whether the scrim was shown on focus. */
private boolean mScrimShown;
/** The light color to use for the scrim on the NTP. */
private int mLightScrimColor;
......@@ -353,8 +356,10 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
if (hasFocus && !showScrimAfterAnimationCompletes()) {
mScrimCoordinator.showScrim(mScrimModel);
} else if (!hasFocus) {
mScrimShown = true;
} else if (!hasFocus && mScrimShown) {
mScrimCoordinator.hideScrim(true);
mScrimShown = false;
}
}
......@@ -362,6 +367,7 @@ public class ToolbarManager implements ToolbarTabController, UrlFocusChangeListe
public void onUrlAnimationFinished(boolean hasFocus) {
if (hasFocus && showScrimAfterAnimationCompletes()) {
mScrimCoordinator.showScrim(mScrimModel);
mScrimShown = true;
}
}
......
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