summaryrefslogtreecommitdiffstats
path: root/views/widget/drop_helper.cc
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-18 21:24:34 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-18 21:24:34 +0000
commit493ba6474eb990b53cb34f57370d4660b2b6aa55 (patch)
treec53f8ea803354c4d4006024dda3e39abe6fc9cc0 /views/widget/drop_helper.cc
parentbbe8521434be58c20cb2a41167bb947e95fc6b4e (diff)
downloadchromium_src-493ba6474eb990b53cb34f57370d4660b2b6aa55.zip
chromium_src-493ba6474eb990b53cb34f57370d4660b2b6aa55.tar.gz
chromium_src-493ba6474eb990b53cb34f57370d4660b2b6aa55.tar.bz2
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
Diffstat (limited to 'views/widget/drop_helper.cc')
-rw-r--r--views/widget/drop_helper.cc20
1 files changed, 20 insertions, 0 deletions
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<OSExchangeData::CustomFormat> 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;
}