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

Unified Diff: chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc

Issue 9757001: Support custom drag-and-drop of bookmarks in Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor style fixes from CR Created 8 years, 9 months 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: chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
diff --git a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
index ffc0d9031f7fa1f1f7bb5607a0519083604a86b6..53ef9d02851ec10affc73aca4b61c4e2cc4f06eb 100644
--- a/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
+++ b/chrome/browser/ui/views/tab_contents/native_tab_contents_view_aura.cc
@@ -13,6 +13,7 @@
#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 "content/public/browser/web_drag_dest_delegate.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/drag_drop_delegate.h"
#include "ui/aura/event.h"
@@ -163,7 +164,8 @@ NativeTabContentsViewAura::NativeTabContentsViewAura(
internal::NativeTabContentsViewDelegate* delegate)
: views::NativeWidgetAura(delegate->AsNativeWidgetDelegate()),
delegate_(delegate),
- current_drag_op_(WebKit::WebDragOperationNone) {
+ current_drag_op_(WebKit::WebDragOperationNone),
+ drag_dest_delegate_(NULL) {
}
NativeTabContentsViewAura::~NativeTabContentsViewAura() {
@@ -193,6 +195,9 @@ void NativeTabContentsViewAura::InitNativeTabContentsView() {
NOTIMPLEMENTED() << "Need to animate in";
#endif
+ if (delegate_)
+ drag_dest_delegate_ = delegate_->GetDragDestDelegate();
+
// Hide the widget to prevent it from showing up on the root window. This is
// needed for TabContentses that aren't immediately added to the tabstrip,
// e.g. the Instant preview contents.
@@ -314,6 +319,9 @@ bool NativeTabContentsViewAura::OnMouseEvent(aura::MouseEvent* event) {
void NativeTabContentsViewAura::OnDragEntered(
const aura::DropTargetEvent& event) {
+ if (drag_dest_delegate_)
+ drag_dest_delegate_->DragInitialize(GetWebContents());
+
WebDropData drop_data;
PrepareWebDropData(&drop_data, event.data());
WebKit::WebDragOperationsMask op = ConvertToWeb(event.source_operations());
@@ -322,6 +330,11 @@ void NativeTabContentsViewAura::OnDragEntered(
GetNativeView()->GetRootWindow()->last_mouse_location();
GetWebContents()->GetRenderViewHost()->DragTargetDragEnter(
drop_data, event.location(), screen_pt, op);
+
+ if (drag_dest_delegate_) {
+ drag_dest_delegate_->OnReceiveDragData(event.data());
+ drag_dest_delegate_->OnDragEnter();
+ }
}
int NativeTabContentsViewAura::OnDragUpdated(
@@ -331,11 +344,17 @@ int NativeTabContentsViewAura::OnDragUpdated(
GetNativeView()->GetRootWindow()->last_mouse_location();
GetWebContents()->GetRenderViewHost()->DragTargetDragOver(
event.location(), screen_pt, op);
+
+ if (drag_dest_delegate_)
+ drag_dest_delegate_->OnDragOver();
+
return ConvertFromWeb(current_drag_op_);
}
void NativeTabContentsViewAura::OnDragExited() {
GetWebContents()->GetRenderViewHost()->DragTargetDragLeave();
+ if (drag_dest_delegate_)
+ drag_dest_delegate_->OnDragLeave();
}
int NativeTabContentsViewAura::OnPerformDrop(
@@ -343,6 +362,8 @@ int NativeTabContentsViewAura::OnPerformDrop(
GetWebContents()->GetRenderViewHost()->DragTargetDrop(
event.location(),
GetNativeView()->GetRootWindow()->last_mouse_location());
+ if (drag_dest_delegate_)
+ drag_dest_delegate_->OnDrop();
return current_drag_op_;
}

Powered by Google App Engine
This is Rietveld 408576698