Issue #1101 ยป tab.patch
| Tab-new.java 2014-11-25 17:42:15.753684970 +0100 | ||
|---|---|---|
|
mWebViewController.onReceivedHttpAuthRequest(Tab.this, view, handler, host, realm);
|
||
|
}
|
||
|
@Override
|
||
|
protected boolean isBlockedSite(Uri uri) {
|
||
|
String host = uri.getHost();
|
||
|
String[] blockedSites = {"2mdn.net", "doubleclick.net",
|
||
|
"admeld.com",
|
||
|
"admob.com"
|
||
|
};
|
||
|
for (String sites : blockedSites) {
|
||
|
for (String site : sites.split(" ")) {
|
||
|
if (host.toLowerCase().endsWith(site.toLowerCase())) { return true; }
|
||
|
}
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
@Override
|
||
|
public WebResourceResponse shouldInterceptRequest(WebView view,
|
||
|
String url) {
|
||
|
if (!url.startsWith("data:") && (isBlockedSite(Uri.parse(url)))) {
|
||
|
Uri uri2 = Uri.parse(url);
|
||
|
return new WebResourceResponse("text/plain", "utf-8",
|
||
|
new ByteArrayInputStream(("[The following URL was blocked " + uri2.getHost() + "]").getBytes()));
|
||
|
}
|
||
|
WebResourceResponse res = HomeProvider.shouldInterceptRequest(
|
||
|
mContext, url);
|
||
|
return res;
|
||