Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2811)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java

Issue 2109823002: Track if a panel is shown in onClosed and peekPanel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
index b2b8d598c6f48b7252f3de23d789c67fdc813f07..b34157c0244179616c4050baa283a3a5794f0335 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java
@@ -121,6 +121,9 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
/** If the panel should be ignoring swipe events (for compatibility mode). */
private boolean mIgnoreSwipeEvents;
+ /** This is used to make sure there is one show request to one close request. */
+ private boolean mPanelShown;
+
// ============================================================================================
// Constructor
// ============================================================================================
@@ -159,6 +162,7 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
@Override
protected void onClosed(StateChangeReason reason) {
+ mPanelShown = false;
setBasePageTextControlsVisibility(true);
destroyComponents();
mPanelManager.notifyPanelClosed(this, reason);
@@ -184,7 +188,8 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
@Override
public void closePanel(StateChangeReason reason, boolean animate) {
- if (!isShowing()) return;
+ // If the panel hasn't peeked, then it shouldn't need to close.
+ if (!mPanelShown) return;
super.closePanel(reason, animate);
}
@@ -194,7 +199,7 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
* @param reason The reason the panel is being shown.
*/
public void requestPanelShow(StateChangeReason reason) {
- if (isShowing()) return;
+ if (mPanelShown) return;
if (mPanelManager != null) {
mPanelManager.requestPanelShow(this, reason);
@@ -205,6 +210,10 @@ public class OverlayPanel extends OverlayPanelAnimation implements ActivityState
public void peekPanel(StateChangeReason reason) {
// TODO(mdjones): This is making a protected API public and should be removed. Animation
// should only be controlled by the OverlayPanelManager.
+
+ // Since the OverlayPanelManager can show panels without requestPanelShow being called, the
+ // flag for the panel being shown should be set to true here.
+ mPanelShown = true;
super.peekPanel(reason);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698