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" |
11 #include "views/event.h" | 11 #include "views/event.h" |
12 #include "views/view.h" | 12 #include "views/view.h" |
13 | 13 |
14 namespace views { | 14 namespace views { |
15 | 15 |
16 GestureManager::~GestureManager() { | 16 GestureManager::~GestureManager() { |
17 } | 17 } |
18 | 18 |
19 GestureManager* GestureManager::GetInstance() { | 19 GestureManager* GestureManager::GetInstance() { |
20 return Singleton<GestureManager>::get(); | 20 return Singleton<GestureManager>::get(); |
21 } | 21 } |
22 | 22 |
23 bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event, | 23 bool GestureManager::ProcessTouchEventForGesture(const TouchEvent& event, |
24 View* source, | 24 View* source, |
25 bool previouslyHandled) { | 25 View::TouchStatus status) { |
26 if (previouslyHandled) | 26 if (status != View::TOUCH_STATUS_UNKNOWN) |
27 return false; | 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.GetType() == Event::ET_TOUCH_PRESSED) { | 33 if (event.GetType() == Event::ET_TOUCH_PRESSED) { |
34 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchPressed"; | 34 DVLOG(1) << "GestureManager::ProcessTouchEventForGesture: TouchPressed"; |
35 MouseEvent mouse_event(Event::ET_MOUSE_PRESSED, event.x(), event.y(), | 35 MouseEvent mouse_event(Event::ET_MOUSE_PRESSED, event.x(), event.y(), |
36 event.GetFlags()); | 36 event.GetFlags()); |
37 source->OnMousePressed(mouse_event); | 37 source->OnMousePressed(mouse_event); |
(...skipping 17 matching lines...) Expand all Loading... |
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 |