Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 1728193002: Support dragging texts into Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index a710d513896e2f65cc45be90c0a0c6231c552b5f..681844751cb0e2bca6e2de5af54947ad015857e9 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -6,6 +6,7 @@ package org.chromium.android_webview;
import android.annotation.SuppressLint;
import android.app.Activity;
+import android.content.ClipDescription;
import android.content.ComponentCallbacks2;
import android.content.Context;
import android.content.Intent;
@@ -2974,8 +2975,30 @@ public class AwContents implements SmartClipProvider,
@Override
public boolean onDragEvent(DragEvent event) {
- // TODO(hush): implement this. crbug.com/584789
- return false;
+ switch (event.getAction()) {
+ case DragEvent.ACTION_DRAG_STARTED:
+ ClipDescription clipDescription = event.getClipDescription();
Ted C 2016/02/25 18:38:53 I don't see any reason why we need to increase the
hush (inactive) 2016/02/27 01:46:13 No particular reason in fact. During the first dra
+ // TODO(hush): support dragging more than just text.
+ return clipDescription.hasMimeType(ClipDescription.MIMETYPE_TEXT_HTML)
+ || clipDescription.hasMimeType(clipDescription.MIMETYPE_TEXT_PLAIN);
+ case DragEvent.ACTION_DRAG_ENTERED:
+ mContentViewCore.onDragEntered(event);
+ return true;
+ case DragEvent.ACTION_DRAG_LOCATION:
+ mContentViewCore.onDragUpdated(event);
+ return true;
+ case DragEvent.ACTION_DROP:
+ // TODO(hush): onPerformDrop should return false when the receiving object does
aelias_OOO_until_Jul13 2016/02/25 20:58:00 I don't think this one should be left as a TODO, s
hush (inactive) 2016/02/27 01:46:13 I will delete this TODO. There is no such concept
+ // not accept the text drop.
+ mContentViewCore.onPerformDrop(event);
+ return true;
+ case DragEvent.ACTION_DRAG_EXITED:
+ mContentViewCore.onDragExited();
+ return true;
+ case DragEvent.ACTION_DRAG_ENDED:
+ default:
+ return true;
+ }
}
@Override
« no previous file with comments | « no previous file | content/browser/android/content_view_core_impl.h » ('j') | content/browser/android/content_view_core_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698