cct: removes ability to disable open-in-chrome menu item in cct
This effectively reverts
https://chromium-review.googlesource.com/c/chromium/src/+/2570238
This was added for an experiment and is no longer needed.
BUG=1145206
TEST=none
Change-Id: Ic329c5e77b1dfbfea5061c25b7570f1ba2278544
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2946446
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#890290}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
index a93439bc..93b93c6 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java
@@ -598,8 +598,7 @@
.second;
if (mMode == ContextMenuMode.WEB_APP) {
items.add(createListItem(Item.OPEN_IN_CHROME));
- } else if (mMode == ContextMenuMode.CUSTOM_TAB
- && mItemDelegate.supportsOpenInChromeFromCct()) {
+ } else if (mMode == ContextMenuMode.CUSTOM_TAB && !mItemDelegate.isIncognito()) {
boolean addNewEntries = !UrlUtilities.isInternalScheme(mParams.getUrl())
&& !isEmptyUrl(mParams.getUrl());
if (SharedPreferencesManager.getInstance().readBoolean(
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/BaseCustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/BaseCustomTabActivity.java
index 79cf4e0..8d0e64e3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/BaseCustomTabActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/BaseCustomTabActivity.java
@@ -352,8 +352,7 @@
mIntentDataProvider.isOpenedByChrome(),
mIntentDataProvider.shouldShowShareMenuItem(),
mIntentDataProvider.shouldShowStarButton(),
- mIntentDataProvider.shouldShowDownloadButton(), mIntentDataProvider.isIncognito(),
- mIntentDataProvider.shouldShowOpenInChromeMenuItem());
+ mIntentDataProvider.shouldShowDownloadButton(), mIntentDataProvider.isIncognito());
}
@Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java
index 4472227..fecde53 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java
@@ -54,7 +54,6 @@
private final boolean mShowDownload;
private final boolean mIsOpenedByChrome;
private final boolean mIsIncognito;
- private final boolean mShowOpenInChrome;
private final List<String> mMenuEntries;
private final Map<MenuItem, Integer> mItemToIndexMap = new HashMap<MenuItem, Integer>();
@@ -63,8 +62,6 @@
/**
* Creates an {@link CustomTabAppMenuPropertiesDelegate} instance.
- *
- * @param showOpenInChrome Whether 'open in chrome' is shown, depending upon other state.
*/
public CustomTabAppMenuPropertiesDelegate(Context context,
ActivityTabProvider activityTabProvider,
@@ -72,8 +69,7 @@
TabModelSelector tabModelSelector, ToolbarManager toolbarManager, View decorView,
ObservableSupplier<BookmarkBridge> bookmarkBridgeSupplier, Verifier verifier,
@CustomTabsUiType final int uiType, List<String> menuEntries, boolean isOpenedByChrome,
- boolean showShare, boolean showStar, boolean showDownload, boolean isIncognito,
- boolean showOpenInChrome) {
+ boolean showShare, boolean showStar, boolean showDownload, boolean isIncognito) {
super(context, activityTabProvider, multiWindowModeStateDispatcher, tabModelSelector,
toolbarManager, decorView, null, bookmarkBridgeSupplier);
mVerifier = verifier;
@@ -84,7 +80,6 @@
mShowStar = showStar;
mShowDownload = showDownload;
mIsIncognito = isIncognito;
- mShowOpenInChrome = showOpenInChrome;
}
@Override
@@ -197,9 +192,6 @@
prepareTranslateMenuItem(menu, currentTab);
- if (!mShowOpenInChrome) {
- openInChromeItemVisible = false;
- }
MenuItem openInChromeItem = menu.findItem(R.id.open_in_browser_id);
if (openInChromeItemVisible) {
String title = mIsIncognito ?
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java
index bdba18be..ac92552 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabDelegateFactory.java
@@ -315,7 +315,6 @@
private final ExternalAuthUtils mExternalAuthUtils;
private final MultiWindowUtils mMultiWindowUtils;
private final Verifier mVerifier;
- private final boolean mShouldShowOpenInChromeMenuItemInContextMenu;
private final ChromeActivityNativeDelegate mChromeActivityNativeDelegate;
private final BrowserControlsStateProvider mBrowserControlsStateProvider;
private final FullscreenManager mFullscreenManager;
@@ -343,7 +342,6 @@
* @param verifier Decides how to handle navigation to a new URL.
* @param ephemeralTabCoordinatorSupplier A provider of {@link EphemeralTabCoordinator} that
* shows preview tab.
- * @param shouldShowOpenInChromeMenuItemInContextMenu Whether 'open in chrome' is shown.
*/
private CustomTabDelegateFactory(ChromeActivity<?> activity, boolean shouldHideBrowserControls,
boolean isOpenedByChrome, @Nullable String webApkScopeUrl,
@@ -351,7 +349,6 @@
BrowserControlsVisibilityDelegate visibilityDelegate, ExternalAuthUtils authUtils,
MultiWindowUtils multiWindowUtils, Verifier verifier,
Lazy<EphemeralTabCoordinator> ephemeralTabCoordinator,
- boolean shouldShowOpenInChromeMenuItemInContextMenu,
ChromeActivityNativeDelegate chromeActivityNativeDelegate,
BrowserControlsStateProvider browserControlsStateProvider,
FullscreenManager fullscreenManager, TabCreatorManager tabCreatorManager,
@@ -370,7 +367,6 @@
mMultiWindowUtils = multiWindowUtils;
mVerifier = verifier;
mEphemeralTabCoordinator = ephemeralTabCoordinator;
- mShouldShowOpenInChromeMenuItemInContextMenu = shouldShowOpenInChromeMenuItemInContextMenu;
mChromeActivityNativeDelegate = chromeActivityNativeDelegate;
mBrowserControlsStateProvider = browserControlsStateProvider;
mFullscreenManager = fullscreenManager;
@@ -397,7 +393,6 @@
getDisplayMode(intentDataProvider),
intentDataProvider.shouldEnableEmbeddedMediaExperience(), visibilityDelegate,
authUtils, multiWindowUtils, verifier, ephemeralTabCoordinator,
- intentDataProvider.shouldShowOpenInChromeMenuItemInContextMenu(),
chromeActivityNativeDelegate, browserControlsStateProvider, fullscreenManager,
tabCreatorManager, tabModelSelectorSupplier, compositorViewHolderSupplier,
modalDialogManagerSupplier);
@@ -410,7 +405,7 @@
static CustomTabDelegateFactory createDummy() {
return new CustomTabDelegateFactory(null, false, false, null, WebDisplayMode.BROWSER, false,
null, null, null, null,
- () -> null, true, null, null, null, null, () -> null, () -> null, () -> null);
+ () -> null, null, null, null, null, () -> null, () -> null, () -> null);
}
@Override
@@ -459,28 +454,19 @@
return new ExternalNavigationHandler(mNavigationDelegate);
}
- @VisibleForTesting
- TabContextMenuItemDelegate createTabContextMenuItemDelegate(Tab tab) {
- TabModelSelector tabModelSelector = mTabModelSelectorSupplier.get();
- final boolean isIncognito = tab.isIncognito();
- return new TabContextMenuItemDelegate(tab, tabModelSelector,
- EphemeralTabCoordinator.isSupported() ? mEphemeralTabCoordinator::get : ()
- -> null,
- () -> {}, mActivity == null ? null : mActivity::getSnackbarManager) {
- @Override
- public boolean supportsOpenInChromeFromCct() {
- return mShouldShowOpenInChromeMenuItemInContextMenu && !isIncognito;
- }
- };
- }
-
@Override
public ContextMenuPopulatorFactory createContextMenuPopulatorFactory(Tab tab) {
@ChromeContextMenuPopulator.ContextMenuMode
int contextMenuMode = getContextMenuMode(mActivityType);
Supplier<ShareDelegate> shareDelegateSupplier =
mActivity == null ? null : mActivity.getShareDelegateSupplier();
- return new ChromeContextMenuPopulatorFactory(createTabContextMenuItemDelegate(tab),
+ TabModelSelector tabModelSelector =
+ mActivity != null ? mActivity.getTabModelSelector() : null;
+ return new ChromeContextMenuPopulatorFactory(
+ new TabContextMenuItemDelegate(tab, tabModelSelector,
+ EphemeralTabCoordinator.isSupported() ? mEphemeralTabCoordinator::get : ()
+ -> null,
+ () -> {}, mActivity == null ? null : mActivity::getSnackbarManager),
shareDelegateSupplier, contextMenuMode, ExternalAuthUtils.getInstance());
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
index 53dbb1d..58b94ea3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java
@@ -160,20 +160,6 @@
"androidx.browser.customtabs.extra.HIDE_OMNIBOX_SUGGESTIONS_FROM_CCT";
/**
- * Extra that determines whether the 'open in chrome' menu item should be shown in the context
- * menu. The value is a boolean. Default value is false, meaning the item is shown.
- */
- public static final String EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU =
- "androidx.browser.customtabs.extra.HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU";
-
- /**
- * Extra that determines whether the 'open in chrome' menu item should be shown in the menu. The
- * value is a boolean. Default value is false, meaning the item is shown.
- */
- public static final String EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM =
- "androidx.browser.customtabs.extra.HIDE_OPEN_IN_CHROME_MENU_ITEM";
-
- /**
* Extra that, if set, results in marking visits from cct as hidden. The value is
* a boolean, and is only considered if the feature kCCTHideVisits is enabled.
*/
@@ -832,23 +818,4 @@
return IntentUtils.safeGetBooleanExtra(mIntent, EXTRA_HIDE_VISITS_FROM_CCT, false);
}
- @Override
- public boolean shouldShowOpenInChromeMenuItemInContextMenu() {
- // Only 1p apps are allowed to hide visits.
- String clientPackageName =
- CustomTabsConnection.getInstance().getClientPackageNameForSession(getSession());
- if (!GSAState.isGsaPackageName(clientPackageName)) return true;
- return !IntentUtils.safeGetBooleanExtra(
- mIntent, EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU, false);
- }
-
- @Override
- public boolean shouldShowOpenInChromeMenuItem() {
- // Only 1p apps are allowed to hide visits.
- String clientPackageName =
- CustomTabsConnection.getInstance().getClientPackageNameForSession(getSession());
- if (!GSAState.isGsaPackageName(clientPackageName)) return true;
- return !IntentUtils.safeGetBooleanExtra(
- mIntent, EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM, false);
- }
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java
index 833ff04..e98b923 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java
@@ -329,15 +329,6 @@
}
}
- /**
- * Returns whether the 'open in chrome' menu item should be shown. This is only called when the
- * context menu is shown in cct.
- */
- @Override
- public boolean supportsOpenInChromeFromCct() {
- return true;
- }
-
@Override
public void onOpenInNewChromeTabFromCCT(GURL linkUrl, boolean isIncognito) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUrl.getSpec()));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java
index 1bb5c8c..b68bbd8 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulatorTest.java
@@ -84,8 +84,6 @@
@Mock
private ChromeContextMenuPopulator mPopulator;
- private boolean mSupportsOpenInChromeFromCct = true;
-
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
@@ -99,8 +97,6 @@
when(mItemDelegate.supportsSendEmailMessage()).thenReturn(true);
when(mItemDelegate.supportsSendTextMessage()).thenReturn(true);
when(mItemDelegate.supportsAddToContacts()).thenReturn(true);
- when(mItemDelegate.supportsOpenInChromeFromCct())
- .thenAnswer((mock) -> mSupportsOpenInChromeFromCct);
HashMap<String, Boolean> features = new HashMap<String, Boolean>();
features.put(ChromeFeatureList.CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS, false);
@@ -201,25 +197,6 @@
@Test
@SmallTest
@UiThreadTest
- public void testShouldShowOpenInChromeMenuItemInContextMenu() {
- FirstRunStatus.setFirstRunFlowComplete(true);
- ContextMenuParams params = new ContextMenuParams(0, 0, new GURL(PAGE_URL),
- new GURL(LINK_URL), LINK_TEXT, GURL.emptyGURL(), GURL.emptyGURL(), "", null, false,
- 0, 0, MenuSourceType.MENU_SOURCE_TOUCH, false);
-
- // If the delegate returns false from supportsOpenInChromeFromCct() then open_in_chrome item
- // should not be present.
- mSupportsOpenInChromeFromCct = false;
- initializePopulator(ChromeContextMenuPopulator.ContextMenuMode.CUSTOM_TAB, params);
- int[] expected = {R.id.contextmenu_open_in_ephemeral_tab,
- R.id.contextmenu_copy_link_address, R.id.contextmenu_copy_link_text,
- R.id.contextmenu_save_link_as, R.id.contextmenu_share_link};
- checkMenuOptions(expected);
- }
-
- @Test
- @SmallTest
- @UiThreadTest
public void testHttpLinkWithPreviewTabEnabled() {
ContextMenuParams params = new ContextMenuParams(0, 0, new GURL(PAGE_URL),
new GURL(LINK_URL), LINK_TEXT, GURL.emptyGURL(), GURL.emptyGURL(), "", null, false,
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityAppMenuTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityAppMenuTest.java
index e10f3d9..8de5274 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityAppMenuTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityAppMenuTest.java
@@ -13,7 +13,6 @@
import android.app.Instrumentation;
import android.app.PendingIntent;
import android.content.ComponentName;
-import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
@@ -27,7 +26,6 @@
import androidx.browser.customtabs.CustomTabsCallback;
import androidx.browser.customtabs.CustomTabsIntent;
import androidx.browser.customtabs.CustomTabsSession;
-import androidx.browser.customtabs.CustomTabsSessionToken;
import androidx.test.filters.SmallTest;
import org.hamcrest.Matchers;
@@ -408,64 +406,4 @@
}, 5000L, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
activity.finish();
}
-
- @Test
- @SmallTest
- public void testHideOpenInChromeMenuItem() throws Exception {
- Context context = InstrumentationRegistry.getInstrumentation()
- .getTargetContext()
- .getApplicationContext();
- Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage);
- intent.setData(Uri.parse(mTestPage));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(CustomTabIntentDataProvider.EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM, true);
- CustomTabsSessionToken token = CustomTabsSessionToken.getSessionTokenFromIntent(intent);
- CustomTabsConnection connection = CustomTabsConnection.getInstance();
- connection.newSession(token);
- connection.overridePackageNameForSessionForTesting(
- token, "com.google.android.googlequicksearchbox");
- mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent);
-
- IntentFilter filter = new IntentFilter(Intent.ACTION_VIEW);
- final Instrumentation.ActivityMonitor monitor =
- InstrumentationRegistry.getInstrumentation().addMonitor(filter, null, false);
- openAppMenuAndAssertMenuShown();
- PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> {
- MenuItem item =
- AppMenuTestSupport.getMenu(mCustomTabActivityTestRule.getAppMenuCoordinator())
- .findItem(R.id.open_in_browser_id);
- // The menu item should be there, but hidden.
- Assert.assertNotNull(item);
- Assert.assertFalse(item.isVisible());
- });
- }
-
- @Test
- @SmallTest
- public void testHideOpenInChromeMenuItemVisibleWithWrongPackage() throws Exception {
- Context context = InstrumentationRegistry.getInstrumentation()
- .getTargetContext()
- .getApplicationContext();
- Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage);
- intent.setData(Uri.parse(mTestPage));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(CustomTabIntentDataProvider.EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM, true);
- CustomTabsSessionToken token = CustomTabsSessionToken.getSessionTokenFromIntent(intent);
- CustomTabsConnection connection = CustomTabsConnection.getInstance();
- connection.newSession(token);
- mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent);
-
- IntentFilter filter = new IntentFilter(Intent.ACTION_VIEW);
- final Instrumentation.ActivityMonitor monitor =
- InstrumentationRegistry.getInstrumentation().addMonitor(filter, null, false);
- openAppMenuAndAssertMenuShown();
- PostTask.runOrPostTask(UiThreadTaskTraits.DEFAULT, () -> {
- MenuItem item =
- AppMenuTestSupport.getMenu(mCustomTabActivityTestRule.getAppMenuCoordinator())
- .findItem(R.id.open_in_browser_id);
- // As the package name doesn't match the expected package, the item should be visible.
- Assert.assertNotNull(item);
- Assert.assertTrue(item.isVisible());
- });
- }
}
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
index 6528eaf..6ee1320b 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabActivityTest.java
@@ -110,7 +110,6 @@
import org.chromium.chrome.browser.profiles.Profile;
import org.chromium.chrome.browser.tab.EmptyTabObserver;
import org.chromium.chrome.browser.tab.Tab;
-import org.chromium.chrome.browser.tab.TabContextMenuItemDelegate;
import org.chromium.chrome.browser.tab.TabCreationState;
import org.chromium.chrome.browser.tab.TabHidingType;
import org.chromium.chrome.browser.tab.TabLaunchType;
@@ -1946,70 +1945,6 @@
.getHideFutureNavigations());
}
- @Test
- @SmallTest
- public void testHideOpenInChromeMenuItemInContextMenu() throws Exception {
- Context context = InstrumentationRegistry.getInstrumentation()
- .getTargetContext()
- .getApplicationContext();
- Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage);
- intent.setData(Uri.parse(mTestPage));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(
- CustomTabIntentDataProvider.EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU,
- true);
- CustomTabsSessionToken token = CustomTabsSessionToken.getSessionTokenFromIntent(intent);
- CustomTabsConnection connection = CustomTabsConnection.getInstance();
- connection.newSession(token);
- connection.overridePackageNameForSessionForTesting(
- token, "com.google.android.googlequicksearchbox");
- mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent);
- TestThreadUtils.runOnUiThreadBlocking(() -> {
- Tab tab = mCustomTabActivityTestRule.getActivity().getActivityTab();
- Assert.assertTrue(tab != null);
- Assert.assertTrue(
- TabTestUtils.getDelegateFactory(tab) instanceof CustomTabDelegateFactory);
- TabContextMenuItemDelegate tabContextMenuItemDelegate =
- ((CustomTabDelegateFactory) TabTestUtils.getDelegateFactory(tab))
- .createTabContextMenuItemDelegate(tab);
- // EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU should be propagated to the
- // tabContextMenuItemDelegate.
- Assert.assertFalse(tabContextMenuItemDelegate.supportsOpenInChromeFromCct());
- });
- }
-
- @Test
- @SmallTest
- public void testHideOpenInChromeMenuItemInContextMenuIgnoredWrongPackage() throws Exception {
- Context context = InstrumentationRegistry.getInstrumentation()
- .getTargetContext()
- .getApplicationContext();
- Intent intent = CustomTabsTestUtils.createMinimalCustomTabIntent(context, mTestPage);
- intent.setData(Uri.parse(mTestPage));
- intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.putExtra(
- CustomTabIntentDataProvider.EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU,
- true);
- CustomTabsSessionToken token = CustomTabsSessionToken.getSessionTokenFromIntent(intent);
- CustomTabsConnection connection = CustomTabsConnection.getInstance();
- connection.newSession(token);
- mCustomTabActivityTestRule.startCustomTabActivityWithIntent(intent);
- // EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU should be ignored without the right
- // package.
- TestThreadUtils.runOnUiThreadBlocking(() -> {
- Tab tab = mCustomTabActivityTestRule.getActivity().getActivityTab();
- Assert.assertTrue(tab != null);
- Assert.assertTrue(
- TabTestUtils.getDelegateFactory(tab) instanceof CustomTabDelegateFactory);
- TabContextMenuItemDelegate tabContextMenuItemDelegate =
- ((CustomTabDelegateFactory) TabTestUtils.getDelegateFactory(tab))
- .createTabContextMenuItemDelegate(tab);
- // EXTRA_HIDE_OPEN_IN_CHROME_MENU_ITEM_IN_CONTEXT_MENU should be ignored without the
- // right package.
- Assert.assertTrue(tabContextMenuItemDelegate.supportsOpenInChromeFromCct());
- });
- }
-
/**
* The following test that history only has a single final page after speculation,
* whether it was a hit or a miss.
diff --git a/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java b/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java
index f66441852..2cab16e 100644
--- a/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java
+++ b/chrome/browser/android/browserservices/intents/java/src/org/chromium/chrome/browser/browserservices/intents/BrowserServicesIntentDataProvider.java
@@ -462,18 +462,4 @@
public boolean shouldHideCctVisits() {
return false;
}
-
- /**
- * Returns true if 'open in chrome' should be shown in the tab context menu.
- */
- public boolean shouldShowOpenInChromeMenuItemInContextMenu() {
- return true;
- }
-
- /**
- * Returns true if 'open in chrome' should be shown in the app menu.
- */
- public boolean shouldShowOpenInChromeMenuItem() {
- return true;
- }
}
diff --git a/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java b/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java
index d8ff4c0..becbd31a 100644
--- a/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java
+++ b/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java
@@ -192,11 +192,6 @@
void onOpenInChrome(GURL linkUrl, GURL pageUrl);
/**
- * Returns true if menu entries should be added for open in chrome.
- */
- boolean supportsOpenInChromeFromCct();
-
- /**
* Called when the {@code url} should be opened in a new Chrome tab from CCT.
* @param linkUrl The URL to open.
* @param isIncognito true if the {@code url} should be opened in a new incognito tab.