diff --git a/patch/patch.cfg b/patch/patch.cfg index 283871650..0c1a3653d 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -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 diff --git a/patch/patches/web_contents_1262.patch b/patch/patches/web_contents_1262.patch new file mode 100644 index 000000000..78c72dc0c --- /dev/null +++ b/patch/patches/web_contents_1262.patch @@ -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(),