OLD | NEW |
| (Empty) |
1 // Copyright (c) 2010 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 "app/win/drag_source.h" | |
6 | |
7 namespace app { | |
8 namespace win { | |
9 | |
10 DragSource::DragSource() : cancel_drag_(false) { | |
11 } | |
12 | |
13 HRESULT DragSource::QueryContinueDrag(BOOL escape_pressed, DWORD key_state) { | |
14 if (cancel_drag_) | |
15 return DRAGDROP_S_CANCEL; | |
16 | |
17 if (escape_pressed) { | |
18 OnDragSourceCancel(); | |
19 return DRAGDROP_S_CANCEL; | |
20 } | |
21 | |
22 if (!(key_state & MK_LBUTTON)) { | |
23 OnDragSourceDrop(); | |
24 return DRAGDROP_S_DROP; | |
25 } | |
26 | |
27 OnDragSourceMove(); | |
28 return S_OK; | |
29 } | |
30 | |
31 HRESULT DragSource::GiveFeedback(DWORD effect) { | |
32 return DRAGDROP_S_USEDEFAULTCURSORS; | |
33 } | |
34 | |
35 HRESULT DragSource::QueryInterface(const IID& iid, void** object) { | |
36 *object = NULL; | |
37 if (IsEqualIID(iid, IID_IUnknown) || IsEqualIID(iid, IID_IDropSource)) { | |
38 *object = this; | |
39 } else { | |
40 return E_NOINTERFACE; | |
41 } | |
42 AddRef(); | |
43 return S_OK; | |
44 } | |
45 | |
46 ULONG DragSource::AddRef() { | |
47 base::RefCountedThreadSafe<DragSource>::AddRef(); | |
48 return 0; | |
49 } | |
50 | |
51 ULONG DragSource::Release() { | |
52 base::RefCountedThreadSafe<DragSource>::Release(); | |
53 return 0; | |
54 } | |
55 | |
56 } // namespace win | |
57 } // namespace app | |
OLD | NEW |