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