| Left: | ||
| Right: |
| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 | 226 |
| 227 engine.filterEngine = new FilterEngine(engine.jsEngine); | 227 engine.filterEngine = new FilterEngine(engine.jsEngine); |
| 228 } | 228 } |
| 229 } | 229 } |
| 230 | 230 |
| 231 public static Builder builder(AppInfo appInfo, String basePath) | 231 public static Builder builder(AppInfo appInfo, String basePath) |
| 232 { | 232 { |
| 233 return new Builder(appInfo, basePath); | 233 return new Builder(appInfo, basePath); |
| 234 } | 234 } |
| 235 | 235 |
| 236 private AndroidWebRequestResourceWrapper.Listener resourceWrapperListener = | 236 private final AndroidWebRequestResourceWrapper.Listener resourceWrapperListene r = |
| 237 new AndroidWebRequestResourceWrapper.Listener() | 237 new AndroidWebRequestResourceWrapper.Listener() |
|
diegocarloslima
2017/03/30 09:42:07
Since this member variable never changes, you shou
anton
2017/03/30 10:27:16
Acknowledged.
| |
| 238 { | 238 { |
| 239 private static final int UPDATE_DELAY_MS = 1 * 1000; | 239 private static final int UPDATE_DELAY_MS = 1 * 1000; |
| 240 | 240 |
| 241 private Handler handler = new Handler(Looper.getMainLooper()); | 241 private final Handler handler = new Handler(Looper.getMainLooper()); |
|
diegocarloslima
2017/03/30 09:42:07
Since this member variable never changes, you shou
anton
2017/03/30 10:27:16
Acknowledged.
| |
| 242 | 242 |
| 243 private Runnable forceUpdateRunnable = new Runnable() | 243 private final Runnable forceUpdateRunnable = new Runnable() |
|
diegocarloslima
2017/03/30 09:42:07
Since this member variable never changes, you shou
| |
| 244 { | 244 { |
| 245 public void run() { | 245 public void run() { |
| 246 // Filter Engine can be already disposed | 246 // Filter Engine can be already disposed |
| 247 if (filterEngine != null) | 247 if (filterEngine != null) |
| 248 { | 248 { |
| 249 Log.d(TAG, "Force update subscriptions"); | 249 Log.d(TAG, "Force update subscriptions"); |
| 250 filterEngine.forceUpdateCheck(updateCheckDoneCallback); | 250 List<Subscription> subscriptions = filterEngine.getListedSubscriptions (); |
| 251 for (Subscription eachSubscription : subscriptions) | |
|
sergei
2017/03/30 22:14:37
Nit: I would remove "each".
| |
| 252 { | |
| 253 try | |
| 254 { | |
| 255 eachSubscription.updateFilters(); | |
| 256 } | |
| 257 finally | |
| 258 { | |
| 259 eachSubscription.dispose(); | |
| 260 } | |
| 261 } | |
| 251 } | 262 } |
| 252 } | 263 } |
| 253 }; | 264 }; |
| 254 | 265 |
| 255 @Override | 266 @Override |
| 256 public void onIntercepted(String url, int resourceId) | 267 public void onIntercepted(String url, int resourceId) |
| 257 { | 268 { |
| 258 // we need to force update subscriptions ASAP after preloaded one is retur ned | 269 // we need to force update subscriptions ASAP after preloaded one is retur ned |
| 259 // but we should note that multiple interceptions (for main easylist and A A) and force update once only | 270 // but we should note that multiple interceptions (for main easylist and A A) and force update once only |
| 260 | 271 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 578 public void setWhitelistedDomains(List<String> domains) | 589 public void setWhitelistedDomains(List<String> domains) |
| 579 { | 590 { |
| 580 this.whitelistedDomains = domains; | 591 this.whitelistedDomains = domains; |
| 581 } | 592 } |
| 582 | 593 |
| 583 public List<String> getWhitelistedDomains() | 594 public List<String> getWhitelistedDomains() |
| 584 { | 595 { |
| 585 return whitelistedDomains; | 596 return whitelistedDomains; |
| 586 } | 597 } |
| 587 } | 598 } |
| LEFT | RIGHT |