| Index: chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuHandler.java
|
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuHandler.java
|
| index 3752485e7c26e672950bd4aaba524f66d6669256..e3359e5292f4344dc3c67ee5e5ef906ddff0327c 100644
|
| --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuHandler.java
|
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/ContextMenuHandler.java
|
| @@ -5,6 +5,7 @@
|
| package org.chromium.chrome.browser.ntp;
|
|
|
| import android.support.annotation.IntDef;
|
| +import android.support.annotation.Nullable;
|
| import android.support.v4.view.ViewCompat;
|
| import android.view.ContextMenu;
|
| import android.view.Menu;
|
| @@ -15,6 +16,8 @@
|
| import org.chromium.base.Callback;
|
| import org.chromium.chrome.R;
|
| import org.chromium.chrome.browser.ntp.NewTabPageView.NewTabPageManager;
|
| +import org.chromium.chrome.browser.ntp.snippets.SnippetsConfig;
|
| +import org.chromium.chrome.browser.offlinepages.OfflinePageBridge;
|
| import org.chromium.ui.mojom.WindowOpenDisposition;
|
|
|
| import java.lang.annotation.Retention;
|
| @@ -46,8 +49,9 @@
|
| /** Removed the current item. */
|
| void removeItem();
|
|
|
| - /** @return whether the current item can be saved offline. */
|
| - boolean canBeSavedOffline();
|
| + /** @return the url for the the current item, or {@code null} if not applicable. */
|
| + @Nullable
|
| + String getUrl();
|
| }
|
|
|
| /** Interface for a view that can be set to stop responding to touches. */
|
| @@ -72,8 +76,11 @@ public boolean showItem(@ContextMenuItemId int itemId) {
|
| return true;
|
| case ID_OPEN_IN_INCOGNITO_TAB:
|
| return mManager.isOpenInIncognitoEnabled();
|
| - case ID_SAVE_FOR_OFFLINE:
|
| - return mDelegate.canBeSavedOffline();
|
| + case ID_SAVE_FOR_OFFLINE: {
|
| + if (!SnippetsConfig.isSaveToOfflineEnabled()) return false;
|
| + String itemUrl = mDelegate.getUrl();
|
| + return itemUrl != null && OfflinePageBridge.canSavePage(itemUrl);
|
| + }
|
| case ID_REMOVE:
|
| return true;
|
|
|
|
|