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

Unified Diff: content/browser/web_contents/web_contents_view_android.cc

Issue 1728193002: Support dragging texts into Android WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove dead includes Created 4 years, 6 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: content/browser/web_contents/web_contents_view_android.cc
diff --git a/content/browser/web_contents/web_contents_view_android.cc b/content/browser/web_contents/web_contents_view_android.cc
index 0716d13d2fb2ae9053899b12397de5234c4c44ea..8495f25e96b77311a09789823fc38e6d376fb269 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -13,8 +13,10 @@
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/render_widget_host.h"
#include "content/public/browser/web_contents_delegate.h"
+#include "content/public/common/drop_data.h"
namespace content {
+
WebContentsView* CreateWebContentsView(
WebContentsImpl* web_contents,
WebContentsViewDelegate* delegate,
@@ -199,6 +201,37 @@ void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) {
NOTIMPLEMENTED();
}
+void WebContentsViewAndroid::OnDragEntered(
+ const std::vector<DropData::Metadata>& metadata,
+ std::vector<int> locations) {
+ const gfx::Point location(locations[0], locations[1]);
+ const gfx::Point screen_location(locations[2], locations[3]);
+
+ web_contents_->GetRenderViewHost()->DragTargetDragEnterWithMetaData(
+ metadata, location, screen_location, blink::WebDragOperationCopy, 0);
+}
+void WebContentsViewAndroid::OnDragUpdated(std::vector<int> locations) {
+ const gfx::Point location(locations[0], locations[1]);
+ const gfx::Point screen_location(locations[2], locations[3]);
+
+ web_contents_->GetRenderViewHost()->DragTargetDragOver(
+ location, screen_location, blink::WebDragOperationCopy, 0);
+}
+
+void WebContentsViewAndroid::OnDragExited() {
+ web_contents_->GetRenderViewHost()->DragTargetDragLeave();
+}
+
+void WebContentsViewAndroid::OnPerformDrop(DropData& drop_data,
+ std::vector<int> locations) {
+ const gfx::Point location(locations[0], locations[1]);
+ const gfx::Point screen_location(locations[2], locations[3]);
+
+ web_contents_->GetRenderViewHost()->FilterDropData(&drop_data);
+ web_contents_->GetRenderViewHost()->DragTargetDrop(drop_data, location,
+ screen_location, 0);
+}
+
void WebContentsViewAndroid::GotFocus() {
// This is only used in the views FocusManager stuff but it bleeds through
// all subclasses. http://crbug.com/21875

Powered by Google App Engine
This is Rietveld 408576698