Add OnDragEnter support for Aura (issue #1262).
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/1916@1701 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
7c3abcb7e8
commit
1bee375f4b
|
@ -104,6 +104,13 @@ patches = [
|
|||
'name': 'views_webview_304341',
|
||||
'path': '../ui/views/controls/webview/',
|
||||
},
|
||||
{
|
||||
# Add WebContentsDelegate::CanDragEnter support for Aura.
|
||||
# http://code.google.com/p/chromiumembedded/issues/detail?id=1262
|
||||
# https://codereview.chromium.org/267113008/
|
||||
'name': 'web_contents_1262',
|
||||
'path': '../content/browser/web_contents/',
|
||||
},
|
||||
{
|
||||
# Disable scollbar bounce and overlay on OS X.
|
||||
# http://code.google.com/p/chromiumembedded/issues/detail?id=364
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
Index: web_contents_view_aura.cc
|
||||
===================================================================
|
||||
--- web_contents_view_aura.cc (revision 266998)
|
||||
+++ web_contents_view_aura.cc (working copy)
|
||||
@@ -1449,17 +1449,25 @@
|
||||
// WebContentsViewAura, aura::client::DragDropDelegate implementation:
|
||||
|
||||
void WebContentsViewAura::OnDragEntered(const ui::DropTargetEvent& event) {
|
||||
- if (drag_dest_delegate_)
|
||||
- drag_dest_delegate_->DragInitialize(web_contents_);
|
||||
-
|
||||
+ current_rvh_for_drag_ = web_contents_->GetRenderViewHost();
|
||||
current_drop_data_.reset(new DropData());
|
||||
|
||||
PrepareDropData(current_drop_data_.get(), event.data());
|
||||
blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
|
||||
|
||||
+ // Give the delegate an opportunity to cancel the drag.
|
||||
+ if (!web_contents_->GetDelegate()->CanDragEnter(web_contents_,
|
||||
+ *current_drop_data_.get(),
|
||||
+ op)) {
|
||||
+ current_drop_data_.reset(NULL);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (drag_dest_delegate_)
|
||||
+ drag_dest_delegate_->DragInitialize(web_contents_);
|
||||
+
|
||||
gfx::Point screen_pt =
|
||||
gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
|
||||
- current_rvh_for_drag_ = web_contents_->GetRenderViewHost();
|
||||
web_contents_->GetRenderViewHost()->DragTargetDragEnter(
|
||||
*current_drop_data_.get(), event.location(), screen_pt, op,
|
||||
ConvertAuraEventFlagsToWebInputEventModifiers(event.flags()));
|
||||
@@ -1475,6 +1483,9 @@
|
||||
if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost())
|
||||
OnDragEntered(event);
|
||||
|
||||
+ if (!current_drop_data_)
|
||||
+ return ui::DragDropTypes::DRAG_NONE;
|
||||
+
|
||||
blink::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
|
||||
gfx::Point screen_pt =
|
||||
gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint();
|
||||
@@ -1493,6 +1504,9 @@
|
||||
if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost())
|
||||
return;
|
||||
|
||||
+ if (!current_drop_data_)
|
||||
+ return;
|
||||
+
|
||||
web_contents_->GetRenderViewHost()->DragTargetDragLeave();
|
||||
if (drag_dest_delegate_)
|
||||
drag_dest_delegate_->OnDragLeave();
|
||||
@@ -1505,6 +1519,9 @@
|
||||
if (current_rvh_for_drag_ != web_contents_->GetRenderViewHost())
|
||||
OnDragEntered(event);
|
||||
|
||||
+ if (!current_drop_data_)
|
||||
+ return ui::DragDropTypes::DRAG_NONE;
|
||||
+
|
||||
web_contents_->GetRenderViewHost()->DragTargetDrop(
|
||||
event.location(),
|
||||
gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(),
|
Loading…
Reference in New Issue