Index: ui/views/controls/webview/webview.cc |
=================================================================== |
--- ui/views/controls/webview/webview.cc (revision 171535) |
+++ ui/views/controls/webview/webview.cc (working copy) |
@@ -13,6 +13,7 @@ |
#include "content/public/browser/render_view_host.h" |
#include "content/public/browser/render_widget_host_view.h" |
#include "content/public/browser/web_contents.h" |
+#include "content/public/browser/web_contents_view.h" |
#include "ipc/ipc_message.h" |
#include "ui/base/accessibility/accessibility_types.h" |
#include "ui/base/accessibility/accessible_view_state.h" |
@@ -21,6 +22,11 @@ |
#include "ui/views/focus/focus_manager.h" |
#include "ui/views/views_delegate.h" |
+#if defined(USE_AURA) |
+#include "ui/aura/client/drag_drop_client.h" |
+#include "ui/aura/client/drag_drop_delegate.h" |
+#endif |
+ |
namespace views { |
// static |
@@ -150,6 +156,47 @@ |
return preferred_size_; |
} |
+#if defined(USE_AURA) |
+bool WebView::CanDrop(const ui::OSExchangeData& data) { |
+ return true; |
+} |
+ |
+void WebView::OnDragEntered(const ui::DropTargetEvent& event) { |
+ aura::Window* window = web_contents_->GetView()->GetContentNativeView(); |
+ aura::client::DragDropDelegate* dnd_delegate = |
+ aura::client::GetDragDropDelegate(window); |
+ if (dnd_delegate) |
+ dnd_delegate->OnDragEntered(event); |
+} |
+ |
+int WebView::OnDragUpdated(const ui::DropTargetEvent& event) { |
+ aura::Window* window = web_contents_->GetView()->GetContentNativeView(); |
+ aura::client::DragDropDelegate* dnd_delegate = |
+ aura::client::GetDragDropDelegate(window); |
+ if (dnd_delegate) |
+ return dnd_delegate->OnDragUpdated(event); |
+ return ui::DragDropTypes::DRAG_NONE; |
+} |
+ |
+void WebView::OnDragExited() { |
+ aura::Window* window = web_contents_->GetView()->GetContentNativeView(); |
+ aura::client::DragDropDelegate* dnd_delegate = |
+ aura::client::GetDragDropDelegate(window); |
+ if (dnd_delegate) |
+ dnd_delegate->OnDragExited(); |
+} |
+ |
+int WebView::OnPerformDrop(const ui::DropTargetEvent& event) { |
+ aura::Window* window = web_contents_->GetView()->GetContentNativeView(); |
+ aura::client::DragDropDelegate* dnd_delegate = |
+ aura::client::GetDragDropDelegate(window); |
+ if (dnd_delegate) |
+ return dnd_delegate->OnPerformDrop(event); |
+ return ui::DragDropTypes::DRAG_NONE; |
+} |
+ |
+#endif |
+ |
//////////////////////////////////////////////////////////////////////////////// |
// WebView, content::NotificationObserver implementation: |