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-19 03:33:44 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-19 03:33:44 +0000
commit134c47b9e74ab7aa6dce7e1beeaf5e406a925b76 (patch)
treef4db8cfc40f3eb8a66421ee415f575cf6a76d638 /views/widget/drop_helper.cc
parentcf5811e922d5aa215a4094bd88e70c38c6ddc57c (diff)
downloadchromium_src-134c47b9e74ab7aa6dce7e1beeaf5e406a925b76.zip
chromium_src-134c47b9e74ab7aa6dce7e1beeaf5e406a925b76.tar.gz
chromium_src-134c47b9e74ab7aa6dce7e1beeaf5e406a925b76.tar.bz2
Relands drop support:
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/173025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23690 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;
}