OLD | NEW |
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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 19 matching lines...) Expand all Loading... |
30 import java.io.InputStreamReader; | 30 import java.io.InputStreamReader; |
31 import java.util.Collections; | 31 import java.util.Collections; |
32 import java.util.HashSet; | 32 import java.util.HashSet; |
33 import java.util.List; | 33 import java.util.List; |
34 import java.util.Map; | 34 import java.util.Map; |
35 import java.util.Set; | 35 import java.util.Set; |
36 | 36 |
37 /** | 37 /** |
38 * WebRequest wrapper to return request response from android resources for sele
cted URLs | 38 * WebRequest wrapper to return request response from android resources for sele
cted URLs |
39 */ | 39 */ |
40 public class AndroidWebRequestResourceWrapper extends WebRequest | 40 public class AndroidWebRequestResourceWrapper implements WebRequest |
41 { | 41 { |
42 private static final String TAG = Utils.getTag(AndroidWebRequestResourceWrappe
r.class); | 42 private static final String TAG = Utils.getTag(AndroidWebRequestResourceWrappe
r.class); |
43 | 43 |
44 public static final String EASYLIST = | 44 public static final String EASYLIST = |
45 "https://easylist-downloads.adblockplus.org/easylist.txt"; | 45 "https://easylist-downloads.adblockplus.org/easylist.txt"; |
46 public static final String EASYLIST_INDONESIAN = | 46 public static final String EASYLIST_INDONESIAN = |
47 "https://easylist-downloads.adblockplus.org/abpindo+easylist.txt"; | 47 "https://easylist-downloads.adblockplus.org/abpindo+easylist.txt"; |
48 public static final String EASYLIST_BULGARIAN = | 48 public static final String EASYLIST_BULGARIAN = |
49 "https://easylist-downloads.adblockplus.org/bulgarian_list+easylist.txt"; | 49 "https://easylist-downloads.adblockplus.org/bulgarian_list+easylist.txt"; |
50 public static final String EASYLIST_CHINESE = | 50 public static final String EASYLIST_CHINESE = |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 catch (IOException e) | 190 catch (IOException e) |
191 { | 191 { |
192 Log.e(TAG, "Error injecting response", e); | 192 Log.e(TAG, "Error injecting response", e); |
193 response.setStatus(ServerResponse.NsStatus.ERROR_FAILURE); | 193 response.setStatus(ServerResponse.NsStatus.ERROR_FAILURE); |
194 } | 194 } |
195 | 195 |
196 return response; | 196 return response; |
197 } | 197 } |
198 | 198 |
199 @Override | |
200 public void dispose() | |
201 { | |
202 request.dispose(); | |
203 super.dispose(); | |
204 } | |
205 | |
206 /** | 199 /** |
207 * Listener for events | 200 * Listener for events |
208 */ | 201 */ |
209 public interface Listener | 202 public interface Listener |
210 { | 203 { |
211 void onIntercepted(String url, int resourceId); | 204 void onIntercepted(String url, int resourceId); |
212 } | 205 } |
213 | 206 |
214 /** | 207 /** |
215 * Interface to remember intercepted subscription requests | 208 * Interface to remember intercepted subscription requests |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 .commit(); | 240 .commit(); |
248 } | 241 } |
249 | 242 |
250 @Override | 243 @Override |
251 public synchronized boolean contains(String url) | 244 public synchronized boolean contains(String url) |
252 { | 245 { |
253 return urls.contains(url); | 246 return urls.contains(url); |
254 } | 247 } |
255 } | 248 } |
256 } | 249 } |
OLD | NEW |