OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/events/gestures/gesture_recognizer_impl.h" | 5 #include "ui/events/gestures/gesture_recognizer_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
15 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
16 #include "ui/events/event_switches.h" | 16 #include "ui/events/event_switches.h" |
17 #include "ui/events/event_utils.h" | 17 #include "ui/events/event_utils.h" |
18 #include "ui/events/gestures/gesture_configuration.h" | 18 #include "ui/events/gesture_detection/gesture_configuration.h" |
19 #include "ui/events/gestures/gesture_types.h" | 19 #include "ui/events/gestures/gesture_types.h" |
20 | 20 |
21 namespace ui { | 21 namespace ui { |
22 | 22 |
23 namespace { | 23 namespace { |
24 | 24 |
25 template <typename T> | 25 template <typename T> |
26 void TransferConsumer(GestureConsumer* current_consumer, | 26 void TransferConsumer(GestureConsumer* current_consumer, |
27 GestureConsumer* new_consumer, | 27 GestureConsumer* new_consumer, |
28 std::map<GestureConsumer*, T>* map) { | 28 std::map<GestureConsumer*, T>* map) { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 const GestureEvent& event) { | 85 const GestureEvent& event) { |
86 GestureConsumer* target = NULL; | 86 GestureConsumer* target = NULL; |
87 int touch_id = event.details().oldest_touch_id(); | 87 int touch_id = event.details().oldest_touch_id(); |
88 target = touch_id_target_for_gestures_[touch_id]; | 88 target = touch_id_target_for_gestures_[touch_id]; |
89 return target; | 89 return target; |
90 } | 90 } |
91 | 91 |
92 GestureConsumer* GestureRecognizerImpl::GetTargetForLocation( | 92 GestureConsumer* GestureRecognizerImpl::GetTargetForLocation( |
93 const gfx::PointF& location, int source_device_id) { | 93 const gfx::PointF& location, int source_device_id) { |
94 const float max_distance = | 94 const float max_distance = |
95 GestureConfiguration::max_separation_for_gesture_touches_in_pixels(); | 95 GestureConfiguration::GetInstance() |
| 96 ->max_separation_for_gesture_touches_in_pixels(); |
96 | 97 |
97 gfx::PointF closest_point; | 98 gfx::PointF closest_point; |
98 int closest_touch_id = 0; | 99 int closest_touch_id = 0; |
99 double closest_distance_squared = std::numeric_limits<double>::infinity(); | 100 double closest_distance_squared = std::numeric_limits<double>::infinity(); |
100 | 101 |
101 std::map<GestureConsumer*, GestureProviderAura*>::iterator i; | 102 std::map<GestureConsumer*, GestureProviderAura*>::iterator i; |
102 for (i = consumer_gesture_provider_.begin(); | 103 for (i = consumer_gesture_provider_.begin(); |
103 i != consumer_gesture_provider_.end(); | 104 i != consumer_gesture_provider_.end(); |
104 ++i) { | 105 ++i) { |
105 const MotionEventAura& pointer_state = i->second->pointer_state(); | 106 const MotionEventAura& pointer_state = i->second->pointer_state(); |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 std::vector<GestureEventHelper*>::iterator it; | 340 std::vector<GestureEventHelper*>::iterator it; |
340 for (it = helpers.begin(); it != helpers.end(); ++it) | 341 for (it = helpers.begin(); it != helpers.end(); ++it) |
341 gesture_recognizer->AddGestureEventHelper(*it); | 342 gesture_recognizer->AddGestureEventHelper(*it); |
342 | 343 |
343 helpers.clear(); | 344 helpers.clear(); |
344 g_gesture_recognizer_instance = | 345 g_gesture_recognizer_instance = |
345 static_cast<GestureRecognizerImpl*>(gesture_recognizer); | 346 static_cast<GestureRecognizerImpl*>(gesture_recognizer); |
346 } | 347 } |
347 | 348 |
348 } // namespace ui | 349 } // namespace ui |
OLD | NEW |