Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / ui / base / dragdrop / drag_source_win.cc
blob292ba3e111f7b4e60f2512776db59a78e9967683
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
3 // found in the LICENSE file.
5 #include "ui/base/dragdrop/drag_source_win.h"
7 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
9 namespace ui {
11 DragSourceWin::DragSourceWin() : cancel_drag_(false), data_(nullptr) {
14 HRESULT DragSourceWin::QueryContinueDrag(BOOL escape_pressed, DWORD key_state) {
15 if (cancel_drag_)
16 return DRAGDROP_S_CANCEL;
18 if (escape_pressed) {
19 OnDragSourceCancel();
20 return DRAGDROP_S_CANCEL;
23 if (!(key_state & MK_LBUTTON)) {
24 OnDragSourceDrop();
25 return DRAGDROP_S_DROP;
28 OnDragSourceMove();
29 return S_OK;
32 HRESULT DragSourceWin::GiveFeedback(DWORD effect) {
33 return DRAGDROP_S_USEDEFAULTCURSORS;
36 void DragSourceWin::OnDragSourceDrop() {
37 DCHECK(data_);
38 ui::OSExchangeDataProviderWin::GetDataObjectImpl(*data_)
39 ->set_in_drag_loop(false);
42 } // namespace ui