| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/dragdrop/drag_source_win.h" | 5 #include "ui/base/dragdrop/drag_source_win.h" |
| 6 | 6 |
| 7 namespace ui { | 7 namespace ui { |
| 8 | 8 |
| 9 DragSourceWin::DragSourceWin() : cancel_drag_(false) { | 9 DragSourceWin::DragSourceWin() |
| 10 : cancel_drag_(false), |
| 11 event_source_(DragDropTypes::DRAG_EVENT_SOURCE_MOUSE) { |
| 12 } |
| 13 |
| 14 DragSourceWin::DragSourceWin(DragDropTypes::DragEventSource event_source) |
| 15 : cancel_drag_(false), |
| 16 event_source_(event_source) { |
| 10 } | 17 } |
| 11 | 18 |
| 12 HRESULT DragSourceWin::QueryContinueDrag(BOOL escape_pressed, DWORD key_state) { | 19 HRESULT DragSourceWin::QueryContinueDrag(BOOL escape_pressed, DWORD key_state) { |
| 13 if (cancel_drag_) | 20 if (cancel_drag_) |
| 14 return DRAGDROP_S_CANCEL; | 21 return DRAGDROP_S_CANCEL; |
| 15 | 22 |
| 16 if (escape_pressed) { | 23 if (escape_pressed) { |
| 17 OnDragSourceCancel(); | 24 OnDragSourceCancel(); |
| 18 return DRAGDROP_S_CANCEL; | 25 return DRAGDROP_S_CANCEL; |
| 19 } | 26 } |
| 20 | 27 |
| 21 if (!(key_state & MK_LBUTTON)) { | 28 // On Windows, the touch-initiated drag-drop is driven by mouse right down |
| 29 // event programmatically. |
| 30 if ((event_source_ == DragDropTypes::DRAG_EVENT_SOURCE_MOUSE && |
| 31 !(key_state & MK_LBUTTON)) || |
| 32 (event_source_ == DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && |
| 33 !(key_state && MK_RBUTTON))) { |
| 22 OnDragSourceDrop(); | 34 OnDragSourceDrop(); |
| 23 return DRAGDROP_S_DROP; | 35 return DRAGDROP_S_DROP; |
| 24 } | 36 } |
| 25 | 37 |
| 26 OnDragSourceMove(); | 38 OnDragSourceMove(); |
| 27 return S_OK; | 39 return S_OK; |
| 28 } | 40 } |
| 29 | 41 |
| 30 HRESULT DragSourceWin::GiveFeedback(DWORD effect) { | 42 HRESULT DragSourceWin::GiveFeedback(DWORD effect) { |
| 31 return DRAGDROP_S_USEDEFAULTCURSORS; | 43 return DRAGDROP_S_USEDEFAULTCURSORS; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 46 base::RefCountedThreadSafe<DragSourceWin>::AddRef(); | 58 base::RefCountedThreadSafe<DragSourceWin>::AddRef(); |
| 47 return 0; | 59 return 0; |
| 48 } | 60 } |
| 49 | 61 |
| 50 ULONG DragSourceWin::Release() { | 62 ULONG DragSourceWin::Release() { |
| 51 base::RefCountedThreadSafe<DragSourceWin>::Release(); | 63 base::RefCountedThreadSafe<DragSourceWin>::Release(); |
| 52 return 0; | 64 return 0; |
| 53 } | 65 } |
| 54 | 66 |
| 55 } // namespace ui | 67 } // namespace ui |
| OLD | NEW |