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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_drag_drop_gtk.cc

Issue 231733005: Delete the GTK+ port of Chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remerge to ToT Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/bookmarks/bookmark_drag_drop.h"
6
7 #include <vector>
8
9 #include "base/compiler_specific.h"
10 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
11 #include "chrome/browser/ui/gtk/custom_drag.h"
12 #include "ui/base/dragdrop/drag_drop_types.h"
13
14 namespace {
15
16 const GdkDragAction kBookmarkDragAction =
17 static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE);
18
19 // Encapsulates functionality for drags of one or more bookmarks.
20 class BookmarkDrag : public CustomDrag {
21 public:
22 BookmarkDrag(Profile* profile, const std::vector<const BookmarkNode*>& nodes);
23
24 private:
25 virtual ~BookmarkDrag() {}
26
27 virtual void OnDragDataGet(GtkWidget* widget,
28 GdkDragContext* context,
29 GtkSelectionData* selection_data,
30 guint target_type,
31 guint time) OVERRIDE {
32 WriteBookmarksToSelection(nodes_, selection_data, target_type, profile_);
33 }
34
35 Profile* profile_;
36 std::vector<const BookmarkNode*> nodes_;
37
38 DISALLOW_COPY_AND_ASSIGN(BookmarkDrag);
39 };
40
41 BookmarkDrag::BookmarkDrag(Profile* profile,
42 const std::vector<const BookmarkNode*>& nodes)
43 : CustomDrag(NULL, GetCodeMask(false), kBookmarkDragAction),
44 profile_(profile),
45 nodes_(nodes) {}
46
47 } // namespace
48
49 namespace chrome {
50
51 void DragBookmarks(Profile* profile,
52 const std::vector<const BookmarkNode*>& nodes,
53 gfx::NativeView view,
54 ui::DragDropTypes::DragEventSource source) {
55 DCHECK(!nodes.empty());
56
57 // This starts the drag process, the lifetime of this object is tied to the
58 // system drag.
59 new BookmarkDrag(profile, nodes);
60 }
61
62 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698