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

Side by Side Diff: mobile/android/thirdparty/org/adblockplus/browser/AddOnBridge.java

Issue 29543774: Issue 2801 - Create 'Whitelisted websites' screen and add link to 'Ad blocking' screen (Closed)
Patch Set: Created Sept. 13, 2017, 5:01 p.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-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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 public static void queryIsLocal(final AdblockPlusApiCallback callback, 362 public static void queryIsLocal(final AdblockPlusApiCallback callback,
363 final String url) 363 final String url)
364 { 364 {
365 Log.d(TAG, "queryIsLocal for " + url); 365 Log.d(TAG, "queryIsLocal for " + url);
366 final Map<String, Object> parameters = new HashMap<String, Object>(); 366 final Map<String, Object> parameters = new HashMap<String, Object>();
367 parameters.put("url", url); 367 parameters.put("url", url);
368 callFunction(callback, "isLocal", parameters); 368 callFunction(callback, "isLocal", parameters);
369 } 369 }
370 370
371 public static void queryIsPageWhitelisted(final AdblockPlusApiCallback callbac k, 371 public static void queryWhitelistedWebsites(final AdblockPlusApiCallback callb ack)
372 {
373 Log.d(TAG, "queryWhitelistedWebsites");
374 final Map<String, Object> parameters = new HashMap<>();
375 callFunction(callback, "getWhitelistedWebsites", parameters);
376 }
377
378 public static void queryIsWebsiteWhitelisted(final AdblockPlusApiCallback call back,
372 final String url) 379 final String url)
373 { 380 {
374 Log.d(TAG, "queryIsPageWhitelisted for " + url); 381 Log.d(TAG, "queryIsWebsiteWhitelisted for " + url);
375 final Map<String, Object> parameters = new HashMap<String, Object>(); 382 final Map<String, Object> parameters = new HashMap<String, Object>();
376 parameters.put("url", url); 383 parameters.put("url", url);
377 callFunction(callback, "isPageWhitelisted", parameters); 384 parameters.put("host", UrlUtils.getHostFromUrl(url));
385 callFunction(callback, "isWebsiteWhitelisted", parameters);
378 } 386 }
379 387
380 public static void whitelistSite(final AdblockPlusApiCallback callback, final String url, 388 public static void whitelistWebsite(final AdblockPlusApiCallback callback, Str ing url,
381 final boolean whitelisted) 389 final boolean whitelisted)
382 { 390 {
383 Log.d(TAG, "whitelistSite for " + url); 391 Log.d(TAG, "whitelistWebsite for " + url);
384 final Map<String, Object> parameters = new HashMap<String, Object>(); 392 final Map<String, Object> parameters = new HashMap<String, Object>();
385 parameters.put("url", url); 393 parameters.put("url", UrlUtils.formatUrl(url));
394 parameters.put("host", UrlUtils.getHostFromUrl(url));
386 parameters.put("whitelisted", whitelisted); 395 parameters.put("whitelisted", whitelisted);
387 callFunction(callback, "whitelistSite", parameters, true); 396 callFunction(callback, "whitelistWebsite", parameters, true);
388 } 397 }
389 398
390 private static class AddOnRequest extends GeckoRequest 399 private static class AddOnRequest extends GeckoRequest
391 { 400 {
392 private final JSONObject value; 401 private final JSONObject value;
393 private final AdblockPlusApiCallback apiCallback; 402 private final AdblockPlusApiCallback apiCallback;
394 403
395 AddOnRequest(final JSONObject value, final AdblockPlusApiCallback callback) 404 AddOnRequest(final JSONObject value, final AdblockPlusApiCallback callback)
396 { 405 {
397 super(AddOnBridge.REQUEST_NAME, value); 406 super(AddOnBridge.REQUEST_NAME, value);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 else if (ON_FILTERS_SAVE_EVENT.equals(event)) 472 else if (ON_FILTERS_SAVE_EVENT.equals(event))
464 { 473 {
465 // All changes have been saved by the extension. That way, we can clear our list of 474 // All changes have been saved by the extension. That way, we can clear our list of
466 // pending requests 475 // pending requests
467 // See https://issues.adblockplus.org/ticket/2853 476 // See https://issues.adblockplus.org/ticket/2853
468 clearPendingRequests(); 477 clearPendingRequests();
469 } 478 }
470 } 479 }
471 } 480 }
472 } 481 }
OLDNEW

Powered by Google App Engine
This is Rietveld