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

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

Issue 2614753002: 📰 Check we are on the NTP after dismissal animation. (Closed)
Patch Set: Created 3 years, 11 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/cards/NewTabPageRecyclerView.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 fda2dde2e44a70f861edf9433745d4a84ba75af1..79910e5857edb491729a8f3a898764bae5f45968 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
@@ -7,7 +7,6 @@
import android.app.Activity;
import android.support.annotation.IntDef;
import android.support.annotation.StringRes;
-import android.support.v13.view.ViewCompat;
import android.view.ContextMenu;
import android.view.Menu;
import android.view.MenuItem;
@@ -81,7 +80,7 @@ public ContextMenuManager(
* are tapped.
*/
public void createContextMenu(ContextMenu menu, View associatedView, Delegate delegate) {
- OnMenuItemClickListener listener = new ItemClickListener(delegate, associatedView);
+ OnMenuItemClickListener listener = new ItemClickListener(delegate);
boolean hasItems = false;
for (@ContextMenuItemId int itemId : MenuItemLabelMatcher.STRING_MAP.keySet()) {
@@ -168,23 +167,13 @@ private boolean shouldShowItem(@ContextMenuItemId int itemId, Delegate delegate)
private static class ItemClickListener implements OnMenuItemClickListener {
private final Delegate mDelegate;
- private final View mAssociatedView;
- ItemClickListener(Delegate delegate, View associatedView) {
+ ItemClickListener(Delegate delegate) {
mDelegate = delegate;
- mAssociatedView = associatedView;
}
@Override
public boolean onMenuItemClick(MenuItem item) {
- // If the user clicks a snippet then immediately long presses they will create a context
- // menu while the snippet's URL loads in the background. This means that when they press
- // an item on context menu the NTP will not actually be open. We add this check here to
- // prevent taking any action if the user has left the NTP. (https://crbug.com/640468)
- // Although the menu is supposed to be closed when we navigate away from the NTP, we
- // have to keep this check because of race conditions. (https://crbug.com/668945)
- if (!ViewCompat.isAttachedToWindow(mAssociatedView)) return true;
-
switch (item.getItemId()) {
case ID_OPEN_IN_NEW_WINDOW:
mDelegate.openItem(WindowOpenDisposition.NEW_WINDOW);
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/ntp/cards/NewTabPageRecyclerView.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698