Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java |
| 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 9dbaa3fcb0af14cab4db36c5894e37394b15987c..587963db06d28187ab20ffba27e45c1bdb7eb8b1 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 |
| @@ -8,12 +8,16 @@ import android.content.Context; |
| import android.content.Intent; |
| import android.net.MailTo; |
| import android.net.Uri; |
| +import android.provider.Browser; |
| import android.provider.ContactsContract; |
| import org.chromium.base.metrics.RecordUserAction; |
| +import org.chromium.chrome.R; |
| +import org.chromium.chrome.browser.DefaultBrowserInfo; |
| import org.chromium.chrome.browser.IntentHandler; |
| import org.chromium.chrome.browser.UrlConstants; |
| import org.chromium.chrome.browser.contextmenu.ContextMenuItemDelegate; |
| +import org.chromium.chrome.browser.document.ChromeLauncherActivity; |
| import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; |
| import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings; |
| import org.chromium.chrome.browser.preferences.PrefServiceBridge; |
| @@ -28,6 +32,7 @@ import org.chromium.ui.base.PageTransition; |
| import java.net.URI; |
| import java.util.Locale; |
| +import java.util.concurrent.ExecutionException; |
| /** |
| * A default {@link ContextMenuItemDelegate} that supports the context menu functionality in Tab. |
| @@ -35,6 +40,7 @@ import java.util.Locale; |
| public class TabContextMenuItemDelegate implements ContextMenuItemDelegate { |
| public static final String PAGESPEED_PASSTHROUGH_HEADERS = |
| "Chrome-Proxy: pass-through\nCache-Control: no-cache"; |
| + private static final String SAMPLE_URL = "https://www.google.com"; |
|
Ted C
2017/02/14 19:02:00
no longer needed
ltian
2017/02/16 05:05:10
Done.
|
| private final Clipboard mClipboard; |
| private final Tab mTab; |
| @@ -232,6 +238,37 @@ public class TabContextMenuItemDelegate implements ContextMenuItemDelegate { |
| } |
| } |
| + @Override |
| + public void onOpenInNewChromeTabFromCCT(String linkUrl, boolean isIncognito) { |
| + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(linkUrl)); |
| + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| + intent.setPackage(mTab.getApplicationContext().getPackageName()); |
| + intent.putExtra(ChromeLauncherActivity.EXTRA_IS_ALLOWED_TO_RETURN_TO_PARENT, false); |
| + if (isIncognito) { |
| + intent.putExtra(IntentHandler.EXTRA_OPEN_NEW_INCOGNITO_TAB, true); |
| + intent.putExtra( |
| + Browser.EXTRA_APPLICATION_ID, mTab.getApplicationContext().getPackageName()); |
| + IntentHandler.addTrustedIntentExtras(intent); |
| + } |
| + IntentUtils.safeStartActivity(mTab.getActivity(), intent); |
| + } |
| + |
| + @Override |
| + public String getTitleForOpenTabInExternalApp() { |
| + try { |
| + return DefaultBrowserInfo.getTitleOpenInDefaultBrowser(mTab.getActivity(), false); |
| + } catch (InterruptedException | ExecutionException e) { |
| + return mTab.getActivity().getString(R.string.menu_open_in_product_default); |
| + } |
| + } |
| + |
| + @Override |
| + public void onOpenInDefaultBrowser(String url) { |
| + Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); |
| + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); |
| + IntentUtils.safeStartActivity(mTab.getActivity(), intent); |
| + } |
| + |
| /** |
| * Checks if spdy proxy is enabled for input url. |
| * @param url Input url to check for spdy setting. |