diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index a3b6314c..ff966676 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -319,7 +319,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { * @param webView the default constructed web view object */ protected CordovaChromeClient makeChromeClient(CordovaWebView webView) { - return webView.makeChromeClient(this); + return webView.makeWebChromeClient(this); } @Deprecated // No need to call init() anymore. diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index 8d0b4a9b..8eae3509 100755 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -21,12 +21,10 @@ package org.apache.cordova; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Locale; -import java.util.Map; import org.apache.cordova.Config; import org.apache.cordova.CordovaInterface; @@ -41,8 +39,6 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.content.pm.ApplicationInfo; -import android.content.pm.PackageManager; -import android.content.pm.PackageManager.NameNotFoundException; import android.net.Uri; import android.os.Build; import android.os.Bundle; @@ -59,6 +55,7 @@ import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebSettings.LayoutAlgorithm; +import android.webkit.WebViewClient; import android.widget.FrameLayout; /* @@ -145,14 +142,14 @@ public class CordovaWebView extends WebView { } // Use two-phase init so that the control will work with XML layouts. - public void init(CordovaInterface cordova, CordovaWebViewClient webViewClient, CordovaChromeClient chromeClient, List pluginEntries) { + public void init(CordovaInterface cordova, CordovaWebViewClient webViewClient, CordovaChromeClient webChromeClient, List pluginEntries) { if (this.cordova != null) { throw new IllegalStateException(); } this.cordova = cordova; this.viewClient = webViewClient; - this.chromeClient = chromeClient; - super.setWebChromeClient(chromeClient); + this.chromeClient = webChromeClient; + super.setWebChromeClient(webChromeClient); super.setWebViewClient(webViewClient); pluginManager = new PluginManager(this, this.cordova, pluginEntries); @@ -264,7 +261,7 @@ public class CordovaWebView extends WebView { } } - public CordovaChromeClient makeChromeClient(CordovaInterface cordova) { + public CordovaChromeClient makeWebChromeClient(CordovaInterface cordova) { return new CordovaChromeClient(cordova, this); } @@ -296,21 +293,15 @@ public class CordovaWebView extends WebView { this.addJavascriptInterface(exposedJsApi, "_cordovaNative"); } - /** - * Set the WebViewClient. - */ - @Deprecated // Set this in init() instead. - public void setWebViewClient(CordovaWebViewClient client) { - this.viewClient = client; + @Override + public void setWebViewClient(WebViewClient client) { + this.viewClient = (CordovaWebViewClient)client; super.setWebViewClient(client); } - /** - * Set the WebChromeClient. - */ - @Deprecated // Set this in init() instead. - public void setWebChromeClient(CordovaChromeClient client) { - this.chromeClient = client; + @Override + public void setWebChromeClient(WebChromeClient client) { + this.chromeClient = (CordovaChromeClient)client; super.setWebChromeClient(client); } diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java index 65d8ff67..35dbea17 100755 --- a/framework/src/org/apache/cordova/CordovaWebViewClient.java +++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java @@ -32,7 +32,6 @@ import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.graphics.Bitmap; import android.net.http.SslError; -import android.util.Log; import android.view.View; import android.webkit.HttpAuthHandler; import android.webkit.SslErrorHandler; @@ -54,7 +53,6 @@ import android.webkit.WebViewClient; public class CordovaWebViewClient extends WebViewClient { private static final String TAG = "CordovaWebViewClient"; - private static final String CORDOVA_EXEC_URL_PREFIX = "http://cdv_exec/"; CordovaInterface cordova; CordovaWebView appView; CordovaUriHelper helper; @@ -92,25 +90,6 @@ public class CordovaWebViewClient extends WebViewClient { helper = new CordovaUriHelper(cordova, view); } - - // Parses commands sent by setting the webView's URL to: - // cdvbrg:service/action/callbackId#jsonArgs - private void handleExecUrl(String url) { - int idx1 = CORDOVA_EXEC_URL_PREFIX.length(); - int idx2 = url.indexOf('#', idx1 + 1); - int idx3 = url.indexOf('#', idx2 + 1); - int idx4 = url.indexOf('#', idx3 + 1); - if (idx1 == -1 || idx2 == -1 || idx3 == -1 || idx4 == -1) { - Log.e(TAG, "Could not decode URL command: " + url); - return; - } - String service = url.substring(idx1, idx2); - String action = url.substring(idx2 + 1, idx3); - String callbackId = url.substring(idx3 + 1, idx4); - String jsonArgs = url.substring(idx4 + 1); - appView.pluginManager.exec(service, action, callbackId, jsonArgs); - } - /** * Give the host application a chance to take over the control when a new url * is about to be loaded in the current WebView.