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

Unified Diff: chrome/browser/download/drag_download_item_views.cc

Issue 2750253002: Reland 4e4eae4cbe6136b538a: Make download item drags look like bookmark (Closed)
Patch Set: with fix Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | ui/views/button_drag_utils.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/drag_download_item_views.cc
diff --git a/chrome/browser/download/drag_download_item_views.cc b/chrome/browser/download/drag_download_item_views.cc
index c5f81094656d0310684d59ecca8e9ff56fc4600d..4ee1b6d8231ec655b7a8dbfc1f4f0c1d0a6d84ce 100644
--- a/chrome/browser/download/drag_download_item_views.cc
+++ b/chrome/browser/download/drag_download_item_views.cc
@@ -14,13 +14,13 @@
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/dragdrop/drag_drop_types.h"
-#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/dragdrop/file_info.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/display/screen.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
+#include "ui/views/button_drag_utils.h"
#include "ui/views/widget/widget.h"
#include "url/gurl.h"
@@ -34,13 +34,17 @@ void DragDownloadItem(const content::DownloadItem* download,
DCHECK(download);
DCHECK_EQ(content::DownloadItem::COMPLETE, download->GetState());
+ aura::Window* root_window = view->GetRootWindow();
+ if (!root_window || !aura::client::GetDragDropClient(root_window))
sky 2017/03/16 03:38:05 Under what circumstances would there be no root or
Evan Stade 2017/03/16 14:14:50 I have no idea, I just moved the check from below
+ return;
+
// Set up our OLE machinery
ui::OSExchangeData data;
- drag_utils::CreateDragImageForFile(
- download->GetFileNameToReportUser(),
- icon ? icon->AsImageSkia() : gfx::ImageSkia(),
- &data);
+ button_drag_utils::SetDragImage(
+ GURL(), download->GetFileNameToReportUser().BaseName().LossyDisplayName(),
+ icon ? icon->AsImageSkia() : gfx::ImageSkia(), nullptr,
+ *views::Widget::GetTopLevelWidgetForNativeView(view), &data);
Evan Stade 2017/03/16 00:03:30 key to fixing the crash (which occurred for chrome
base::FilePath full_path = download->GetTargetFilePath();
#if defined(OS_CHROMEOS)
@@ -57,10 +61,6 @@ void DragDownloadItem(const content::DownloadItem* download,
ui::FileInfo(full_path, download->GetFileNameToReportUser()));
data.SetFilenames(file_infos);
- aura::Window* root_window = view->GetRootWindow();
- if (!root_window || !aura::client::GetDragDropClient(root_window))
- return;
-
gfx::Point location = display::Screen::GetScreen()->GetCursorScreenPoint();
// TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below.
aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | ui/views/button_drag_utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698