| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "views/touchui/gesture_manager.h" | 5 #include "views/touchui/gesture_manager.h" |
| 6 #ifndef NDEBUG | 6 #ifndef NDEBUG |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #endif | 8 #endif |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event, | 23 bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event, |
| 24 View* source, | 24 View* source, |
| 25 View::TouchStatus status) { | 25 View::TouchStatus status) { |
| 26 if (status != View::TOUCH_STATUS_UNKNOWN) | 26 if (status != View::TOUCH_STATUS_UNKNOWN) |
| 27 return false; // The event was consumed by a touch sequence. | 27 return false; // The event was consumed by a touch sequence. |
| 28 | 28 |
| 29 // TODO(rjkroege): A realistic version of the GestureManager will | 29 // TODO(rjkroege): A realistic version of the GestureManager will |
| 30 // appear in a subsequent CL. This interim version permits verifying that the | 30 // appear in a subsequent CL. This interim version permits verifying that the |
| 31 // event distribution code works by turning all touch inputs into | 31 // event distribution code works by turning all touch inputs into |
| 32 // mouse approximations. | 32 // mouse approximations. |
| 33 if (event.type() == ui::ET_TOUCH_PRESSED) { | 33 if (event.GetType() == ui::ET_TOUCH_PRESSED) { |
| 34 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchPressed"; | 34 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchPressed"; |
| 35 MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, event.x(), event.y(), | 35 MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, event.x(), event.y(), |
| 36 event.flags()); | 36 event.GetFlags()); |
| 37 source->OnMousePressed(mouse_event); | 37 source->OnMousePressed(mouse_event); |
| 38 return true; | 38 return true; |
| 39 } | 39 } |
| 40 | 40 |
| 41 if (event.type() == ui::ET_TOUCH_RELEASED) { | 41 if (event.GetType() == ui::ET_TOUCH_RELEASED) { |
| 42 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchReleased"; | 42 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchReleased"; |
| 43 MouseEvent mouse_event(ui::ET_MOUSE_RELEASED, event.x(), event.y(), | 43 MouseEvent mouse_event(ui::ET_MOUSE_RELEASED, event.x(), event.y(), |
| 44 event.flags()); | 44 event.GetFlags()); |
| 45 source->OnMouseReleased(mouse_event, false); | 45 source->OnMouseReleased(mouse_event, false); |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 | 48 |
| 49 if (event.type() == ui::ET_TOUCH_MOVED) { | 49 if (event.GetType() == ui::ET_TOUCH_MOVED) { |
| 50 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchMotion"; | 50 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchMotion"; |
| 51 MouseEvent mouse_event(ui::ET_MOUSE_DRAGGED, event.x(), event.y(), | 51 MouseEvent mouse_event(ui::ET_MOUSE_DRAGGED, event.x(), event.y(), |
| 52 event.flags()); | 52 event.GetFlags()); |
| 53 source->OnMouseDragged(mouse_event); | 53 source->OnMouseDragged(mouse_event); |
| 54 return true; | 54 return true; |
| 55 } | 55 } |
| 56 | 56 |
| 57 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: unhandled event"; | 57 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: unhandled event"; |
| 58 return false; | 58 return false; |
| 59 } | 59 } |
| 60 | 60 |
| 61 GestureManager::GestureManager() { | 61 GestureManager::GestureManager() { |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace views | 64 } // namespace views |
| OLD | NEW |