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

Side by Side Diff: chrome/browser/ui/gtk/custom_drag.cc

Issue 11801022: Allow dragging a download only after the download is complete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk at 175906 Created 7 years, 11 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
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/file_path.h" 7 #include "base/file_path.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 private: 82 private:
83 // GClosureNotify handler for destroying a DragData object. |data| is assumed 83 // GClosureNotify handler for destroying a DragData object. |data| is assumed
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->GetFullPath())), 92 : url_(net::FilePathToFileURL(item->GetTargetFilePath())),
93 display_name_(item->GetFileNameToReportUser().LossyDisplayName()) { 93 display_name_(item->GetFileNameToReportUser().LossyDisplayName()) {
94 DCHECK(item->IsComplete());
94 } 95 }
95 96
96 void DownloadItemDrag::DragData::OnDragDataGet(GtkWidget* widget, 97 void DownloadItemDrag::DragData::OnDragDataGet(GtkWidget* widget,
97 GdkDragContext* context, 98 GdkDragContext* context,
98 GtkSelectionData* selection_data, 99 GtkSelectionData* selection_data,
99 guint target_type, 100 guint target_type,
100 guint time) { 101 guint time) {
101 ui::WriteURLWithName(selection_data, url_, display_name_, target_type); 102 ui::WriteURLWithName(selection_data, url_, display_name_, target_type);
102 } 103 }
103 104
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 guint target_type, guint time) { 182 guint target_type, guint time) {
182 bookmark_utils::WriteBookmarksToSelection(nodes_, selection_data, 183 bookmark_utils::WriteBookmarksToSelection(nodes_, selection_data,
183 target_type, profile_); 184 target_type, profile_);
184 } 185 }
185 186
186 // static 187 // static
187 void BookmarkDrag::BeginDrag(Profile* profile, 188 void BookmarkDrag::BeginDrag(Profile* profile,
188 const std::vector<const BookmarkNode*>& nodes) { 189 const std::vector<const BookmarkNode*>& nodes) {
189 new BookmarkDrag(profile, nodes); 190 new BookmarkDrag(profile, nodes);
190 } 191 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/download/download_util_mac.mm ('k') | chrome/browser/ui/gtk/download/download_item_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698