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

Unified Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java

Issue 29379647: Issue 4948 - add possibility to not send data depending on connection properties (Closed)
Patch Set: felix's comments Created March 24, 2017, 9:46 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java
index d7273597b67ebfdf5a8efb087f42d17201e72834..c43de392ce62a1bf1cbef719ca31049974701a66 100644
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/FilterEngine.java
@@ -36,12 +36,21 @@ public final class FilterEngine implements Disposable
OBJECT_SUBREQUEST, FONT, MEDIA
}
- public FilterEngine(final JsEngine jsEngine)
+ public FilterEngine(final JsEngine jsEngine, final IsAllowedConnectionCallback isAllowedConnectionCallback)
{
- this.ptr = ctor(jsEngine.ptr);
+ long jisAllowedConnectionCallbackPtr =
+ (isAllowedConnectionCallback != null
+ ? isAllowedConnectionCallback.ptr
+ : 0l);
+ this.ptr = ctor(jsEngine.ptr, jisAllowedConnectionCallbackPtr);
this.disposer = new Disposer(this, new DisposeWrapper(this.ptr));
}
+ public FilterEngine(final JsEngine jsEngine)
+ {
+ this(jsEngine, null);
+ }
+
public boolean isFirstRun()
{
return isFirstRun(this.ptr);
@@ -162,6 +171,16 @@ public final class FilterEngine implements Disposable
return getHostFromURL(this.ptr, url);
}
+ public void setAllowedConnectionType(String value)
+ {
+ setAllowedConnectionType(this.ptr, value);
+ }
+
+ public String getAllowedConnectionType()
+ {
+ return getAllowedConnectionType(this.ptr);
+ }
+
@Override
public void dispose()
{
@@ -186,7 +205,7 @@ public final class FilterEngine implements Disposable
private final static native void registerNatives();
- private final static native long ctor(long jsEnginePtr);
+ private final static native long ctor(long jsEnginePtr, long isAllowedConnectionCallbackPtr);
private final static native boolean isFirstRun(long ptr);
@@ -232,5 +251,9 @@ public final class FilterEngine implements Disposable
private final static native String getHostFromURL(long ptr, String url);
+ private final static native void setAllowedConnectionType(long ptr, String value);
+
+ private final static native String getAllowedConnectionType(long ptr);
+
private final static native void dtor(long ptr);
}

Powered by Google App Engine
This is Rietveld