OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/gtk/custom_drag.h" | 5 #include "chrome/browser/ui/gtk/custom_drag.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 8 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
9 #include "content/browser/download/download_item.h" | 9 #include "content/browser/download/download_item.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "net/base/net_util.h" | 11 #include "net/base/net_util.h" |
12 #include "third_party/skia/include/core/SkBitmap.h" | 12 #include "third_party/skia/include/core/SkBitmap.h" |
13 #include "ui/base/dragdrop/gtk_dnd_util.h" | 13 #include "ui/base/dragdrop/gtk_dnd_util.h" |
14 #include "ui/gfx/gtk_util.h" | 14 #include "ui/gfx/gtk_util.h" |
15 #include "ui/gfx/image/image.h" | 15 #include "ui/gfx/image/image.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 const int kDownloadItemCodeMask = ui::TEXT_URI_LIST | ui::CHROME_NAMED_URL; | 19 const int kDownloadItemCodeMask = ui::TEXT_URI_LIST | ui::CHROME_NAMED_URL; |
20 const GdkDragAction kDownloadItemDragAction = GDK_ACTION_COPY; | 20 const GdkDragAction kDownloadItemDragAction = GDK_ACTION_COPY; |
21 const GdkDragAction kBookmarkDragAction = | 21 const GdkDragAction kBookmarkDragAction = |
22 static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE); | 22 static_cast<GdkDragAction>(GDK_ACTION_COPY | GDK_ACTION_MOVE); |
23 | 23 |
24 void OnDragDataGetForDownloadItem(GtkSelectionData* selection_data, | 24 void OnDragDataGetForDownloadItem(GtkSelectionData* selection_data, |
25 guint target_type, | 25 guint target_type, |
26 const DownloadItem* download_item) { | 26 const DownloadItem* download_item) { |
27 GURL url = net::FilePathToFileURL(download_item->full_path()); | 27 GURL url = net::FilePathToFileURL(download_item->GetFullPath()); |
28 ui::WriteURLWithName(selection_data, url, | 28 ui::WriteURLWithName(selection_data, url, |
29 UTF8ToUTF16(download_item->GetFileNameToReportUser().value()), | 29 UTF8ToUTF16(download_item->GetFileNameToReportUser().value()), |
30 target_type); | 30 target_type); |
31 } | 31 } |
32 | 32 |
33 void OnDragDataGetStandalone(GtkWidget* widget, GdkDragContext* context, | 33 void OnDragDataGetStandalone(GtkWidget* widget, GdkDragContext* context, |
34 GtkSelectionData* selection_data, | 34 GtkSelectionData* selection_data, |
35 guint target_type, guint time, | 35 guint target_type, guint time, |
36 const DownloadItem* item) { | 36 const DownloadItem* item) { |
37 OnDragDataGetForDownloadItem(selection_data, target_type, item); | 37 OnDragDataGetForDownloadItem(selection_data, target_type, item); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 guint target_type, guint time) { | 135 guint target_type, guint time) { |
136 bookmark_utils::WriteBookmarksToSelection(nodes_, selection_data, | 136 bookmark_utils::WriteBookmarksToSelection(nodes_, selection_data, |
137 target_type, profile_); | 137 target_type, profile_); |
138 } | 138 } |
139 | 139 |
140 // static | 140 // static |
141 void BookmarkDrag::BeginDrag(Profile* profile, | 141 void BookmarkDrag::BeginDrag(Profile* profile, |
142 const std::vector<const BookmarkNode*>& nodes) { | 142 const std::vector<const BookmarkNode*>& nodes) { |
143 new BookmarkDrag(profile, nodes); | 143 new BookmarkDrag(profile, nodes); |
144 } | 144 } |
OLD | NEW |