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

Unified Diff: ui/views/controls/webview/webview.cc

Issue 11444013: Get drag and drop working for win aura. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: move DropTargetWin to DesktopDragDropClientWin Created 8 years 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: 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:

Powered by Google App Engine
This is Rietveld 408576698