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

Side by Side Diff: chrome/browser/download/drag_download_item_views.cc

Issue 246633004: Remove non USE_AURA code from views files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Just revert changes to ui/app_list/. Created 6 years, 8 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 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 "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "content/public/browser/download_item.h" 10 #include "content/public/browser/download_item.h"
11 #include "net/base/mime_util.h" 11 #include "net/base/mime_util.h"
12 #include "net/base/net_util.h" 12 #include "net/base/net_util.h"
13 #include "ui/aura/window.h"
14 #include "ui/aura/window_event_dispatcher.h"
13 #include "ui/base/dragdrop/drag_drop_types.h" 15 #include "ui/base/dragdrop/drag_drop_types.h"
14 #include "ui/base/dragdrop/drag_utils.h" 16 #include "ui/base/dragdrop/drag_utils.h"
15 #include "ui/base/dragdrop/file_info.h" 17 #include "ui/base/dragdrop/file_info.h"
16 #include "ui/base/dragdrop/os_exchange_data.h" 18 #include "ui/base/dragdrop/os_exchange_data.h"
17 #include "ui/gfx/image/image.h" 19 #include "ui/gfx/image/image.h"
18 #include "ui/gfx/image/image_skia.h" 20 #include "ui/gfx/image/image_skia.h"
19 #include "ui/gfx/point.h" 21 #include "ui/gfx/point.h"
20 #include "ui/gfx/screen.h" 22 #include "ui/gfx/screen.h"
21 #include "ui/views/widget/widget.h" 23 #include "ui/views/widget/widget.h"
24 #include "ui/wm/public/drag_drop_client.h"
22 #include "url/gurl.h" 25 #include "url/gurl.h"
23 26
24 #if defined(USE_AURA)
25 #include "ui/aura/window.h"
26 #include "ui/aura/window_event_dispatcher.h"
27 #include "ui/wm/public/drag_drop_client.h"
28 #endif
29
30 #if defined(OS_CHROMEOS) 27 #if defined(OS_CHROMEOS)
31 #include "chrome/browser/chromeos/drive/download_handler.h" 28 #include "chrome/browser/chromeos/drive/download_handler.h"
32 #endif 29 #endif
33 30
34 void DragDownloadItem(const content::DownloadItem* download, 31 void DragDownloadItem(const content::DownloadItem* download,
35 gfx::Image* icon, 32 gfx::Image* icon,
36 gfx::NativeView view) { 33 gfx::NativeView view) {
37 DCHECK(download); 34 DCHECK(download);
38 DCHECK_EQ(content::DownloadItem::COMPLETE, download->GetState()); 35 DCHECK_EQ(content::DownloadItem::COMPLETE, download->GetState());
39 36
(...skipping 13 matching lines...) Expand all
53 drive::DownloadHandler::GetForProfile(profile); 50 drive::DownloadHandler::GetForProfile(profile);
54 if (drive_download_handler && 51 if (drive_download_handler &&
55 drive_download_handler->IsDriveDownload(download)) 52 drive_download_handler->IsDriveDownload(download))
56 full_path = drive_download_handler->GetCacheFilePath(download); 53 full_path = drive_download_handler->GetCacheFilePath(download);
57 #endif 54 #endif
58 std::vector<ui::FileInfo> file_infos; 55 std::vector<ui::FileInfo> file_infos;
59 file_infos.push_back( 56 file_infos.push_back(
60 ui::FileInfo(full_path, download->GetFileNameToReportUser())); 57 ui::FileInfo(full_path, download->GetFileNameToReportUser()));
61 data.SetFilenames(file_infos); 58 data.SetFilenames(file_infos);
62 59
63 #if defined(USE_AURA)
64 aura::Window* root_window = view->GetRootWindow(); 60 aura::Window* root_window = view->GetRootWindow();
65 if (!root_window || !aura::client::GetDragDropClient(root_window)) 61 if (!root_window || !aura::client::GetDragDropClient(root_window))
66 return; 62 return;
67 63
68 gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint(); 64 gfx::Point location = gfx::Screen::GetScreenFor(view)->GetCursorScreenPoint();
69 // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below. 65 // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below.
70 aura::client::GetDragDropClient(root_window)->StartDragAndDrop( 66 aura::client::GetDragDropClient(root_window)->StartDragAndDrop(
71 data, 67 data,
72 root_window, 68 root_window,
73 view, 69 view,
74 location, 70 location,
75 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK, 71 ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK,
76 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); 72 ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
77 #else // We are on WIN without AURA
78 // We cannot use Widget::RunShellDrag on WIN since the |view| is backed by a
79 // WebContentsViewWin, not a NativeWidgetWin.
80 scoped_refptr<ui::DragSourceWin> drag_source(new ui::DragSourceWin);
81 // Run the drag and drop loop
82 DWORD effects;
83 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data),
84 drag_source.get(),
85 DROPEFFECT_COPY | DROPEFFECT_LINK,
86 &effects);
87 #endif
88 } 73 }
OLDNEW
« no previous file with comments | « apps/ui/views/app_window_frame_view.cc ('k') | chrome/browser/first_run/try_chrome_dialog_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698