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

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

Issue 29588596: Issue 5919 - Adjust our code to the new messaging system (Closed)
Patch Set: Created Oct. 25, 2017, 11:39 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
Index: mobile/android/thirdparty/org/adblockplus/browser/BrowserAppUtils.java
===================================================================
--- a/mobile/android/thirdparty/org/adblockplus/browser/BrowserAppUtils.java
+++ b/mobile/android/thirdparty/org/adblockplus/browser/BrowserAppUtils.java
@@ -18,105 +18,105 @@
package org.adblockplus.browser;
import android.content.Context;
import android.util.Log;
import android.view.MenuItem;
import org.mozilla.gecko.Tab;
import org.mozilla.gecko.Tabs;
-import org.mozilla.gecko.util.NativeJSObject;
+import org.mozilla.gecko.util.GeckoBundle;
import org.mozilla.gecko.util.ThreadUtils;
public class BrowserAppUtils
{
private static final String TAG = "AdblockBrowser.BrowserAppUtils";
public static void updateBlockAdsMenuItem(final MenuItem item)
{
final Tab selectedTab = Tabs.getInstance().getSelectedTab();
if (selectedTab == null)
return;
final String url = selectedTab.getURL();
- AddOnBridge.queryIsLocal(new AdblockPlusApiCallback()
+ AddOnBridge.queryIsLocal(url, new AdblockPlusApiCallback()
{
@Override
- public void onApiRequestSucceeded(NativeJSObject jsObject)
+ public void onApiRequestSucceeded(GeckoBundle bundle)
{
- final boolean local = AddOnBridge.getBooleanFromJsObject(jsObject, "value", true);
+ final boolean local = bundle.getBoolean("value", true);
ThreadUtils.postToUiThread(new Runnable()
{
@Override
public void run()
{
item.setEnabled(!local);
}
});
}
@Override
public void onApiRequestFailed(String errorMessage)
{
Log.e(TAG, "queryIsLocal failed: " + errorMessage);
}
- }, url);
+ });
- AddOnBridge.queryIsPageWhitelisted(new AdblockPlusApiCallback()
+ AddOnBridge.queryIsPageWhitelisted(url, new AdblockPlusApiCallback()
{
@Override
- public void onApiRequestSucceeded(NativeJSObject jsObject)
+ public void onApiRequestSucceeded(GeckoBundle bundle)
{
- final boolean whitelisted = AddOnBridge.getBooleanFromJsObject(jsObject, "value", false);
+ final boolean whitelisted = bundle.getBoolean("value");
ThreadUtils.postToUiThread(new Runnable()
{
@Override
public void run()
{
item.setChecked(!whitelisted);
}
});
}
@Override
public void onApiRequestFailed(String errorMessage)
{
Log.e(TAG, "queryIsPageWhitelisted failed: " + errorMessage);
}
- }, url);
+ });
}
public static void updateCurrentTabWhitelisting(final MenuItem item)
{
final Tab selectedTab = Tabs.getInstance().getSelectedTab();
if (selectedTab == null)
return;
final String url = selectedTab.getURL();
- AddOnBridge.whitelistSite(new AdblockPlusApiCallback()
+ AddOnBridge.whitelistSite(url, item.isChecked(), new AdblockPlusApiCallback()
{
@Override
- public void onApiRequestSucceeded(NativeJSObject jsObject)
+ public void onApiRequestSucceeded(GeckoBundle bundle)
{
ThreadUtils.postToUiThread(new Runnable()
{
@Override
public void run()
{
selectedTab.doReload(false);
}
});
}
@Override
public void onApiRequestFailed(String errorMessage)
{
Log.e(TAG, "whitelistSite failed: " + errorMessage);
}
- }, url, item.isChecked());
+ });
}
public static boolean wasInstalledFromPlayStore(final Context context)
{
final String installer = context.getPackageManager().getInstallerPackageName(context.getPackageName());
return "com.android.vending".equals(installer);
}

Powered by Google App Engine
This is Rietveld