Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| index a1c24280c5b732b2a1b95590c535631f9fb6ad3a..a020be2d61a46fb6e6e8b64669c6f82139adc815 100644 |
| --- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| +++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java |
| @@ -47,6 +47,7 @@ import android.view.inputmethod.EditorInfo; |
| import android.view.inputmethod.InputConnection; |
| import android.view.inputmethod.InputMethodManager; |
| import android.widget.FrameLayout; |
| +import android.widget.ImageView; |
| import org.chromium.base.ApiCompatibilityUtils; |
| import org.chromium.base.CommandLine; |
| @@ -155,6 +156,8 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen |
| * that clients can safely hold to instances of this class. |
| */ |
| private static class ContentViewAndroidDelegate implements ViewAndroidDelegate { |
| + // TODO(hush): use View#DRAG_FLAG_GLOBAL when Chromium starts to build with API 24. |
| + private static final int DRAG_FLAG_GLOBAL = 1 << 8; |
| /** |
| * Represents the position of an anchor view. |
| */ |
| @@ -297,6 +300,21 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen |
| } |
| } |
| } |
| + |
| + public void startDragAndDrop(String text, Bitmap shadowImage) { |
| + ClipData data = ClipData.newPlainText(null, text); |
| + |
| + ViewGroup containerView = mCurrentContainerView.get(); |
| + if (containerView == null) return; |
| + |
| + ImageView imageView = new ImageView(containerView.getContext()); |
| + imageView.setImageBitmap(shadowImage); |
| + imageView.layout(0, 0, shadowImage.getWidth(), shadowImage.getHeight()); |
| + |
| + // TODO(hush): use View#startDragAndDrop when Chromium starts to build with API 24. |
| + containerView.startDrag( |
|
Theresa
2016/07/13 22:55:42
This method is deprecated in API 24, so there will
hush (inactive)
2016/07/14 18:42:09
Yes, done.
|
| + data, new View.DragShadowBuilder(imageView), null, DRAG_FLAG_GLOBAL); |
| + } |
| } |
| /** |
| @@ -1466,6 +1484,7 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen |
| hidePopups(); |
| } |
| + @CalledByNative |
| private void hidePopupsAndPreserveSelection() { |
| mUnselectAllOnActionModeDismiss = false; |
| hidePopups(); |