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-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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 import java.util.concurrent.atomic.AtomicBoolean; | 59 import java.util.concurrent.atomic.AtomicBoolean; |
60 import java.util.regex.Pattern; | 60 import java.util.regex.Pattern; |
61 | 61 |
62 /** | 62 /** |
63 * WebView with ad blocking | 63 * WebView with ad blocking |
64 */ | 64 */ |
65 public class AdblockWebView extends WebView | 65 public class AdblockWebView extends WebView |
66 { | 66 { |
67 private static final String TAG = Utils.getTag(AdblockWebView.class); | 67 private static final String TAG = Utils.getTag(AdblockWebView.class); |
68 | 68 |
69 // basePath to store subscription files | |
70 public static final String BASE_PATH_DIRECTORY = "adblock"; | |
71 | |
72 /** | 69 /** |
73 * Default (in some conditions) start redraw delay after DOM modified with inj
ected JS (millis) | 70 * Default (in some conditions) start redraw delay after DOM modified with inj
ected JS (millis) |
74 */ | 71 */ |
75 public static final int ALLOW_DRAW_DELAY = 200; | 72 public static final int ALLOW_DRAW_DELAY = 200; |
76 /* | 73 /* |
77 The value could be different for devices and completely unclear why we need
it and | 74 The value could be different for devices and completely unclear why we need
it and |
78 how to measure actual value | 75 how to measure actual value |
79 */ | 76 */ |
80 | 77 |
81 protected static final String HEADER_REFERRER = "Referer"; | 78 protected static final String HEADER_REFERRER = "Referer"; |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
953 } | 950 } |
954 | 951 |
955 private void createAdblockEngine() | 952 private void createAdblockEngine() |
956 { | 953 { |
957 w("Creating AdblockEngine"); | 954 w("Creating AdblockEngine"); |
958 | 955 |
959 // assuming `this.debugMode` can be used as `developmentBuild` value | 956 // assuming `this.debugMode` can be used as `developmentBuild` value |
960 adblockEngine = AdblockEngine | 957 adblockEngine = AdblockEngine |
961 .builder( | 958 .builder( |
962 AdblockEngine.generateAppInfo(this.getContext(), debugMode), | 959 AdblockEngine.generateAppInfo(this.getContext(), debugMode), |
963 this.getContext().getDir(BASE_PATH_DIRECTORY, Context.MODE_PRIVATE).getA
bsolutePath()) | 960 this.getContext().getDir(AdblockEngine.BASE_PATH_DIRECTORY, Context.MODE
_PRIVATE).getAbsolutePath()) |
964 .enableElementHiding(true) | 961 .enableElementHiding(true) |
965 .build(); | 962 .build(); |
966 } | 963 } |
967 | 964 |
968 private class ElemHideThread extends Thread | 965 private class ElemHideThread extends Thread |
969 { | 966 { |
970 private String selectorsString; | 967 private String selectorsString; |
971 private CountDownLatch finishedLatch; | 968 private CountDownLatch finishedLatch; |
972 private AtomicBoolean isCancelled; | 969 private AtomicBoolean isCancelled; |
973 | 970 |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1420 w("Busy with elemhide selectors, delayed disposing scheduled"); | 1417 w("Busy with elemhide selectors, delayed disposing scheduled"); |
1421 elemHideThread.setFinishedRunnable(disposeRunnable); | 1418 elemHideThread.setFinishedRunnable(disposeRunnable); |
1422 } | 1419 } |
1423 else | 1420 else |
1424 { | 1421 { |
1425 disposeRunnable.run(); | 1422 disposeRunnable.run(); |
1426 } | 1423 } |
1427 } | 1424 } |
1428 } | 1425 } |
1429 } | 1426 } |
LEFT | RIGHT |