1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "ui/gfx/android/view_configuration.h" 6 7 #include "base/android/jni_android.h" 8 #include "jni/ViewConfiguration_jni.h" 9 10 using namespace JNI_ViewConfiguration; 11 using base::android::AttachCurrentThread; 12 using base::android::GetApplicationContext; 13 14 namespace gfx { 15 GetDoubleTapTimeoutInMs()16int ViewConfiguration::GetDoubleTapTimeoutInMs() { 17 JNIEnv* env = AttachCurrentThread(); 18 return Java_ViewConfiguration_getDoubleTapTimeout(env); 19 } 20 GetLongPressTimeoutInMs()21int ViewConfiguration::GetLongPressTimeoutInMs() { 22 JNIEnv* env = AttachCurrentThread(); 23 return Java_ViewConfiguration_getLongPressTimeout(env); 24 } 25 GetTapTimeoutInMs()26int ViewConfiguration::GetTapTimeoutInMs() { 27 JNIEnv* env = AttachCurrentThread(); 28 return Java_ViewConfiguration_getTapTimeout(env); 29 } 30 GetMaximumFlingVelocityInPixelsPerSecond()31int ViewConfiguration::GetMaximumFlingVelocityInPixelsPerSecond() { 32 JNIEnv* env = AttachCurrentThread(); 33 ScopedJavaLocalRef<jobject> view = 34 Java_ViewConfiguration_get(env, GetApplicationContext()); 35 return Java_ViewConfiguration_getScaledMaximumFlingVelocity(env, view.obj()); 36 } 37 GetMinimumFlingVelocityInPixelsPerSecond()38int ViewConfiguration::GetMinimumFlingVelocityInPixelsPerSecond() { 39 JNIEnv* env = AttachCurrentThread(); 40 ScopedJavaLocalRef<jobject> view = 41 Java_ViewConfiguration_get(env, GetApplicationContext()); 42 return Java_ViewConfiguration_getScaledMinimumFlingVelocity(env, view.obj()); 43 } 44 GetTouchSlopInPixels()45int ViewConfiguration::GetTouchSlopInPixels() { 46 JNIEnv* env = AttachCurrentThread(); 47 ScopedJavaLocalRef<jobject> view = 48 Java_ViewConfiguration_get(env, GetApplicationContext()); 49 return Java_ViewConfiguration_getScaledTouchSlop(env, view.obj()); 50 } 51 RegisterViewConfiguration(JNIEnv * env)52bool ViewConfiguration::RegisterViewConfiguration(JNIEnv* env) { 53 return RegisterNativesImpl(env); 54 } 55 56 } // namespace gfx 57