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