- add sources.
[platform/framework/web/crosswalk.git] / src / content / browser / renderer_host / java / jni_helper.h
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 #ifndef CONTENT_BROWSER_RENDERER_HOST_JAVA_JNI_HELPER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_JAVA_JNI_HELPER_H_
7
8 #include <jni.h>
9
10 #include "base/android/scoped_java_ref.h"
11 #include "content/common/content_export.h"
12
13 namespace content {
14
15 // Gets the method ID from the class name. Clears the pending Java exception
16 // and returns NULL if the method is not found. Caches results.
17 // Strings passed to this function are held in the cache and MUST remain valid
18 // beyond the duration of all future calls to this function, across all
19 // threads. In practice, this means that the function should only be used with
20 // string constants.
21 CONTENT_EXPORT jmethodID GetMethodIDFromClassName(JNIEnv* env,
22                                                   const char* class_name,
23                                                   const char* method,
24                                                   const char* jni_signature);
25
26 // Gets the field ID for a class field.
27 // This method triggers a fatal assertion if the field could not be found.
28 CONTENT_EXPORT jfieldID GetFieldID(JNIEnv* env,
29                                    const base::android::JavaRef<jclass>& clazz,
30                                    const char* field_name,
31                                    const char* jni_signature);
32
33 }  // namespace content
34
35 #endif  // CONTENT_BROWSER_RENDERER_HOST_JAVA_JNI_HELPER_H_