| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_provider_aura.h" | 5 #include "ui/events/gestures/gesture_provider_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/events/gesture_detection/gesture_config_helper.h" | 10 #include "ui/events/gesture_detection/gesture_configuration.h" |
| 11 #include "ui/events/gesture_detection/gesture_event_data.h" | 11 #include "ui/events/gesture_detection/gesture_event_data.h" |
| 12 #include "ui/events/gestures/gesture_configuration.h" | 12 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 GestureProviderAura::GestureProviderAura(GestureProviderAuraClient* client) | 16 GestureProviderAura::GestureProviderAura(GestureProviderAuraClient* client) |
| 17 : client_(client), | 17 : client_(client), |
| 18 filtered_gesture_provider_(ui::DefaultGestureProviderConfig(), this), | 18 filtered_gesture_provider_(DefaultGestureProviderConfig(), this), |
| 19 handling_event_(false) { | 19 handling_event_(false) { |
| 20 filtered_gesture_provider_.SetDoubleTapSupportForPlatformEnabled(false); | 20 filtered_gesture_provider_.SetDoubleTapSupportForPlatformEnabled(false); |
| 21 } | 21 } |
| 22 | 22 |
| 23 GestureProviderAura::~GestureProviderAura() {} | 23 GestureProviderAura::~GestureProviderAura() {} |
| 24 | 24 |
| 25 bool GestureProviderAura::OnTouchEvent(const TouchEvent& event) { | 25 bool GestureProviderAura::OnTouchEvent(const TouchEvent& event) { |
| 26 int index = pointer_state_.FindPointerIndexOfId(event.touch_id()); | 26 int index = pointer_state_.FindPointerIndexOfId(event.touch_id()); |
| 27 bool pointer_id_is_active = index != -1; | 27 bool pointer_id_is_active = index != -1; |
| 28 | 28 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 new ScopedVector<GestureEvent>(); | 115 new ScopedVector<GestureEvent>(); |
| 116 old_pending_gestures->swap(pending_gestures_); | 116 old_pending_gestures->swap(pending_gestures_); |
| 117 return old_pending_gestures; | 117 return old_pending_gestures; |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool GestureProviderAura::IsConsideredDoubleTap( | 120 bool GestureProviderAura::IsConsideredDoubleTap( |
| 121 const GestureEventData& previous_tap, | 121 const GestureEventData& previous_tap, |
| 122 const GestureEventData& current_tap) const { | 122 const GestureEventData& current_tap) const { |
| 123 if (current_tap.time - previous_tap.time > | 123 if (current_tap.time - previous_tap.time > |
| 124 base::TimeDelta::FromMilliseconds( | 124 base::TimeDelta::FromMilliseconds( |
| 125 ui::GestureConfiguration::max_time_between_double_click_in_ms())) { | 125 GestureConfiguration::GetInstance() |
| 126 ->max_time_between_double_click_in_ms())) { |
| 126 return false; | 127 return false; |
| 127 } | 128 } |
| 128 | 129 |
| 129 float double_tap_slop_square = | 130 float double_tap_slop_square = |
| 130 GestureConfiguration::max_distance_between_taps_for_double_tap(); | 131 GestureConfiguration::GetInstance() |
| 132 ->max_distance_between_taps_for_double_tap(); |
| 131 double_tap_slop_square *= double_tap_slop_square; | 133 double_tap_slop_square *= double_tap_slop_square; |
| 132 const float delta_x = previous_tap.x - current_tap.x; | 134 const float delta_x = previous_tap.x - current_tap.x; |
| 133 const float delta_y = previous_tap.y - current_tap.y; | 135 const float delta_y = previous_tap.y - current_tap.y; |
| 134 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); | 136 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); |
| 135 } | 137 } |
| 136 | 138 |
| 137 } // namespace content | 139 } // namespace content |
| OLD | NEW |