diff --git a/patch/patch.cfg b/patch/patch.cfg index f483487f0..8587ab286 100644 --- a/patch/patch.cfg +++ b/patch/patch.cfg @@ -87,6 +87,13 @@ patches = [ 'name': 'prefs_webkit_1161', 'path': '../webkit/', }, + { + # 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..3b9605d2d --- /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 263053) ++++ web_contents_view_aura.cc (working copy) +@@ -1417,17 +1417,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())); +@@ -1443,6 +1451,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(); +@@ -1461,6 +1472,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(); +@@ -1473,6 +1487,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(),