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

Delta Between Two Patch Sets: libadblockplus-android-webview/src/org/adblockplus/libadblockplus/android/webview/IoThreadClientInvocationHandler.java

Issue 29351744: Issue 4399 - Add WebView inheritor with ad blocking (Closed)
Left Patch Set: removed gradlew.bat - it relates to issue-4324 Created Sept. 16, 2016, 11:27 a.m.
Right Patch Set: changed packages, now using AdblockEngine (original ABPEngine), improved demo app Created Oct. 25, 2016, 11:20 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18 package org.adblockplus.libadblockplus.android.webview;
19
20 import android.util.Log;
21
22 import org.adblockplus.libadblockplus.android.Utils;
23
24 import java.lang.reflect.InvocationHandler;
25 import java.lang.reflect.Method;
26 import java.lang.reflect.UndeclaredThrowableException;
27
28 public class IoThreadClientInvocationHandler implements InvocationHandler
29 {
30 private final String TAG = Utils.getTag(IoThreadClientInvocationHandler.class) ;
31
32 public static transient Boolean isMainFrame;
33 private Object wrappedObject;
34
35 public IoThreadClientInvocationHandler(Object wrappedObject)
36 {
37 this.wrappedObject = wrappedObject;
38 }
39
40 @Override
41 public Object invoke(Object proxy, Method method, Object[] args) throws Throwa ble
42 {
43 // intercept invocation and store 'isMainFrame' argument
44 if (method.getName().startsWith("shouldInterceptRequest") && args.length == 2)
45 {
46 String url = (String)args[0];
47 isMainFrame = (Boolean)args[1];
48
49 Log.d(TAG, "isMainFrame=" + isMainFrame + " for " + url);
50 }
51 return method.invoke(wrappedObject, args);
52 }
53 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld