Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: libadblockplus-android/jni/JniCallbacks.h

Issue 29347315: Issue 4231 - Fix unstable FilterEngineTest.testSetRemoveFilterChangeCallback (Closed)
Patch Set: Introduced file system abstraction to java and using LazyFileSystem for filter tests Created July 10, 2016, 10:47 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 class JniLogSystemCallback : public JniCallbackBase, public AdblockPlus::LogSyst em 80 class JniLogSystemCallback : public JniCallbackBase, public AdblockPlus::LogSyst em
81 { 81 {
82 public: 82 public:
83 JniLogSystemCallback(JNIEnv* env, jobject callbackObject); 83 JniLogSystemCallback(JNIEnv* env, jobject callbackObject);
84 void operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string& message, const std::string& source); 84 void operator()(AdblockPlus::LogSystem::LogLevel logLevel, const std::string& message, const std::string& source);
85 85
86 private: 86 private:
87 const JniGlobalReference<jclass>::Ptr logLevelClass; 87 const JniGlobalReference<jclass>::Ptr logLevelClass;
88 }; 88 };
89 89
90 class JniFileSystemCallback : public JniCallbackBase, public AdblockPlus::FileSy stem
91 {
92 public:
93 JniFileSystemCallback(JNIEnv* env, jobject callbackObject);
94 std::shared_ptr<std::istream> Read(const std::string& path) const;
95 void Write(const std::string& path, std::shared_ptr<std::istream> data);
96 void Move(const std::string& fromPath, const std::string& toPath);
97 void Remove(const std::string& path);
98 AdblockPlus::FileSystem::StatResult Stat(const std::string& path) const;
99 std::string Resolve(const std::string& path) const;
100
101 private:
102 const JniGlobalReference<jclass>::Ptr statResultClass;
103 };
104
90 class JniShowNotificationCallback : public JniCallbackBase 105 class JniShowNotificationCallback : public JniCallbackBase
91 { 106 {
92 public: 107 public:
93 JniShowNotificationCallback(JNIEnv* env, jobject callbackObject); 108 JniShowNotificationCallback(JNIEnv* env, jobject callbackObject);
94 void Callback(const AdblockPlus::NotificationPtr&); 109 void Callback(const AdblockPlus::NotificationPtr&);
95 110
96 private: 111 private:
97 const JniGlobalReference<jclass>::Ptr notificationClass; 112 const JniGlobalReference<jclass>::Ptr notificationClass;
98 }; 113 };
99 114
100 class JniWebRequest : public JniCallbackBase, public AdblockPlus::WebRequest 115 class JniWebRequest : public JniCallbackBase, public AdblockPlus::WebRequest
101 { 116 {
102 public: 117 public:
103 JniWebRequest(JNIEnv* env, jobject callbackObject); 118 JniWebRequest(JNIEnv* env, jobject callbackObject);
104 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const; 119 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const;
105 120
106 private: 121 private:
107 jobject NewTuple(JNIEnv* env, const std::string& a, const std::string& b) cons t; 122 jobject NewTuple(JNIEnv* env, const std::string& a, const std::string& b) cons t;
108 123
109 const JniGlobalReference<jclass>::Ptr tupleClass; 124 const JniGlobalReference<jclass>::Ptr tupleClass;
110 const JniGlobalReference<jclass>::Ptr serverResponseClass; 125 const JniGlobalReference<jclass>::Ptr serverResponseClass;
111 }; 126 };
112 127
113 #endif /* JNICALLBACKS_H */ 128 #endif /* JNICALLBACKS_H */
OLDNEW

Powered by Google App Engine
This is Rietveld