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

Side by Side Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/IsAllowedConnectionCallback.java

Issue 29379647: Issue 4948 - add possibility to not send data depending on connection properties (Closed)
Patch Set: updated to 4931 code review patch set 3 and later Created March 21, 2017, 10:28 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
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 package org.adblockplus.libadblockplus; 18 package org.adblockplus.libadblockplus;
19 19
20 public abstract class FilterChangeCallback implements Disposable 20 public abstract class IsAllowedConnectionCallback implements Disposable
21 { 21 {
22 private final Disposer disposer; 22 private final Disposer disposer;
23 protected final long ptr; 23 protected final long ptr;
24 24
25 static 25 static
26 { 26 {
27 System.loadLibrary("adblockplus-jni"); 27 System.loadLibrary("adblockplus-jni");
28 registerNatives(); 28 registerNatives();
29 } 29 }
30 30
31 public FilterChangeCallback() 31 public IsAllowedConnectionCallback()
32 { 32 {
33 this.ptr = ctor(this); 33 this.ptr = ctor(this);
34 this.disposer = new Disposer(this, new DisposeWrapper(this.ptr)); 34 this.disposer = new Disposer(this, new DisposeWrapper(this.ptr));
35 } 35 }
36 36
37 public abstract void filterChangeCallback(String action, JsValue jsValue); 37 public abstract boolean isConnectionAllowed(String connection);
38 38
39 @Override 39 @Override
40 public void dispose() 40 public void dispose()
41 { 41 {
42 this.disposer.dispose(); 42 this.disposer.dispose();
43 } 43 }
44 44
45 private final static class DisposeWrapper implements Disposable 45 private final static class DisposeWrapper implements Disposable
46 { 46 {
47 private final long ptr; 47 private final long ptr;
48 48
49 public DisposeWrapper(final long ptr) 49 public DisposeWrapper(final long ptr)
50 { 50 {
51 this.ptr = ptr; 51 this.ptr = ptr;
52 } 52 }
53 53
54 @Override 54 @Override
55 public void dispose() 55 public void dispose()
56 { 56 {
57 dtor(this.ptr); 57 dtor(this.ptr);
58 } 58 }
59 } 59 }
60 60
61 private final static native void registerNatives(); 61 private final static native void registerNatives();
62 62
63 private final static native long ctor(Object callbackObject); 63 private final static native long ctor(Object callbackObject);
64 64
65 private final static native void dtor(long ptr); 65 private final static native void dtor(long ptr);
66 } 66 }
OLDNEW

Powered by Google App Engine
This is Rietveld