LEFT | RIGHT |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 27 matching lines...) Expand all Loading... |
38 { | 38 { |
39 } | 39 } |
40 | 40 |
41 AdblockPlus::ServerResponse JniWebRequest::GET(const std::string& url, | 41 AdblockPlus::ServerResponse JniWebRequest::GET(const std::string& url, |
42 const AdblockPlus::HeaderList& requestHeaders) const | 42 const AdblockPlus::HeaderList& requestHeaders) const |
43 { | 43 { |
44 JNIEnvAcquire env(GetJavaVM()); | 44 JNIEnvAcquire env(GetJavaVM()); |
45 | 45 |
46 jmethodID method = env->GetMethodID( | 46 jmethodID method = env->GetMethodID( |
47 *JniLocalReference<jclass>(*env, | 47 *JniLocalReference<jclass>(*env, |
48 env->GetObjectClass(GetCallbackObject())), "httpGET", | 48 env->GetObjectClass(GetCallbackObject())), |
| 49 "httpGET", |
49 "(Ljava/lang/String;Ljava/util/List;)" TYP("ServerResponse")); | 50 "(Ljava/lang/String;Ljava/util/List;)" TYP("ServerResponse")); |
50 | 51 |
51 AdblockPlus::ServerResponse sResponse; | 52 AdblockPlus::ServerResponse sResponse; |
52 sResponse.status = AdblockPlus::WebRequest::NS_ERROR_FAILURE; | 53 sResponse.status = AdblockPlus::WebRequest::NS_ERROR_FAILURE; |
53 | 54 |
54 if (method) | 55 if (method) |
55 { | 56 { |
56 JniLocalReference<jobject> arrayList(*env, NewJniArrayList(*env)); | 57 JniLocalReference<jobject> arrayList(*env, NewJniArrayList(*env)); |
57 | 58 |
58 for (AdblockPlus::HeaderList::const_iterator it = requestHeaders.begin(), | 59 for (AdblockPlus::HeaderList::const_iterator it = requestHeaders.begin(), |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 static JNINativeMethod methods[] = | 101 static JNINativeMethod methods[] = |
101 { | 102 { |
102 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, | 103 { (char*)"ctor", (char*)"(Ljava/lang/Object;)J", (void*)JniCtor }, |
103 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } | 104 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor } |
104 }; | 105 }; |
105 | 106 |
106 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest
_registerNatives(JNIEnv *env, jclass clazz) | 107 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_WebRequest
_registerNatives(JNIEnv *env, jclass clazz) |
107 { | 108 { |
108 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); | 109 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); |
109 } | 110 } |
LEFT | RIGHT |