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

Unified Diff: src/org/adblockplus/android/AndroidFilterChangeCallback.java

Issue 5697499218051072: Usage of new API, cleanups (reduced) (Closed)
Patch Set: Even more review issues fixed. Created April 28, 2014, 10:18 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: src/org/adblockplus/android/AndroidFilterChangeCallback.java
diff --git a/src/org/adblockplus/brazil/TransparentProxyHandler.java b/src/org/adblockplus/android/AndroidFilterChangeCallback.java
similarity index 51%
copy from src/org/adblockplus/brazil/TransparentProxyHandler.java
copy to src/org/adblockplus/android/AndroidFilterChangeCallback.java
index 87abada97d2e35348bb9bbeb09686892baf71a73..f07836c5b4162160706fc92ea7c96df54e8235ab 100644
--- a/src/org/adblockplus/brazil/TransparentProxyHandler.java
+++ b/src/org/adblockplus/android/AndroidFilterChangeCallback.java
@@ -15,35 +15,31 @@
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
*/
-package org.adblockplus.brazil;
+package org.adblockplus.android;
-import java.io.IOException;
+import org.adblockplus.libadblockplus.FilterChangeCallback;
+import org.adblockplus.libadblockplus.JsValue;
+import org.adblockplus.libadblockplus.Subscription;
-import sunlabs.brazil.server.Handler;
-import sunlabs.brazil.server.Request;
-import sunlabs.brazil.server.Server;
+import android.content.Context;
-/**
- * Reconstructs request url to comply with proxy specification if transparent
- * proxy is used.
- */
-public class TransparentProxyHandler implements Handler
+public class AndroidFilterChangeCallback extends FilterChangeCallback
{
+ private final Context context;
- @Override
- public boolean init(Server server, String prefix)
+ public AndroidFilterChangeCallback(final Context context)
{
- return true;
+ this.context = context;
}
@Override
- public boolean respond(Request request) throws IOException
+ public void filterChangeCallback(final String action, final JsValue jsValue)
{
- if (!request.url.contains("://"))
+ if (action.equals("subscription.lastDownload") || action.equals("subscription.downloadStatus"))
{
- request.url = "http://" + request.headers.get("host") + request.url;
+ final Subscription sub = new Subscription(jsValue);
+
+ Utils.updateSubscriptionStatus(this.context, sub);
}
- return false;
}
-
}
« no previous file with comments | « src/org/adblockplus/android/AdvancedPreferences.java ('k') | src/org/adblockplus/android/AndroidLogSystem.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld