summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-11 18:57:07 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-11 18:57:07 +0000
commit1ec2f92f9dafeacae9050c226d25f89e71aacc60 (patch)
tree769a869daa48b23244d414f05f6edf7d55fa659f /ui
parent4dc4018988db0302ce3abb7ecdd50d0722a75aaa (diff)
downloadchromium_src-1ec2f92f9dafeacae9050c226d25f89e71aacc60.zip
chromium_src-1ec2f92f9dafeacae9050c226d25f89e71aacc60.tar.gz
chromium_src-1ec2f92f9dafeacae9050c226d25f89e71aacc60.tar.bz2
Makes View only consume a long press if drag was started.
BUG=none TEST=none R=varunjain@chromium.org Review URL: https://chromiumcodereview.appspot.com/10377093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/views/view.cc11
-rw-r--r--ui/views/view.h3
2 files changed, 9 insertions, 5 deletions
diff --git a/ui/views/view.cc b/ui/views/view.cc
index d42ec5c..c8147b1 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -817,8 +817,8 @@ ui::TouchStatus View::OnTouchEvent(const TouchEvent& event) {
ui::GestureStatus View::OnGestureEvent(const GestureEvent& event) {
if (event.type() == ui::ET_GESTURE_LONG_PRESS) {
// TODO(XXX): Call CanStartDragForView first?
- DoDrag(event, event.location());
- return ui::GESTURE_STATUS_CONSUMED;
+ return DoDrag(event, event.location()) ?
+ ui::GESTURE_STATUS_CONSUMED : ui::GESTURE_STATUS_UNKNOWN;
}
return ui::GESTURE_STATUS_UNKNOWN;
}
@@ -2052,11 +2052,11 @@ void View::UpdateTooltip() {
// Drag and drop ---------------------------------------------------------------
-void View::DoDrag(const LocatedEvent& event, const gfx::Point& press_pt) {
+bool View::DoDrag(const LocatedEvent& event, const gfx::Point& press_pt) {
#if !defined(OS_MACOSX)
int drag_operations = GetDragOperations(press_pt);
if (drag_operations == ui::DragDropTypes::DRAG_NONE)
- return;
+ return false;
OSExchangeData data;
WriteDragData(press_pt, &data);
@@ -2066,6 +2066,9 @@ void View::DoDrag(const LocatedEvent& event, const gfx::Point& press_pt) {
gfx::Point widget_location(event.location());
ConvertPointToWidget(this, &widget_location);
GetWidget()->RunShellDrag(this, data, widget_location, drag_operations);
+ return true;
+#else
+ return false;
#endif // !defined(OS_MACOSX)
}
diff --git a/ui/views/view.h b/ui/views/view.h
index 53ae271..3e933c4 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -1314,7 +1314,8 @@ class VIEWS_EXPORT View : public ui::LayerDelegate,
// WriteDragData to write the data and GetDragOperations to determine the
// supported drag operations. When done, OnDragDone is invoked. |press_pt| is
// in the view's coordinate system.
- void DoDrag(const LocatedEvent& event, const gfx::Point& press_pt);
+ // Returns true if a drag was started.
+ bool DoDrag(const LocatedEvent& event, const gfx::Point& press_pt);
//////////////////////////////////////////////////////////////////////////////