Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java |
| index 95c47d8775ed819f3e3912cbef5d539021888d12..efcaef0eab53c771206059bfa7d8cd626d1afc40 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuHelper.java |
| @@ -5,6 +5,7 @@ |
| package org.chromium.chrome.browser.contextmenu; |
| import android.app.Activity; |
| +import android.content.ComponentName; |
| import android.graphics.Bitmap; |
| import android.graphics.BitmapFactory; |
| import android.util.Pair; |
| @@ -39,6 +40,7 @@ public class ContextMenuHelper implements OnCreateContextMenuListener { |
| private Runnable mOnMenuShown; |
| private Runnable mOnMenuClosed; |
| private OnThumbnailReceivedListener mOnThumbnailReceivedListener; |
| + private ComponentName mComponentName; |
| interface OnThumbnailReceivedListener { |
| void onThumbnailReceived(Bitmap bitmap); |
| @@ -167,7 +169,19 @@ public class ContextMenuHelper implements OnCreateContextMenuListener { |
| Activity activity = windowAndroid.getActivity().get(); |
| if (activity == null) return; |
| - ShareHelper.shareImage(activity, jpegImageData); |
| + ShareHelper.shareImage(activity, jpegImageData, mComponentName); |
| + // This needs to be reset to null after a share. This way the next time a user shares an |
| + // image it won't share with the last shared item unless explicitly told. |
|
David Trainor- moved to gerrit
2017/03/30 23:50:22
item -> app?
JJ
2017/03/31 20:58:54
Done.
|
| + mComponentName = null; |
| + } |
| + |
| + /** |
| + * Share image triggered with the current context menu directly with a specific app. |
| + * @param name The app to share the image directly with. |
| + */ |
| + public void shareImageDirectly(ComponentName name) { |
| + mComponentName = name; |
| + shareImage(); |
| } |
| /** |