| 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;
|
| }
|
|
|
|
|