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

Unified Diff: chrome/browser/ui/gtk/bookmarks/bookmark_drag_drop_gtk.cc

Issue 23743003: gtk: Fold bookmark_drag.* into bookmark_drag_drop_gtk.cc (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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/gtk/bookmarks/bookmark_drag_drop_gtk.cc
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_drag_drop_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_drag_drop_gtk.cc
index 03b769dfebae9a6615d7a46b16895b114778f391..926fad29bde182cd7624ae7a873cd5fde67507d0 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_drag_drop_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_drag_drop_gtk.cc
@@ -4,7 +4,46 @@
#include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h"
-#include "chrome/browser/ui/gtk/bookmarks/bookmark_drag.h"
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
+#include "chrome/browser/ui/gtk/custom_drag.h"
+
+namespace {
+
+const GdkDragAction kBookmarkDragAction =
+ static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE);
+
+// Encapsulates functionality for drags of one or more bookmarks.
+class BookmarkDrag : public CustomDrag {
+ public:
+ BookmarkDrag(Profile* profile, const std::vector<const BookmarkNode*>& nodes);
+
+ private:
+ virtual ~BookmarkDrag() {}
+
+ virtual void OnDragDataGet(GtkWidget* widget,
+ GdkDragContext* context,
+ GtkSelectionData* selection_data,
+ guint target_type,
+ guint time) OVERRIDE {
+ WriteBookmarksToSelection(nodes_, selection_data, target_type, profile_);
+ }
+
+ Profile* profile_;
+ std::vector<const BookmarkNode*> nodes_;
+
+ DISALLOW_COPY_AND_ASSIGN(BookmarkDrag);
+};
+
+BookmarkDrag::BookmarkDrag(Profile* profile,
+ const std::vector<const BookmarkNode*>& nodes)
+ : CustomDrag(NULL, GetCodeMask(false), kBookmarkDragAction),
+ profile_(profile),
+ nodes_(nodes) {}
+
+} // namespace
namespace chrome {
@@ -13,7 +52,9 @@ void DragBookmarks(Profile* profile,
gfx::NativeView view) {
DCHECK(!nodes.empty());
- BookmarkDrag::BeginDrag(profile, nodes);
+ // This starts the drag process, the lifetime of this object is tied to the
+ // system drag.
+ new BookmarkDrag(profile, nodes);
}
} // namespace chrome
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_drag.cc ('k') | chrome/browser/ui/gtk/download/download_item_drag.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698