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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java

Issue 2810713002: 🏡 Disable BottomSheet touches while context menu is open. (Closed)
Patch Set: Add some comments. Created 3 years, 8 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 | chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java » ('j') | 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/ntp/ContextMenuManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java
index bdda0f543705d7b25470560ef6e2574b5f8a07fc..b3d078b387df8e40d788beedc8de93c0e1cbb58f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuManager.java
@@ -43,7 +43,7 @@ public class ContextMenuManager implements OnCloseContextMenuListener {
private final Activity mActivity;
private final SuggestionsNavigationDelegate mNavigationDelegate;
- private final TouchDisableableView mOuterView;
+ private final TouchEnabledDelegate mTouchEnabledDelegate;
private boolean mContextMenuOpen;
/** Defines callback to configure the context menu and respond to user interaction. */
@@ -67,14 +67,17 @@ public class ContextMenuManager implements OnCloseContextMenuListener {
void onContextMenuCreated();
}
- /** Interface for a view that can be set to stop responding to touches. */
- public interface TouchDisableableView { void setTouchEnabled(boolean enabled); }
+ /**
+ * Delegate used by the {@link ContextMenuManager} to disable touch events on the outer view
+ * while the context menu is open.
+ */
+ public interface TouchEnabledDelegate { void setTouchEnabled(boolean enabled); }
public ContextMenuManager(Activity activity, SuggestionsNavigationDelegate navigationDelegate,
- TouchDisableableView outerView) {
+ TouchEnabledDelegate touchEnabledDelegate) {
mActivity = activity;
mNavigationDelegate = navigationDelegate;
- mOuterView = outerView;
+ mTouchEnabledDelegate = touchEnabledDelegate;
}
/**
@@ -114,18 +117,18 @@ public class ContextMenuManager implements OnCloseContextMenuListener {
}
});
- // Disable touch events on the outer view while the context menu is open. This is to
- // prevent the user long pressing to get the context menu then on the same press scrolling
- // or swiping to dismiss an item (eg. https://crbug.com/638854, https://crbug.com/638555,
- // https://crbug.com/636296)
- mOuterView.setTouchEnabled(false);
+ // Touch events must be disabled on the outer view while the context menu is open. This is
+ // to prevent the user long pressing to get the context menu then on the same press
+ // scrolling or swiping to dismiss an item (eg. https://crbug.com/638854,
+ // https://crbug.com/638555, https://crbug.com/636296).
+ mTouchEnabledDelegate.setTouchEnabled(false);
mContextMenuOpen = true;
}
@Override
public void onContextMenuClosed() {
if (!mContextMenuOpen) return;
- mOuterView.setTouchEnabled(true);
+ mTouchEnabledDelegate.setTouchEnabled(true);
mContextMenuOpen = false;
}
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPageView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698