Index: mobile/android/thirdparty/org/adblockplus/browser/AddOnBridge.java |
=================================================================== |
--- a/mobile/android/thirdparty/org/adblockplus/browser/AddOnBridge.java |
+++ b/mobile/android/thirdparty/org/adblockplus/browser/AddOnBridge.java |
@@ -29,19 +29,20 @@ import android.os.Handler; |
import android.os.HandlerThread; |
import android.util.Log; |
import org.json.JSONArray; |
import org.json.JSONException; |
import org.json.JSONObject; |
import org.mozilla.gecko.EventDispatcher; |
import org.mozilla.gecko.GeckoAppShell; |
+import org.mozilla.gecko.util.BundleEventListener; |
import org.mozilla.gecko.util.EventCallback; |
+import org.mozilla.gecko.util.GeckoBundle; |
import org.mozilla.gecko.util.GeckoRequest; |
-import org.mozilla.gecko.util.NativeEventListener; |
import org.mozilla.gecko.util.NativeJSObject; |
@SuppressLint("DefaultLocale") |
public class AddOnBridge |
{ |
private static final String TAG = "AdblockBrowser.AddOnBridge"; |
private static final String REQUEST_NAME = "AdblockPlus:Api"; |
// Handler+HandlerThread for posting delayed re-tries without interfering with |
@@ -257,17 +258,17 @@ public class AddOnBridge |
catch (JSONException e) |
{ |
// we're only adding sane objects |
Log.e(TAG, "Creating request data failed with: " + e.getMessage(), e); |
} |
return obj; |
} |
- public static String makeFirstCharacterUppercase(String str) |
+ private static String makeFirstCharacterUppercase(String str) |
{ |
if (Character.isUpperCase(str.charAt(0))) |
{ |
return str; |
} |
return Character.toString(Character.toUpperCase(str.charAt(0))) + str.substring(1); |
} |
@@ -320,73 +321,73 @@ public class AddOnBridge |
storePendingRequest(request); |
} |
} |
public static void querySubscriptionListStatus(final AdblockPlusApiCallback callback, |
final String url) |
{ |
Log.d(TAG, "querySubscriptionListStatus for " + url); |
- final Map<String, Object> parameters = new HashMap<String, Object>(); |
+ final Map<String, Object> parameters = new HashMap<>(); |
parameters.put("url", url); |
callFunction(callback, "isSubscriptionListed", parameters); |
} |
public static void addSubscription(final AdblockPlusApiCallback callback, |
final String url, final String title) |
{ |
Log.d(TAG, "addSubscription for " + url + " (" + title + ")"); |
- final Map<String, Object> parameters = new HashMap<String, Object>(); |
+ final Map<String, Object> parameters = new HashMap<>(); |
parameters.put("url", url); |
if (title != null) |
{ |
parameters.put("title", title); |
} |
callFunction(callback, "addSubscription", parameters, true); |
} |
public static void queryActiveSubscriptions(final AdblockPlusApiCallback callback) |
{ |
Log.d(TAG, "queryActiveSubscriptions"); |
- final Map<String, Object> parameters = new HashMap<String, Object>(); |
+ final Map<String, Object> parameters = new HashMap<>(); |
callFunction(callback, "getActiveSubscriptions", parameters); |
} |
public static void removeSubscription(final AdblockPlusApiCallback callback, |
final String url) |
{ |
Log.d(TAG, "removeSubscription for " + url); |
- final Map<String, Object> parameters = new HashMap<String, Object>(); |
+ final Map<String, Object> parameters = new HashMap<>(); |
parameters.put("url", url); |
callFunction(callback, "removeSubscription", parameters, true); |
} |
public static void queryIsLocal(final AdblockPlusApiCallback callback, |
final String url) |
{ |
Log.d(TAG, "queryIsLocal for " + url); |
- final Map<String, Object> parameters = new HashMap<String, Object>(); |
+ final Map<String, Object> parameters = new HashMap<>(); |
parameters.put("url", url); |
callFunction(callback, "isLocal", parameters); |
} |
public static void queryIsPageWhitelisted(final AdblockPlusApiCallback callback, |
final String url) |
{ |
Log.d(TAG, "queryIsPageWhitelisted for " + url); |
- final Map<String, Object> parameters = new HashMap<String, Object>(); |
+ final Map<String, Object> parameters = new HashMap<>(); |
parameters.put("url", url); |
callFunction(callback, "isPageWhitelisted", parameters); |
} |
public static void whitelistSite(final AdblockPlusApiCallback callback, final String url, |
final boolean whitelisted) |
{ |
Log.d(TAG, "whitelistSite for " + url); |
- final Map<String, Object> parameters = new HashMap<String, Object>(); |
+ final Map<String, Object> parameters = new HashMap<>(); |
parameters.put("url", url); |
parameters.put("whitelisted", whitelisted); |
callFunction(callback, "whitelistSite", parameters, true); |
} |
private static class AddOnRequest extends GeckoRequest |
{ |
private final JSONObject value; |
@@ -444,20 +445,20 @@ public class AddOnBridge |
} |
else |
{ |
this.invokeFailureCallback(jsObject); |
} |
} |
} |
- private static class AddOnEventListener implements NativeEventListener |
+ private static class AddOnEventListener implements BundleEventListener |
{ |
@Override |
- public void handleMessage(String event, NativeJSObject message, EventCallback callback) |
+ public void handleMessage(String event, GeckoBundle message, EventCallback callback) |
{ |
if (ON_FILTERS_LOAD_EVENT.equals(event)) |
{ |
// The filters have been loaded by the extension. Given that, we can send all pending requests |
filtersLoaded = true; |
sendPendingRequests(); |
} |
else if (ON_FILTERS_SAVE_EVENT.equals(event)) |