| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" | 9 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" |
| 10 #include "content/public/browser/download_item.h" | 10 #include "content/public/browser/download_item.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 // to be a DragData*. | 84 // to be a DragData*. |
| 85 static void OnDestroy(gpointer data, GClosure* closure); | 85 static void OnDestroy(gpointer data, GClosure* closure); |
| 86 | 86 |
| 87 GURL url_; | 87 GURL url_; |
| 88 string16 display_name_; | 88 string16 display_name_; |
| 89 }; | 89 }; |
| 90 | 90 |
| 91 DownloadItemDrag::DragData::DragData(const DownloadItem* item) | 91 DownloadItemDrag::DragData::DragData(const DownloadItem* item) |
| 92 : url_(net::FilePathToFileURL(item->GetTargetFilePath())), | 92 : url_(net::FilePathToFileURL(item->GetTargetFilePath())), |
| 93 display_name_(item->GetFileNameToReportUser().LossyDisplayName()) { | 93 display_name_(item->GetFileNameToReportUser().LossyDisplayName()) { |
| 94 DCHECK(item->IsComplete()); | 94 DCHECK_EQ(DownloadItem::COMPLETE, item->GetState()); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void DownloadItemDrag::DragData::OnDragDataGet(GtkWidget* widget, | 97 void DownloadItemDrag::DragData::OnDragDataGet(GtkWidget* widget, |
| 98 GdkDragContext* context, | 98 GdkDragContext* context, |
| 99 GtkSelectionData* selection_data, | 99 GtkSelectionData* selection_data, |
| 100 guint target_type, | 100 guint target_type, |
| 101 guint time) { | 101 guint time) { |
| 102 ui::WriteURLWithName(selection_data, url_, display_name_, target_type); | 102 ui::WriteURLWithName(selection_data, url_, display_name_, target_type); |
| 103 } | 103 } |
| 104 | 104 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 guint target_type, guint time) { | 182 guint target_type, guint time) { |
| 183 bookmark_utils::WriteBookmarksToSelection(nodes_, selection_data, | 183 bookmark_utils::WriteBookmarksToSelection(nodes_, selection_data, |
| 184 target_type, profile_); | 184 target_type, profile_); |
| 185 } | 185 } |
| 186 | 186 |
| 187 // static | 187 // static |
| 188 void BookmarkDrag::BeginDrag(Profile* profile, | 188 void BookmarkDrag::BeginDrag(Profile* profile, |
| 189 const std::vector<const BookmarkNode*>& nodes) { | 189 const std::vector<const BookmarkNode*>& nodes) { |
| 190 new BookmarkDrag(profile, nodes); | 190 new BookmarkDrag(profile, nodes); |
| 191 } | 191 } |
| OLD | NEW |