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

Unified Diff: ui/events/gesture_detection/gesture_config_helper_aura.cc

Issue 128613003: [Tracking Patch] Unified gesture detection (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup Created 6 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/gesture_detection/gesture_config_helper_aura.cc
diff --git a/ui/events/gesture_detection/gesture_config_helper_aura.cc b/ui/events/gesture_detection/gesture_config_helper_aura.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1be5eaa135b54f48ca8c6d8653749437f75aa3fa
--- /dev/null
+++ b/ui/events/gesture_detection/gesture_config_helper_aura.cc
@@ -0,0 +1,72 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/events/gesture_detection/gesture_config_helper.h"
+
+#include "ui/events/gesture_configuration.h"
+#include "ui/gfx/screen.h"
+
+namespace ui {
+namespace {
+
+GestureDetector::Config DefaultGestureDetectorConfig() {
+ GestureDetector::Config config;
+
+ config.longpress_timeout =
+ base::TimeDelta::FromSecondsF(
+ GestureConfiguration::long_press_time_in_seconds());
tdresser 2014/02/19 17:44:12 Could be wrapped onto two lines, as could a few ot
+ config.tap_timeout = ;
tdresser 2014/02/19 17:44:12 That is a scary ;.
jdduke (slow) 2014/02/19 18:51:58 Haha, yeah, you'll notice I never bothered compili
+ base::TimeDelta::FromMilliseconds(
+ GestureConfiguration::show_press_delay_in_ms());
+ config.double_tap_timeout = ;
tdresser 2014/02/19 17:44:12 ;
jdduke (slow) 2014/02/19 18:51:58 Done.
+ base::TimeDelta::FromSecondsF(
+ GestureConfiguration::semi_long_press_time_in_seconds());
+ config.scaled_touch_slop =
+ GestureConfiguration::max_touch_move_in_pixels_for_click();
+ config.scaled_double_tap_slop =
+ GestureConfiguration::max_distance_between_taps_for_double_tap();
+ config.scaled_minimum_fling_velocity =
+ GestureConfiguration::min_scroll_velocity();
+ config.scaled_maximum_fling_velocity =
+ GestureConfiguration::fling_velocity_cap();
+
+ return config;
+}
+
+ScaleGestureDetector::Config DefaultScaleGestureDetectorConfig() {
+ ScaleGestureDetector::Config config;
+
+ config.gesture_detector_config = GetGestureDetectorConfig();
+ config.quick_scale_enabled = false;
+ config.min_scaling_touch_major = GestureConfiguration::default_radius() / 2;
+ config.min_scaling_span =
+ GestureConfiguration::min_distance_for_pinch_scroll_in_pixels()
+
+ return config;
+}
+
+SnapScrollController::Config DefaultSnapScrollControllerConfig() {
+ SnapScrollController::Config config;
+
+ const gfx::Display& display =
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay();
+
+ config.screen_width_pixels = display.GetSizeInPixel().width();
+ config.screen_height_pixels = display.GetSizeInPixel().height();
+ config.device_scale_factor = display.device_scale_factor();
+
+ return config;
+}
+
+GestureHandler::Config DefaultGestureHandlerConfig() {
+ GestureHandler::Config config;
+ config.gesture_detector_config = DefaultGestureDetectorConfig();
+ config.scale_gesture_detector_config = DefaultScaleGestureDetectorConfig();
+ config.snap_scroll_controller_config = DefaultSnapScrollControllerConfig();
+ return config;
+}
+
+} // namespace ui
+
+#endif // UI_EVENTS_GESTURE_DETECTION__H_

Powered by Google App Engine
This is Rietveld 408576698