From 493ba6474eb990b53cb34f57370d4660b2b6aa55 Mon Sep 17 00:00:00 2001 From: "sky@chromium.org" Date: Tue, 18 Aug 2009 21:24:34 +0000 Subject: Adds drop support for views on gtk. As X lazily provides drop data I needed to tweak the views API a bit. BUG=none TEST=none Review URL: http://codereview.chromium.org/165407 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23653 0039d316-1c4b-4281-b951-d872f2087c98 --- views/widget/drop_helper.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'views/widget/drop_helper.cc') diff --git a/views/widget/drop_helper.cc b/views/widget/drop_helper.cc index 35dcbd0..19b70b71 100644 --- a/views/widget/drop_helper.cc +++ b/views/widget/drop_helper.cc @@ -87,6 +87,10 @@ View* DropHelper::CalculateTargetViewImpl( } if (deepest_view) *deepest_view = view; + // TODO(sky): for the time being these are separate. Once I port chrome menu + // I can switch to the #else implementation and nuke the OS_WIN + // implementation. +#if defined(OS_WIN) // View under mouse changed, which means a new view may want the drop. // Walk the tree, stopping at target_view_ as we know it'll accept the // drop. @@ -94,6 +98,22 @@ View* DropHelper::CalculateTargetViewImpl( (!view->IsEnabled() || !view->CanDrop(data))) { view = view->GetParent(); } +#else + int formats = 0; + std::set custom_formats; + while (view && view != target_view_) { + if (view->IsEnabled() && + view->GetDropFormats(&formats, &custom_formats) && + data.HasAnyFormat(formats, custom_formats) && + (!check_can_drop || view->CanDrop(data))) { + // Found the view. + return view; + } + formats = 0; + custom_formats.clear(); + view = view->GetParent(); + } +#endif return view; } -- cgit v1.1