Index: content/browser/android/content_view_core_impl.cc |
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc |
index d70219a71ef275a274ba0f2cb91ad79fe20f34a8..04c30ba44da0d8bdf24b4b3b567bc7e4c0be63cd 100644 |
--- a/content/browser/android/content_view_core_impl.cc |
+++ b/content/browser/android/content_view_core_impl.cc |
@@ -54,6 +54,8 @@ |
#include "third_party/WebKit/public/web/WebInputEvent.h" |
#include "ui/android/view_android.h" |
#include "ui/android/window_android.h" |
+#include "ui/base/dragdrop/drop_target_event.h" |
+#include "ui/base/dragdrop/os_exchange_data_provider_android.h" |
#include "ui/events/android/motion_event_android.h" |
#include "ui/gfx/android/java_bitmap.h" |
#include "ui/gfx/geometry/point_conversions.h" |
@@ -1409,6 +1411,72 @@ void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, |
} |
} |
+void ContentViewCoreImpl::OnDragEntered( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& jobj, |
+ int x, |
+ int y, |
+ int screen_x, |
+ int screen_y) { |
+ WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
+ static_cast<WebContentsImpl*>(web_contents())->GetView()); |
+ |
+ ui::OSExchangeData data(new ui::OSExchangeDataProviderAndroid()); |
dcheng
2016/02/25 01:18:49
Will there be a followup patch to address the fact
hush (inactive)
2016/02/25 02:40:48
Types are sort of plumbed through. We only support
dcheng
2016/02/25 21:13:38
I don't think I follow: I don't see how the types
hush (inactive)
2016/02/27 01:47:22
Sorry yeah you're right. I just updated the logic
|
+ ui::DropTargetEvent event( |
+ data, gfx::Point(x, y), gfx::Point(screen_x, screen_y), |
+ ui::DragDropTypes::DRAG_COPY); // Android drag and drop does only copy. |
+ |
+ wcva->OnDragEntered(event); |
+} |
+ |
+void ContentViewCoreImpl::OnDragUpdated( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& jobj, |
+ int x, |
+ int y, |
+ int screen_x, |
+ int screen_y) { |
+ WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
+ static_cast<WebContentsImpl*>(web_contents())->GetView()); |
+ |
+ ui::OSExchangeData data(new ui::OSExchangeDataProviderAndroid()); |
+ ui::DropTargetEvent event( |
+ data, gfx::Point(x, y), gfx::Point(screen_x, screen_y), |
+ ui::DragDropTypes::DRAG_COPY); // Android drag and drop does only copy. |
+ |
+ wcva->OnDragUpdated(event); |
+} |
+ |
+void ContentViewCoreImpl::OnPerformDrop( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& jobj, |
+ int x, |
+ int y, |
+ int screen_x, |
+ int screen_y, |
+ const base::android::JavaParamRef<jstring>& content) { |
+ base::string16 text_to_drop = ConvertJavaStringToUTF16(env, content); |
+ |
+ WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
+ static_cast<WebContentsImpl*>(web_contents())->GetView()); |
+ |
+ ui::OSExchangeData data(new ui::OSExchangeDataProviderAndroid()); |
+ data.SetString(text_to_drop); |
+ ui::DropTargetEvent event(data, gfx::Point(x, y), |
+ gfx::Point(screen_x, screen_y), |
+ ui::DragDropTypes::DRAG_COPY); |
+ |
+ wcva->OnPerformDrop(event); |
+} |
+ |
+void ContentViewCoreImpl::OnDragExited( |
+ JNIEnv* env, |
+ const base::android::JavaParamRef<jobject>& jobj) { |
+ WebContentsViewAndroid* wcva = static_cast<WebContentsViewAndroid*>( |
+ static_cast<WebContentsImpl*>(web_contents())->GetView()); |
+ wcva->OnDragExited(); |
+} |
+ |
void ContentViewCoreImpl::RequestTextSurroundingSelection( |
int max_length, |
const base::Callback< |