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

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

Issue 2135493002: Support dragging texts out of webview/Chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Support dragging texts out of webview/Chrome. Created 4 years, 5 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 8c326e0c0ca3be8771203bc8b9de5664003857de..0118b3a14de60e79f48fdc7b4d5dd8e5c86ad681 100644
--- a/content/browser/web_contents/web_contents_view_android.cc
+++ b/content/browser/web_contents/web_contents_view_android.cc
@@ -194,7 +194,10 @@ void WebContentsViewAndroid::StartDragging(
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const DragEventSourceInfo& event_info) {
- NOTIMPLEMENTED();
+ if (drop_data.text.is_null())
+ return;
+ base::string16 dragged_text = drop_data.text.string();
+ content_view_core_->StartDragging(dragged_text, image);
}
void WebContentsViewAndroid::UpdateDragCursor(blink::WebDragOperation op) {
@@ -205,14 +208,20 @@ void WebContentsViewAndroid::OnDragEntered(
const std::vector<DropData::Metadata>& metadata,
const gfx::Point& location,
const gfx::Point& screen_location) {
+ blink::WebDragOperationsMask allowed_ops =
+ static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy |
+ blink::WebDragOperationMove);
dcheng 2016/07/08 06:30:30 Out of curiosity, why did we change this from Copy
hush (inactive) 2016/07/08 18:23:24 The move operation is to support dragging texts wi
web_contents_->GetRenderViewHost()->DragTargetDragEnterWithMetaData(
- metadata, location, screen_location, blink::WebDragOperationCopy, 0);
+ metadata, location, screen_location, allowed_ops, 0);
}
void WebContentsViewAndroid::OnDragUpdated(const gfx::Point& location,
const gfx::Point& screen_location) {
+ blink::WebDragOperationsMask allowed_ops =
+ static_cast<blink::WebDragOperationsMask>(blink::WebDragOperationCopy |
+ blink::WebDragOperationMove);
web_contents_->GetRenderViewHost()->DragTargetDragOver(
- location, screen_location, blink::WebDragOperationCopy, 0);
+ location, screen_location, allowed_ops, 0);
}
void WebContentsViewAndroid::OnDragExited() {
@@ -227,6 +236,10 @@ void WebContentsViewAndroid::OnPerformDrop(DropData* drop_data,
screen_location, 0);
}
+void WebContentsViewAndroid::OnDragEnded() {
+ web_contents_->GetRenderViewHost()->DragSourceSystemDragEnded();
+}
+
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