OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2014 Eyeo GmbH | 3 * Copyright (C) 2006-2014 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 24 matching lines...) Expand all Loading... |
35 return javaVM; | 35 return javaVM; |
36 } | 36 } |
37 | 37 |
38 jobject GetCallbackObject() const | 38 jobject GetCallbackObject() const |
39 { | 39 { |
40 return callbackObject->Get(); | 40 return callbackObject->Get(); |
41 } | 41 } |
42 | 42 |
43 private: | 43 private: |
44 JavaVM* javaVM; | 44 JavaVM* javaVM; |
45 JniGlobalReference<jobject>::Ptr callbackObject; | 45 const JniGlobalReference<jobject>::Ptr callbackObject; |
46 JniGlobalReference<jclass>::Ptr exceptionLoggerClass; | 46 const JniGlobalReference<jclass>::Ptr exceptionLoggerClass; |
47 }; | 47 }; |
48 | 48 |
49 class JniEventCallback : public JniCallbackBase | 49 class JniEventCallback : public JniCallbackBase |
50 { | 50 { |
51 public: | 51 public: |
52 JniEventCallback(JNIEnv* env, jobject callbackObject); | 52 JniEventCallback(JNIEnv* env, jobject callbackObject); |
53 void Callback(AdblockPlus::JsValueList& params); | 53 void Callback(AdblockPlus::JsValueList& params); |
54 }; | 54 }; |
55 | 55 |
56 class JniUpdaterCallback : public JniCallbackBase | 56 class JniUpdaterCallback : public JniCallbackBase |
57 { | 57 { |
58 public: | 58 public: |
59 JniUpdaterCallback(JNIEnv* env, jobject callbackObject); | 59 JniUpdaterCallback(JNIEnv* env, jobject callbackObject); |
60 void Callback(const std::string& arg); | 60 void Callback(const std::string& arg); |
61 }; | 61 }; |
62 | 62 |
63 class JniFilterChangeCallback : public JniCallbackBase | 63 class JniFilterChangeCallback : public JniCallbackBase |
64 { | 64 { |
65 public: | 65 public: |
66 JniFilterChangeCallback(JNIEnv* env, jobject callbackObject); | 66 JniFilterChangeCallback(JNIEnv* env, jobject callbackObject); |
67 void Callback(const std::string& arg, const AdblockPlus::JsValuePtr jsValue); | 67 void Callback(const std::string& arg, const AdblockPlus::JsValuePtr jsValue); |
| 68 |
| 69 private: |
| 70 const JniGlobalReference<jclass>::Ptr jsValueClass; |
68 }; | 71 }; |
69 | 72 |
70 class JniLogSystemCallback : public JniCallbackBase, public AdblockPlus::LogSyst
em | 73 class JniLogSystemCallback : public JniCallbackBase, public AdblockPlus::LogSyst
em |
71 { | 74 { |
72 public: | 75 public: |
73 JniLogSystemCallback(JNIEnv* env, jobject callbackObject); | 76 JniLogSystemCallback(JNIEnv* env, jobject callbackObject); |
74 void operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string&
message, const std::string& source); | 77 void operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string&
message, const std::string& source); |
75 | 78 |
76 private: | 79 private: |
77 JniGlobalReference<jclass>::Ptr logLevelClass; | 80 const JniGlobalReference<jclass>::Ptr logLevelClass; |
78 }; | 81 }; |
79 | 82 |
80 class JniWebRequest : public JniCallbackBase, public AdblockPlus::WebRequest | 83 class JniWebRequest : public JniCallbackBase, public AdblockPlus::WebRequest |
81 { | 84 { |
82 public: | 85 public: |
83 JniWebRequest(JNIEnv* env, jobject callbackObject); | 86 JniWebRequest(JNIEnv* env, jobject callbackObject); |
84 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea
derList& requestHeaders) const; | 87 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea
derList& requestHeaders) const; |
85 | 88 |
86 private: | 89 private: |
87 jobject NewTuple(JNIEnv* env, const std::string& a, const std::string& b) cons
t; | 90 jobject NewTuple(JNIEnv* env, const std::string& a, const std::string& b) cons
t; |
88 | 91 |
89 JniGlobalReference<jclass>::Ptr tupleClass; | 92 const JniGlobalReference<jclass>::Ptr tupleClass; |
90 JniGlobalReference<jclass>::Ptr serverResponseClass; | 93 const JniGlobalReference<jclass>::Ptr serverResponseClass; |
91 }; | 94 }; |
92 | 95 |
93 #endif /* JNICALLBACKS_H */ | 96 #endif /* JNICALLBACKS_H */ |
OLD | NEW |