OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
| 6 |
| 7 #include "ui/base/dragdrop/drag_drop_types.h" |
| 8 #include "ui/base/dragdrop/drag_source.h" |
| 9 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 10 #include "ui/views/widget/desktop_aura/desktop_drop_target_win.h" |
| 11 #include "ui/views/widget/desktop_aura/desktop_root_window_host_win.h" |
| 12 #include "ui/views/widget/drop_target_win.h" |
| 13 |
| 14 namespace views { |
| 15 |
| 16 DesktopDragDropClientWin::DesktopDragDropClientWin( |
| 17 aura::RootWindow* root_window, |
| 18 HWND window) |
| 19 : drag_drop_in_progress_(false), |
| 20 drag_operation_(0) { |
| 21 drop_target_ = new DesktopDropTargetWin(root_window, window); |
| 22 } |
| 23 |
| 24 DesktopDragDropClientWin::~DesktopDragDropClientWin() { |
| 25 } |
| 26 |
| 27 int DesktopDragDropClientWin::StartDragAndDrop( |
| 28 const ui::OSExchangeData& data, |
| 29 aura::RootWindow* root_window, |
| 30 aura::Window* source_window, |
| 31 const gfx::Point& root_location, |
| 32 int operation, |
| 33 ui::DragDropTypes::DragEventSource source) { |
| 34 drag_drop_in_progress_ = true; |
| 35 drag_operation_ = operation; |
| 36 |
| 37 drag_source_ = new ui::DragSource; |
| 38 DWORD effects; |
| 39 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), |
| 40 drag_source_, |
| 41 ui::DragDropTypes::DragOperationToDropEffect(operation), |
| 42 &effects); |
| 43 |
| 44 drag_drop_in_progress_ = false; |
| 45 |
| 46 return drag_operation_; |
| 47 } |
| 48 |
| 49 void DesktopDragDropClientWin::DragUpdate(aura::Window* target, |
| 50 const ui::LocatedEvent& event) { |
| 51 } |
| 52 |
| 53 void DesktopDragDropClientWin::Drop(aura::Window* target, |
| 54 const ui::LocatedEvent& event) { |
| 55 } |
| 56 |
| 57 void DesktopDragDropClientWin::DragCancel() { |
| 58 drag_source_->CancelDrag(); |
| 59 drag_operation_ = 0; |
| 60 } |
| 61 |
| 62 bool DesktopDragDropClientWin::IsDragDropInProgress() { |
| 63 return drag_drop_in_progress_; |
| 64 } |
| 65 |
| 66 void DesktopDragDropClientWin::OnNativeWidgetDestroying(HWND window) { |
| 67 if (drop_target_.get()) { |
| 68 RevokeDragDrop(window); |
| 69 drop_target_ = NULL; |
| 70 } |
| 71 } |
| 72 |
| 73 } // namespace views |
OLD | NEW |