diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-22 02:09:58 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-22 02:09:58 +0000 |
commit | c13be0d2381881a8ee2a90fecb8c74757972889c (patch) | |
tree | 98f9808c5492cd76b79bfc8e80585be395830cbb /ui/views/widget/drop_target_win.cc | |
parent | c0cfa519feb222571f5d046eb448aa422466bf45 (diff) | |
download | chromium_src-c13be0d2381881a8ee2a90fecb8c74757972889c.zip chromium_src-c13be0d2381881a8ee2a90fecb8c74757972889c.tar.gz chromium_src-c13be0d2381881a8ee2a90fecb8c74757972889c.tar.bz2 |
views: Move widget/ directory to ui/views.
BUG=104039
R=ben@chromium.org
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=110949
Review URL: http://codereview.chromium.org/8598031
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111077 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/widget/drop_target_win.cc')
-rw-r--r-- | ui/views/widget/drop_target_win.cc | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/ui/views/widget/drop_target_win.cc b/ui/views/widget/drop_target_win.cc new file mode 100644 index 0000000..6ddeb1e --- /dev/null +++ b/ui/views/widget/drop_target_win.cc @@ -0,0 +1,63 @@ +// Copyright (c) 2011 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 "ui/views/widget/drop_target_win.h" + +#include "ui/base/dragdrop/drag_drop_types.h" +#include "ui/base/dragdrop/os_exchange_data.h" +#include "ui/base/dragdrop/os_exchange_data_provider_win.h" +#include "ui/gfx/point.h" +#include "ui/views/widget/root_view.h" +#include "ui/views/widget/widget.h" + +using ui::OSExchangeData; +using ui::OSExchangeDataProviderWin; + +namespace views { + +DropTargetWin::DropTargetWin(internal::RootView* root_view) + : ui::DropTarget(root_view->GetWidget()->GetNativeView()), + helper_(root_view) { +} + +DropTargetWin::~DropTargetWin() { +} + +void DropTargetWin::ResetTargetViewIfEquals(View* view) { + helper_.ResetTargetViewIfEquals(view); +} + +DWORD DropTargetWin::OnDragOver(IDataObject* data_object, + DWORD key_state, + POINT cursor_position, + DWORD effect) { + gfx::Point root_view_location(cursor_position.x, cursor_position.y); + View::ConvertPointToView(NULL, helper_.root_view(), &root_view_location); + OSExchangeData data(new OSExchangeDataProviderWin(data_object)); + int drop_operation = + helper_.OnDragOver(data, root_view_location, + ui::DragDropTypes::DropEffectToDragOperation(effect)); + return ui::DragDropTypes::DragOperationToDropEffect(drop_operation); +} + +void DropTargetWin::OnDragLeave(IDataObject* data_object) { + helper_.OnDragExit(); +} + +DWORD DropTargetWin::OnDrop(IDataObject* data_object, + DWORD key_state, + POINT cursor_position, + DWORD effect) { + gfx::Point root_view_location(cursor_position.x, cursor_position.y); + View::ConvertPointToView(NULL, helper_.root_view(), &root_view_location); + + OSExchangeData data(new OSExchangeDataProviderWin(data_object)); + int drop_operation = ui::DragDropTypes::DropEffectToDragOperation(effect); + drop_operation = helper_.OnDragOver(data, root_view_location, + drop_operation); + drop_operation = helper_.OnDrop(data, root_view_location, drop_operation); + return ui::DragDropTypes::DragOperationToDropEffect(drop_operation); +} + +} // namespace views |