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

Unified Diff: mobile/android/thirdparty/org/adblockplus/browser/SubscriptionContainer.java

Issue 29588596: Issue 5919 - Adjust our code to the new messaging system (Closed)
Patch Set: Adding missing return statements Created Nov. 2, 2017, 10:12 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mobile/android/thirdparty/org/adblockplus/browser/MoreSubscriptionsPreferenceGroup.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mobile/android/thirdparty/org/adblockplus/browser/SubscriptionContainer.java
===================================================================
--- a/mobile/android/thirdparty/org/adblockplus/browser/SubscriptionContainer.java
+++ b/mobile/android/thirdparty/org/adblockplus/browser/SubscriptionContainer.java
@@ -22,17 +22,17 @@ import java.io.StringReader;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.Semaphore;
-import org.mozilla.gecko.util.NativeJSObject;
+import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.ThreadUtils;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import android.util.Log;
import android.util.Xml;
final class SubscriptionContainer implements AdblockPlusApiCallback
@@ -52,17 +52,17 @@ final class SubscriptionContainer implem
public final static SubscriptionContainer create()
{
return create(true);
}
public final static SubscriptionContainer create(final boolean refresh)
{
final SubscriptionContainer sc = new SubscriptionContainer();
- AddOnBridge.queryValue(sc, "subscriptionsXml");
+ AddOnBridge.queryValue("subscriptionsXml", sc);
sc.entriesReady.acquireUninterruptibly();
for (final SubscriptionContainer.Subscription e : sc.entries)
{
sc.urlMap.put(e.url, e);
sc.enableState.put(e.url, Boolean.FALSE);
}
@@ -148,23 +148,23 @@ final class SubscriptionContainer implem
if (shouldAddListener)
{
this.subscriptionListeners.add(new WeakReference<>(listener));
}
}
@Override
- public void onApiRequestSucceeded(NativeJSObject jsObject)
+ public void onApiRequestSucceeded(GeckoBundle bundle)
{
final XmlPullParser parser = Xml.newPullParser();
try
{
parser.setFeature(XmlPullParser.FEATURE_PROCESS_NAMESPACES, false);
- parser.setInput(new StringReader(AddOnBridge.getStringFromJsObject(jsObject, "value", "")));
+ parser.setInput(new StringReader(bundle.getString("value", "")));
parser.nextTag();
parser.require(XmlPullParser.START_TAG, null, "subscriptions");
while (parser.next() != XmlPullParser.END_TAG)
{
if (parser.getEventType() != XmlPullParser.START_TAG)
{
continue;
}
@@ -230,40 +230,39 @@ final class SubscriptionContainer implem
return new SubscriptionChangeAction(subscription, parent, mode).post();
}
public SubscriptionContainer.SubscriptionChangeAction post()
{
switch (this.mode)
{
case QUERY_SUBSCRIPTION_ENABLED:
- AddOnBridge.querySubscriptionListStatus(this, this.subscription.url);
+ AddOnBridge.querySubscriptionListStatus(this.subscription.url, this);
break;
case ENABLE_SUBSCRIPTION:
- AddOnBridge.addSubscription(this, this.subscription.url, this.subscription.title);
+ AddOnBridge.addSubscription(this.subscription.url, this.subscription.title, this);
break;
case DISABLE_SUBSCRIPTION:
- AddOnBridge.removeSubscription(this, this.subscription.url);
+ AddOnBridge.removeSubscription(this.subscription.url, this);
break;
default:
break;
}
return this;
}
@Override
- public void onApiRequestSucceeded(NativeJSObject jsObject)
+ public void onApiRequestSucceeded(GeckoBundle bundle)
{
switch (this.mode)
{
case QUERY_SUBSCRIPTION_ENABLED:
try
{
- this.parent.enableState.put(this.subscription.url,
- Boolean.valueOf(AddOnBridge.getBooleanFromJsObject(jsObject, "value", false)));
+ this.parent.enableState.put(this.subscription.url, bundle.getBoolean("value"));
}
finally
{
this.parent.entriesReady.release();
}
break;
case ENABLE_SUBSCRIPTION:
case DISABLE_SUBSCRIPTION:
« no previous file with comments | « mobile/android/thirdparty/org/adblockplus/browser/MoreSubscriptionsPreferenceGroup.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld