Index: chrome/browser/ui/gtk/bookmarks/bookmark_drag.cc |
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_drag.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_drag.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..44f806da40d1b5c11cb12fe87376fcae4d5f8ecb |
--- /dev/null |
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_drag.cc |
@@ -0,0 +1,36 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/ui/gtk/bookmarks/bookmark_drag.h" |
+ |
+#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
+ |
+namespace { |
+ |
+const GdkDragAction kBookmarkDragAction = |
+ static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE); |
+ |
+} // namespace |
+ |
+// static |
+void BookmarkDrag::BeginDrag(Profile* profile, |
+ const std::vector<const BookmarkNode*>& nodes) { |
+ new BookmarkDrag(profile, nodes); |
+} |
+ |
+BookmarkDrag::BookmarkDrag(Profile* profile, |
+ const std::vector<const BookmarkNode*>& nodes) |
+ : CustomDrag(NULL, GetCodeMask(false), kBookmarkDragAction), |
+ profile_(profile), |
+ nodes_(nodes) {} |
+ |
+BookmarkDrag::~BookmarkDrag() {} |
+ |
+void BookmarkDrag::OnDragDataGet(GtkWidget* widget, |
+ GdkDragContext* context, |
+ GtkSelectionData* selection_data, |
+ guint target_type, |
+ guint time) { |
+ WriteBookmarksToSelection(nodes_, selection_data, target_type, profile_); |
+} |