diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-17 20:44:38 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-17 20:44:38 +0000 |
commit | 79a4c1e532a74ac74d72f883e52e30019fe9e731 (patch) | |
tree | 2fc9915dc6e1fe9c4b9bea3bdda5ef211da49980 /app/win/drag_source.cc | |
parent | 13147160ae28933269024ba973f0a1ae3d11a57d (diff) | |
download | chromium_src-79a4c1e532a74ac74d72f883e52e30019fe9e731.zip chromium_src-79a4c1e532a74ac74d72f883e52e30019fe9e731.tar.gz chromium_src-79a4c1e532a74ac74d72f883e52e30019fe9e731.tar.bz2 |
Move BaseDropTarget and BaseDragSource from base to app/win. Remove the "Base" class name prefix and put in the app::win namespace.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/3822007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62900 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/win/drag_source.cc')
-rw-r--r-- | app/win/drag_source.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/app/win/drag_source.cc b/app/win/drag_source.cc new file mode 100644 index 0000000..a695a33 --- /dev/null +++ b/app/win/drag_source.cc @@ -0,0 +1,57 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/win/drag_source.h" + +namespace app { +namespace win { + +DragSource::DragSource() : cancel_drag_(false) { +} + +HRESULT DragSource::QueryContinueDrag(BOOL escape_pressed, DWORD key_state) { + if (cancel_drag_) + return DRAGDROP_S_CANCEL; + + if (escape_pressed) { + OnDragSourceCancel(); + return DRAGDROP_S_CANCEL; + } + + if (!(key_state & MK_LBUTTON)) { + OnDragSourceDrop(); + return DRAGDROP_S_DROP; + } + + OnDragSourceMove(); + return S_OK; +} + +HRESULT DragSource::GiveFeedback(DWORD effect) { + return DRAGDROP_S_USEDEFAULTCURSORS; +} + +HRESULT DragSource::QueryInterface(const IID& iid, void** object) { + *object = NULL; + if (IsEqualIID(iid, IID_IUnknown) || IsEqualIID(iid, IID_IDropSource)) { + *object = this; + } else { + return E_NOINTERFACE; + } + AddRef(); + return S_OK; +} + +ULONG DragSource::AddRef() { + base::RefCountedThreadSafe<DragSource>::AddRef(); + return 0; +} + +ULONG DragSource::Release() { + base::RefCountedThreadSafe<DragSource>::Release(); + return 0; +} + +} // namespace win +} // namespace app |