Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: ui/base/dragdrop/drag_source_win.cc

Issue 14122008: Enable touch-initiated drag-drop work on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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), event_source_(event_source) {
sky 2013/06/07 21:29:50 when you wrap, each param on its own line.
Hongbo Min 2013/06/08 03:08:49 Done.
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
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
OLDNEW
« ui/base/dragdrop/drag_source_win.h ('K') | « ui/base/dragdrop/drag_source_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698