| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" | 5 #include "ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h" |
| 6 | 6 |
| 7 #include "ui/base/dragdrop/drag_drop_types.h" | 7 #include "ui/base/dragdrop/drag_drop_types.h" |
| 8 #include "ui/base/dragdrop/drag_source_win.h" | 8 #include "ui/base/dragdrop/drag_source_win.h" |
| 9 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 9 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 10 #include "ui/views/widget/desktop_aura/desktop_drop_target_win.h" | 10 #include "ui/views/widget/desktop_aura/desktop_drop_target_win.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 const ui::OSExchangeData& data, | 28 const ui::OSExchangeData& data, |
| 29 aura::RootWindow* root_window, | 29 aura::RootWindow* root_window, |
| 30 aura::Window* source_window, | 30 aura::Window* source_window, |
| 31 const gfx::Point& root_location, | 31 const gfx::Point& root_location, |
| 32 int operation, | 32 int operation, |
| 33 ui::DragDropTypes::DragEventSource source) { | 33 ui::DragDropTypes::DragEventSource source) { |
| 34 drag_drop_in_progress_ = true; | 34 drag_drop_in_progress_ = true; |
| 35 drag_operation_ = operation; | 35 drag_operation_ = operation; |
| 36 | 36 |
| 37 drag_source_ = new ui::DragSourceWin; | 37 drag_source_ = new ui::DragSourceWin; |
| 38 DWORD effects; | 38 DWORD effect; |
| 39 DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), | 39 HRESULT result = DoDragDrop( |
| 40 drag_source_, | 40 ui::OSExchangeDataProviderWin::GetIDataObject(data), |
| 41 ui::DragDropTypes::DragOperationToDropEffect(operation), | 41 drag_source_, |
| 42 &effects); | 42 ui::DragDropTypes::DragOperationToDropEffect(operation), |
| 43 &effect); |
| 43 | 44 |
| 44 drag_drop_in_progress_ = false; | 45 drag_drop_in_progress_ = false; |
| 45 | 46 |
| 46 return drag_operation_; | 47 if (result != DRAGDROP_S_DROP) |
| 48 effect = DROPEFFECT_NONE; |
| 49 |
| 50 return ui::DragDropTypes::DropEffectToDragOperation(effect); |
| 47 } | 51 } |
| 48 | 52 |
| 49 void DesktopDragDropClientWin::DragUpdate(aura::Window* target, | 53 void DesktopDragDropClientWin::DragUpdate(aura::Window* target, |
| 50 const ui::LocatedEvent& event) { | 54 const ui::LocatedEvent& event) { |
| 51 } | 55 } |
| 52 | 56 |
| 53 void DesktopDragDropClientWin::Drop(aura::Window* target, | 57 void DesktopDragDropClientWin::Drop(aura::Window* target, |
| 54 const ui::LocatedEvent& event) { | 58 const ui::LocatedEvent& event) { |
| 55 } | 59 } |
| 56 | 60 |
| 57 void DesktopDragDropClientWin::DragCancel() { | 61 void DesktopDragDropClientWin::DragCancel() { |
| 58 drag_source_->CancelDrag(); | 62 drag_source_->CancelDrag(); |
| 59 drag_operation_ = 0; | 63 drag_operation_ = 0; |
| 60 } | 64 } |
| 61 | 65 |
| 62 bool DesktopDragDropClientWin::IsDragDropInProgress() { | 66 bool DesktopDragDropClientWin::IsDragDropInProgress() { |
| 63 return drag_drop_in_progress_; | 67 return drag_drop_in_progress_; |
| 64 } | 68 } |
| 65 | 69 |
| 66 void DesktopDragDropClientWin::OnNativeWidgetDestroying(HWND window) { | 70 void DesktopDragDropClientWin::OnNativeWidgetDestroying(HWND window) { |
| 67 if (drop_target_.get()) { | 71 if (drop_target_.get()) { |
| 68 RevokeDragDrop(window); | 72 RevokeDragDrop(window); |
| 69 drop_target_ = NULL; | 73 drop_target_ = NULL; |
| 70 } | 74 } |
| 71 } | 75 } |
| 72 | 76 |
| 73 } // namespace views | 77 } // namespace views |
| OLD | NEW |