blob: 3362c92841a643b4c5dd6843b9c5677f556fcd08 [file] [log] [blame]
// Copyright 2014 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.
// This file is autogenerated by
// base/android/jni_generator/jni_generator.py
// For
// org/chromium/TestJni
#ifndef org_chromium_TestJni_JNI
#define org_chromium_TestJni_JNI
#include <jni.h>
#include "base/android/jni_generator/jni_generator_helper.h"
#include "base/android/jni_int_wrapper.h"
// Step 1: forward declarations.
namespace {
const char kTestJniClassPath[] = "org/chromium/TestJni";
// Leaking this jclass as we cannot use LazyInstance from some threads.
base::subtle::AtomicWord g_TestJni_clazz __attribute__((unused)) = 0;
#define TestJni_clazz(env) base::android::LazyGetClass(env, kTestJniClassPath, &g_TestJni_clazz)
} // namespace
// Step 2: method stubs.
static jint Init(JNIEnv* env, const base::android::JavaParamRef<jobject>&
jcaller);
JNI_GENERATOR_EXPORT jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env,
jobject jcaller) {
return Init(env, base::android::JavaParamRef<jobject>(env, jcaller));
}
JNI_GENERATOR_EXPORT void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env,
jobject jcaller,
jint nativeChromeBrowserProvider) {
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
return native->Destroy(env, base::android::JavaParamRef<jobject>(env,
jcaller));
}
JNI_GENERATOR_EXPORT jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv*
env, jobject jcaller,
jint nativeChromeBrowserProvider,
jstring url,
jstring title,
jboolean isFolder,
jlong parentId) {
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0);
return native->AddBookmark(env, base::android::JavaParamRef<jobject>(env,
jcaller), base::android::JavaParamRef<jstring>(env, url),
base::android::JavaParamRef<jstring>(env, title), isFolder, parentId);
}
static base::android::ScopedJavaLocalRef<jstring> GetDomainAndRegistry(JNIEnv*
env, const base::android::JavaParamRef<jclass>& jcaller,
const base::android::JavaParamRef<jstring>& url);
JNI_GENERATOR_EXPORT jstring
Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env, jclass
jcaller,
jstring url) {
return GetDomainAndRegistry(env, base::android::JavaParamRef<jclass>(env,
jcaller), base::android::JavaParamRef<jstring>(env, url)).Release();
}
static void CreateHistoricalTabFromState(JNIEnv* env, const
base::android::JavaParamRef<jclass>& jcaller,
const base::android::JavaParamRef<jbyteArray>& state,
jint tab_index);
JNI_GENERATOR_EXPORT void
Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv* env,
jclass jcaller,
jbyteArray state,
jint tab_index) {
return CreateHistoricalTabFromState(env,
base::android::JavaParamRef<jclass>(env, jcaller),
base::android::JavaParamRef<jbyteArray>(env, state), tab_index);
}
static base::android::ScopedJavaLocalRef<jbyteArray> GetStateAsByteArray(JNIEnv*
env, const base::android::JavaParamRef<jobject>& jcaller,
const base::android::JavaParamRef<jobject>& view);
JNI_GENERATOR_EXPORT jbyteArray
Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv* env, jobject
jcaller,
jobject view) {
return GetStateAsByteArray(env, base::android::JavaParamRef<jobject>(env,
jcaller), base::android::JavaParamRef<jobject>(env, view)).Release();
}
static base::android::ScopedJavaLocalRef<jobjectArray>
GetAutofillProfileGUIDs(JNIEnv* env, const
base::android::JavaParamRef<jclass>& jcaller);
JNI_GENERATOR_EXPORT jobjectArray
Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv* env, jclass
jcaller) {
return GetAutofillProfileGUIDs(env, base::android::JavaParamRef<jclass>(env,
jcaller)).Release();
}
static void SetRecognitionResults(JNIEnv* env, const
base::android::JavaParamRef<jobject>& jcaller,
jint sessionId,
const base::android::JavaParamRef<jobjectArray>& results);
JNI_GENERATOR_EXPORT void
Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env, jobject
jcaller,
jint sessionId,
jobjectArray results) {
return SetRecognitionResults(env, base::android::JavaParamRef<jobject>(env,
jcaller), sessionId, base::android::JavaParamRef<jobjectArray>(env,
results));
}
JNI_GENERATOR_EXPORT jlong
Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env, jobject
jcaller,
jint nativeChromeBrowserProvider,
jstring url,
jobject created,
jobject isBookmark,
jobject date,
jbyteArray favicon,
jstring title,
jobject visits) {
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0);
return native->AddBookmarkFromAPI(env,
base::android::JavaParamRef<jobject>(env, jcaller),
base::android::JavaParamRef<jstring>(env, url),
base::android::JavaParamRef<jobject>(env, created),
base::android::JavaParamRef<jobject>(env, isBookmark),
base::android::JavaParamRef<jobject>(env, date),
base::android::JavaParamRef<jbyteArray>(env, favicon),
base::android::JavaParamRef<jstring>(env, title),
base::android::JavaParamRef<jobject>(env, visits));
}
static jint FindAll(JNIEnv* env, const base::android::JavaParamRef<jobject>&
jcaller,
const base::android::JavaParamRef<jstring>& find);
JNI_GENERATOR_EXPORT jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env,
jobject jcaller,
jstring find) {
return FindAll(env, base::android::JavaParamRef<jobject>(env, jcaller),
base::android::JavaParamRef<jstring>(env, find));
}
static base::android::ScopedJavaLocalRef<jobject> GetInnerClass(JNIEnv* env,
const base::android::JavaParamRef<jclass>& jcaller);
JNI_GENERATOR_EXPORT jobject
Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass jcaller) {
return GetInnerClass(env, base::android::JavaParamRef<jclass>(env,
jcaller)).Release();
}
JNI_GENERATOR_EXPORT jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv*
env, jobject jcaller,
jint nativeChromeBrowserProvider,
jobjectArray projection,
jstring selection,
jobjectArray selectionArgs,
jstring sortOrder) {
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL);
return native->QueryBitmap(env, base::android::JavaParamRef<jobject>(env,
jcaller), base::android::JavaParamRef<jobjectArray>(env, projection),
base::android::JavaParamRef<jstring>(env, selection),
base::android::JavaParamRef<jobjectArray>(env, selectionArgs),
base::android::JavaParamRef<jstring>(env, sortOrder)).Release();
}
JNI_GENERATOR_EXPORT void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv*
env, jobject jcaller,
jint nativeDataFetcherImplAndroid,
jdouble alpha,
jdouble beta,
jdouble gamma) {
DataFetcherImplAndroid* native =
reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation");
return native->GotOrientation(env, base::android::JavaParamRef<jobject>(env,
jcaller), alpha, beta, gamma);
}
static base::android::ScopedJavaLocalRef<jthrowable>
MessWithJavaException(JNIEnv* env, const
base::android::JavaParamRef<jclass>& jcaller,
const base::android::JavaParamRef<jthrowable>& e);
JNI_GENERATOR_EXPORT jthrowable
Java_org_chromium_TestJni_nativeMessWithJavaException(JNIEnv* env, jclass
jcaller,
jthrowable e) {
return MessWithJavaException(env, base::android::JavaParamRef<jclass>(env,
jcaller), base::android::JavaParamRef<jthrowable>(env, e)).Release();
}
// Step 3: RegisterNatives.
static const JNINativeMethod kMethodsTestJni[] = {
{ "nativeInit",
"("
")"
"I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) },
{ "nativeDestroy",
"("
"I"
")"
"V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeDestroy) },
{ "nativeAddBookmark",
"("
"I"
"Ljava/lang/String;"
"Ljava/lang/String;"
"Z"
"J"
")"
"J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmark) },
{ "nativeGetDomainAndRegistry",
"("
"Ljava/lang/String;"
")"
"Ljava/lang/String;",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetDomainAndRegistry)
},
{ "nativeCreateHistoricalTabFromState",
"("
"[B"
"I"
")"
"V",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState)
},
{ "nativeGetStateAsByteArray",
"("
"Landroid/view/View;"
")"
"[B",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetStateAsByteArray)
},
{ "nativeGetAutofillProfileGUIDs",
"("
")"
"[Ljava/lang/String;",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs)
},
{ "nativeSetRecognitionResults",
"("
"I"
"[Ljava/lang/String;"
")"
"V",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeSetRecognitionResults)
},
{ "nativeAddBookmarkFromAPI",
"("
"I"
"Ljava/lang/String;"
"Ljava/lang/Long;"
"Ljava/lang/Boolean;"
"Ljava/lang/Long;"
"[B"
"Ljava/lang/String;"
"Ljava/lang/Integer;"
")"
"J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmarkFromAPI)
},
{ "nativeFindAll",
"("
"Ljava/lang/String;"
")"
"I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeFindAll) },
{ "nativeGetInnerClass",
"("
")"
"Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetInnerClass) },
{ "nativeQueryBitmap",
"("
"I"
"[Ljava/lang/String;"
"Ljava/lang/String;"
"[Ljava/lang/String;"
"Ljava/lang/String;"
")"
"Landroid/graphics/Bitmap;",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeQueryBitmap) },
{ "nativeGotOrientation",
"("
"I"
"D"
"D"
"D"
")"
"V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGotOrientation) },
{ "nativeMessWithJavaException",
"("
"Ljava/lang/Throwable;"
")"
"Ljava/lang/Throwable;",
reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeMessWithJavaException)
},
};
static bool RegisterNativesImpl(JNIEnv* env) {
if (jni_generator::ShouldSkipJniRegistration(false))
return true;
const int kMethodsTestJniSize = arraysize(kMethodsTestJni);
if (env->RegisterNatives(TestJni_clazz(env),
kMethodsTestJni,
kMethodsTestJniSize) < 0) {
jni_generator::HandleRegistrationError(
env, TestJni_clazz(env), __FILE__);
return false;
}
return true;
}
#endif // org_chromium_TestJni_JNI