Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Side by Side Diff: ui/events/gestures/gesture_provider_aura.cc

Issue 613373004: Adopt ui::GestureConfiguration on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
13 12
14 namespace ui { 13 namespace ui {
15 14
16 GestureProviderAura::GestureProviderAura(GestureProviderAuraClient* client) 15 GestureProviderAura::GestureProviderAura(GestureProviderAuraClient* client)
17 : client_(client), 16 : client_(client),
18 filtered_gesture_provider_(ui::DefaultGestureProviderConfig(), this), 17 filtered_gesture_provider_(ui::DefaultGestureProviderConfig(), this),
19 handling_event_(false) { 18 handling_event_(false) {
20 filtered_gesture_provider_.SetDoubleTapSupportForPlatformEnabled(false); 19 filtered_gesture_provider_.SetDoubleTapSupportForPlatformEnabled(false);
21 } 20 }
22 21
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 new ScopedVector<GestureEvent>(); 114 new ScopedVector<GestureEvent>();
116 old_pending_gestures->swap(pending_gestures_); 115 old_pending_gestures->swap(pending_gestures_);
117 return old_pending_gestures; 116 return old_pending_gestures;
118 } 117 }
119 118
120 bool GestureProviderAura::IsConsideredDoubleTap( 119 bool GestureProviderAura::IsConsideredDoubleTap(
121 const GestureEventData& previous_tap, 120 const GestureEventData& previous_tap,
122 const GestureEventData& current_tap) const { 121 const GestureEventData& current_tap) const {
123 if (current_tap.time - previous_tap.time > 122 if (current_tap.time - previous_tap.time >
124 base::TimeDelta::FromMilliseconds( 123 base::TimeDelta::FromMilliseconds(
125 ui::GestureConfiguration::max_time_between_double_click_in_ms())) { 124 ui::GestureConfiguration::GetInstance()
125 ->max_time_between_double_click_in_ms())) {
126 return false; 126 return false;
127 } 127 }
128 128
129 float double_tap_slop_square = 129 float double_tap_slop_square =
130 GestureConfiguration::max_distance_between_taps_for_double_tap(); 130 GestureConfiguration::GetInstance()
131 ->max_distance_between_taps_for_double_tap();
131 double_tap_slop_square *= double_tap_slop_square; 132 double_tap_slop_square *= double_tap_slop_square;
132 const float delta_x = previous_tap.x - current_tap.x; 133 const float delta_x = previous_tap.x - current_tap.x;
133 const float delta_y = previous_tap.y - current_tap.y; 134 const float delta_y = previous_tap.y - current_tap.y;
134 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square); 135 return (delta_x * delta_x + delta_y * delta_y < double_tap_slop_square);
135 } 136 }
136 137
137 } // namespace content 138 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698