OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/download/drag_download_item.h" | 5 #include "chrome/browser/download/drag_download_item.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "content/public/browser/download_item.h" | 9 #include "content/public/browser/download_item.h" |
10 #include "net/base/mime_util.h" | 10 #include "net/base/mime_util.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 net::GetMimeTypeFromFile(full_path, &mime_type); | 51 net::GetMimeTypeFromFile(full_path, &mime_type); |
52 | 52 |
53 // Add URL so that we can load supported files when dragged to WebContents. | 53 // Add URL so that we can load supported files when dragged to WebContents. |
54 if (net::IsSupportedMimeType(mime_type)) { | 54 if (net::IsSupportedMimeType(mime_type)) { |
55 data.SetURL(net::FilePathToFileURL(full_path), | 55 data.SetURL(net::FilePathToFileURL(full_path), |
56 download->GetFileNameToReportUser().LossyDisplayName()); | 56 download->GetFileNameToReportUser().LossyDisplayName()); |
57 } | 57 } |
58 | 58 |
59 #if !defined(TOOLKIT_GTK) | 59 #if !defined(TOOLKIT_GTK) |
60 #if defined(USE_AURA) | 60 #if defined(USE_AURA) |
61 aura::RootWindow* root_window = view->GetRootWindow(); | 61 aura::Window* root_window = view->GetRootWindow(); |
62 if (!root_window || !aura::client::GetDragDropClient(root_window)) | 62 if (!root_window || !aura::client::GetDragDropClient(root_window)) |
63 return; | 63 return; |
64 | 64 |
65 gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint(); | 65 gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint(); |
66 // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below. | 66 // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below. |
67 aura::client::GetDragDropClient(root_window)->StartDragAndDrop( | 67 aura::client::GetDragDropClient(root_window)->StartDragAndDrop( |
68 data, | 68 data, |
69 root_window, | 69 root_window, |
70 view, | 70 view, |
71 location, | 71 location, |
(...skipping 18 matching lines...) Expand all Loading... |
90 | 90 |
91 views::NativeWidgetGtk* widget = static_cast<views::NativeWidgetGtk*>( | 91 views::NativeWidgetGtk* widget = static_cast<views::NativeWidgetGtk*>( |
92 views::Widget::GetWidgetForNativeView(root)->native_widget()); | 92 views::Widget::GetWidgetForNativeView(root)->native_widget()); |
93 if (!widget) | 93 if (!widget) |
94 return; | 94 return; |
95 | 95 |
96 widget->DoDrag(data, | 96 widget->DoDrag(data, |
97 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); | 97 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK); |
98 #endif // TOOLKIT_GTK | 98 #endif // TOOLKIT_GTK |
99 } | 99 } |
OLD | NEW |