| 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/gfx/android/view_configuration.h" | 5 #include "ui/gfx/android/view_configuration.h" |
| 6 | 6 |
| 7 #include "base/android/context_utils.h" | |
| 8 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 9 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 10 #include "base/macros.h" | 9 #include "base/macros.h" |
| 11 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
| 12 #include "jni/ViewConfigurationHelper_jni.h" | 11 #include "jni/ViewConfigurationHelper_jni.h" |
| 13 | 12 |
| 14 using base::android::AttachCurrentThread; | 13 using base::android::AttachCurrentThread; |
| 15 using base::android::GetApplicationContext; | |
| 16 using base::android::JavaParamRef; | 14 using base::android::JavaParamRef; |
| 17 | 15 |
| 18 namespace gfx { | 16 namespace gfx { |
| 19 | 17 |
| 20 namespace { | 18 namespace { |
| 21 | 19 |
| 22 struct ViewConfigurationData { | 20 struct ViewConfigurationData { |
| 23 ViewConfigurationData() | 21 ViewConfigurationData() |
| 24 : double_tap_timeout_in_ms_(0), | 22 : double_tap_timeout_in_ms_(0), |
| 25 long_press_timeout_in_ms_(0), | 23 long_press_timeout_in_ms_(0), |
| 26 tap_timeout_in_ms_(0), | 24 tap_timeout_in_ms_(0), |
| 27 max_fling_velocity_in_dips_s_(0), | 25 max_fling_velocity_in_dips_s_(0), |
| 28 min_fling_velocity_in_dips_s_(0), | 26 min_fling_velocity_in_dips_s_(0), |
| 29 touch_slop_in_dips_(0), | 27 touch_slop_in_dips_(0), |
| 30 double_tap_slop_in_dips_(0), | 28 double_tap_slop_in_dips_(0), |
| 31 min_scaling_span_in_dips_(0) { | 29 min_scaling_span_in_dips_(0) { |
| 32 JNIEnv* env = AttachCurrentThread(); | 30 JNIEnv* env = AttachCurrentThread(); |
| 33 j_view_configuration_helper_.Reset( | 31 j_view_configuration_helper_.Reset( |
| 34 Java_ViewConfigurationHelper_createWithListener( | 32 Java_ViewConfigurationHelper_createWithListener(env)); |
| 35 env, base::android::GetApplicationContext())); | |
| 36 | 33 |
| 37 double_tap_timeout_in_ms_ = | 34 double_tap_timeout_in_ms_ = |
| 38 Java_ViewConfigurationHelper_getDoubleTapTimeout(env); | 35 Java_ViewConfigurationHelper_getDoubleTapTimeout(env); |
| 39 long_press_timeout_in_ms_ = | 36 long_press_timeout_in_ms_ = |
| 40 Java_ViewConfigurationHelper_getLongPressTimeout(env); | 37 Java_ViewConfigurationHelper_getLongPressTimeout(env); |
| 41 tap_timeout_in_ms_ = Java_ViewConfigurationHelper_getTapTimeout(env); | 38 tap_timeout_in_ms_ = Java_ViewConfigurationHelper_getTapTimeout(env); |
| 42 | 39 |
| 43 Update(Java_ViewConfigurationHelper_getMaximumFlingVelocity( | 40 Update(Java_ViewConfigurationHelper_getMaximumFlingVelocity( |
| 44 env, j_view_configuration_helper_), | 41 env, j_view_configuration_helper_), |
| 45 Java_ViewConfigurationHelper_getMinimumFlingVelocity( | 42 Java_ViewConfigurationHelper_getMinimumFlingVelocity( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 173 |
| 177 int ViewConfiguration::GetMinScalingSpanInDips() { | 174 int ViewConfiguration::GetMinScalingSpanInDips() { |
| 178 return g_view_configuration.Get().min_scaling_span_in_dips(); | 175 return g_view_configuration.Get().min_scaling_span_in_dips(); |
| 179 } | 176 } |
| 180 | 177 |
| 181 bool ViewConfiguration::RegisterViewConfiguration(JNIEnv* env) { | 178 bool ViewConfiguration::RegisterViewConfiguration(JNIEnv* env) { |
| 182 return RegisterNativesImpl(env); | 179 return RegisterNativesImpl(env); |
| 183 } | 180 } |
| 184 | 181 |
| 185 } // namespace gfx | 182 } // namespace gfx |
| OLD | NEW |