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() |
dcheng
2013/05/28 20:34:02
Nit: do we need this or can we just force all loca
Hongbo Min
2013/05/29 06:08:04
I prefer to reserve it since it is unnecessary to
| |
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), event_source_(event_source) { | |
10 } | 16 } |
11 | 17 |
12 HRESULT DragSourceWin::QueryContinueDrag(BOOL escape_pressed, DWORD key_state) { | 18 HRESULT DragSourceWin::QueryContinueDrag(BOOL escape_pressed, DWORD key_state) { |
13 if (cancel_drag_) | 19 if (cancel_drag_) |
14 return DRAGDROP_S_CANCEL; | 20 return DRAGDROP_S_CANCEL; |
15 | 21 |
16 if (escape_pressed) { | 22 if (escape_pressed) { |
17 OnDragSourceCancel(); | 23 OnDragSourceCancel(); |
18 return DRAGDROP_S_CANCEL; | 24 return DRAGDROP_S_CANCEL; |
19 } | 25 } |
20 | 26 |
21 if (!(key_state & MK_LBUTTON)) { | 27 // On Windows, the touch-initiated drag-drop is driven by mouse right down |
28 // event programmatically. | |
29 if ((event_source_ == DragDropTypes::DRAG_EVENT_SOURCE_MOUSE && | |
30 !(key_state & MK_LBUTTON)) || | |
31 (event_source_ == DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && | |
32 !(key_state && MK_RBUTTON))) { | |
22 OnDragSourceDrop(); | 33 OnDragSourceDrop(); |
23 return DRAGDROP_S_DROP; | 34 return DRAGDROP_S_DROP; |
24 } | 35 } |
25 | 36 |
26 OnDragSourceMove(); | 37 OnDragSourceMove(); |
27 return S_OK; | 38 return S_OK; |
28 } | 39 } |
29 | 40 |
30 HRESULT DragSourceWin::GiveFeedback(DWORD effect) { | 41 HRESULT DragSourceWin::GiveFeedback(DWORD effect) { |
31 return DRAGDROP_S_USEDEFAULTCURSORS; | 42 return DRAGDROP_S_USEDEFAULTCURSORS; |
(...skipping 14 matching lines...) Expand all Loading... | |
46 base::RefCountedThreadSafe<DragSourceWin>::AddRef(); | 57 base::RefCountedThreadSafe<DragSourceWin>::AddRef(); |
47 return 0; | 58 return 0; |
48 } | 59 } |
49 | 60 |
50 ULONG DragSourceWin::Release() { | 61 ULONG DragSourceWin::Release() { |
51 base::RefCountedThreadSafe<DragSourceWin>::Release(); | 62 base::RefCountedThreadSafe<DragSourceWin>::Release(); |
52 return 0; | 63 return 0; |
53 } | 64 } |
54 | 65 |
55 } // namespace ui | 66 } // namespace ui |
OLD | NEW |