OLD | NEW |
(Empty) | |
| 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 NET_CRONET_ANDROID_URLREQUEST_H_ |
| 6 #define NET_CRONET_ANDROID_URLREQUEST_H_ |
| 7 |
| 8 #include <jni.h> |
| 9 |
| 10 extern "C" { |
| 11 |
| 12 // Native method implementations of the org.chromium.netjni.UrlRequest class. |
| 13 |
| 14 // Request priorities. Also declared in UrlRequest.java |
| 15 const jint REQUEST_PRIORITY_IDLE = 0; |
| 16 const jint REQUEST_PRIORITY_LOWEST = 1; |
| 17 const jint REQUEST_PRIORITY_LOW = 2; |
| 18 const jint REQUEST_PRIORITY_MEDIUM = 3; |
| 19 const jint REQUEST_PRIORITY_HIGHEST = 4; |
| 20 |
| 21 // Error codes. Also declared in UrlRequest.java |
| 22 const jint ERROR_SUCCESS = 0; |
| 23 const jint ERROR_UNKNOWN = 1; |
| 24 const jint ERROR_MALFORMED_URL = 2; |
| 25 const jint ERROR_CONNECTION_TIMED_OUT = 3; |
| 26 const jint ERROR_UNKNOWN_HOST = 4; |
| 27 |
| 28 // TODO(mef): Replace following definitions with generated jni/UrlRequest_jni.h |
| 29 |
| 30 bool UrlRequestRegisterJni(JNIEnv* env); |
| 31 |
| 32 JNIEXPORT void JNICALL |
| 33 Java_org_chromium_net_UrlRequest_nativeInit(JNIEnv* env, |
| 34 jobject object, |
| 35 jobject request_context, |
| 36 jstring url, |
| 37 jint priority); |
| 38 |
| 39 JNIEXPORT void JNICALL |
| 40 Java_org_chromium_net_UrlRequest_nativeAddHeader(JNIEnv* env, |
| 41 jobject object, |
| 42 jstring name, |
| 43 jstring value); |
| 44 |
| 45 JNIEXPORT void JNICALL |
| 46 Java_org_chromium_net_UrlRequest_nativeSetPostData(JNIEnv* env, |
| 47 jobject object, |
| 48 jstring content_type, |
| 49 jbyteArray content); |
| 50 |
| 51 JNIEXPORT void JNICALL |
| 52 Java_org_chromium_net_UrlRequest_nativeBeginChunkedUpload( |
| 53 JNIEnv* env, |
| 54 jobject object, |
| 55 jstring content_type); |
| 56 |
| 57 JNIEXPORT void JNICALL Java_org_chromium_net_UrlRequest_nativeAppendChunk( |
| 58 JNIEnv* env, |
| 59 jobject object, |
| 60 jobject chunk_byte_buffer, |
| 61 jint chunk_size, |
| 62 jboolean is_last_chunk); |
| 63 |
| 64 JNIEXPORT void JNICALL |
| 65 Java_org_chromium_net_UrlRequest_nativeStart(JNIEnv* env, jobject object); |
| 66 |
| 67 JNIEXPORT void JNICALL |
| 68 Java_org_chromium_net_UrlRequest_nativeCancel(JNIEnv* env, jobject object); |
| 69 |
| 70 JNIEXPORT void JNICALL |
| 71 Java_org_chromium_net_UrlRequest_nativeRecycle(JNIEnv* env, jobject object); |
| 72 |
| 73 JNIEXPORT jint JNICALL |
| 74 Java_org_chromium_net_UrlRequest_nativeGetErrorCode(JNIEnv* env, |
| 75 jobject object); |
| 76 |
| 77 JNIEXPORT jstring JNICALL |
| 78 Java_org_chromium_net_UrlRequest_nativeGetErrorString(JNIEnv* env, |
| 79 jobject object); |
| 80 |
| 81 JNIEXPORT jint JNICALL |
| 82 Java_org_chromium_net_UrlRequest_getHttpStatusCode(JNIEnv* env, |
| 83 jobject object); |
| 84 |
| 85 JNIEXPORT jstring JNICALL |
| 86 Java_org_chromium_net_UrlRequest_nativeGetContentType(JNIEnv* env, |
| 87 jobject object); |
| 88 |
| 89 JNIEXPORT jlong JNICALL |
| 90 Java_org_chromium_net_UrlRequest_nativeGetContentLength(JNIEnv* env, |
| 91 jobject object); |
| 92 |
| 93 } // extern "C" |
| 94 |
| 95 #endif // NET_CRONET_ANDROID_URLREQUEST_H_ |
OLD | NEW |