summaryrefslogtreecommitdiffstats
path: root/ui/gfx/android/view_configuration.cc
blob: 63657178b1551e41b303c5887d2fa0669f7f72a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// 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/gfx/android/view_configuration.h"

#include "base/android/jni_android.h"
#include "jni/ViewConfiguration_jni.h"

using namespace JNI_ViewConfiguration;
using base::android::AttachCurrentThread;
using base::android::GetApplicationContext;

namespace gfx {

int ViewConfiguration::GetDoubleTapTimeoutInMs() {
  JNIEnv* env = AttachCurrentThread();
  return Java_ViewConfiguration_getDoubleTapTimeout(env);
}

int ViewConfiguration::GetLongPressTimeoutInMs() {
  JNIEnv* env = AttachCurrentThread();
  return Java_ViewConfiguration_getLongPressTimeout(env);
}

int ViewConfiguration::GetTapTimeoutInMs() {
  JNIEnv* env = AttachCurrentThread();
  return Java_ViewConfiguration_getTapTimeout(env);
}

int ViewConfiguration::GetMaximumFlingVelocityInPixelsPerSecond() {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> view =
      Java_ViewConfiguration_get(env, GetApplicationContext());
  return Java_ViewConfiguration_getScaledMaximumFlingVelocity(env, view.obj());
}

int ViewConfiguration::GetMinimumFlingVelocityInPixelsPerSecond() {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> view =
      Java_ViewConfiguration_get(env, GetApplicationContext());
  return Java_ViewConfiguration_getScaledMinimumFlingVelocity(env, view.obj());
}

int ViewConfiguration::GetTouchSlopInPixels() {
  JNIEnv* env = AttachCurrentThread();
  ScopedJavaLocalRef<jobject> view =
      Java_ViewConfiguration_get(env, GetApplicationContext());
  return Java_ViewConfiguration_getScaledTouchSlop(env, view.obj());
}

bool ViewConfiguration::RegisterViewConfiguration(JNIEnv* env) {
  return RegisterNativesImpl(env);
}

}  // namespace gfx