cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [1/2] android commit: CB-8510 Enforce that CordovaWebViewImpl is instantiated with an Engine
Date Tue, 03 Mar 2015 14:52:18 GMT
Repository: cordova-android
Updated Branches:
  refs/heads/master eccf48616 -> 62c081dc8


CB-8510 Enforce that CordovaWebViewImpl is instantiated with an Engine

No reason to not enforce this.


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/023ad9dd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/023ad9dd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/023ad9dd

Branch: refs/heads/master
Commit: 023ad9ddf8b5a69ffe7f15fbcb83719aae77ffcc
Parents: eccf486
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Mar 3 09:51:03 2015 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Mar 3 09:51:03 2015 -0500

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaActivity.java      |  4 +---
 .../src/org/apache/cordova/CordovaWebViewImpl.java   | 15 +++------------
 2 files changed, 4 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/023ad9dd/framework/src/org/apache/cordova/CordovaActivity.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java
index 7942626..5d0a586 100755
--- a/framework/src/org/apache/cordova/CordovaActivity.java
+++ b/framework/src/org/apache/cordova/CordovaActivity.java
@@ -21,7 +21,6 @@ package org.apache.cordova;
 import java.util.ArrayList;
 import java.util.Locale;
 
-import org.apache.cordova.engine.SystemWebViewEngine;
 import org.json.JSONException;
 import org.json.JSONObject;
 
@@ -189,8 +188,7 @@ public class CordovaActivity extends Activity {
     }
 
     protected CordovaWebViewEngine makeWebViewEngine() {
-        String className = preferences.getString("webview", SystemWebViewEngine.class.getCanonicalName());
-        return CordovaWebViewImpl.createEngine(className, this, preferences);
+        return CordovaWebViewImpl.createEngine(this, preferences);
     }
 
     protected CordovaInterfaceImpl makeCordovaInterface() {

http://git-wip-us.apache.org/repos/asf/cordova-android/blob/023ad9dd/framework/src/org/apache/cordova/CordovaWebViewImpl.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebViewImpl.java b/framework/src/org/apache/cordova/CordovaWebViewImpl.java
index 303f4e8..d600440 100644
--- a/framework/src/org/apache/cordova/CordovaWebViewImpl.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewImpl.java
@@ -21,13 +21,11 @@ package org.apache.cordova;
 import android.content.Context;
 import android.content.Intent;
 import android.net.Uri;
-import android.os.Build;
 import android.util.Log;
 import android.view.Gravity;
 import android.view.KeyEvent;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.inputmethod.InputMethodManager;
 import android.webkit.WebChromeClient;
 import android.widget.FrameLayout;
 
@@ -53,7 +51,7 @@ public class CordovaWebViewImpl implements CordovaWebView {
     // Public for backwards-compatibility :(
     public PluginManager pluginManager;
 
-    protected CordovaWebViewEngine engine;
+    protected final CordovaWebViewEngine engine;
     private CordovaInterface cordova;
 
     // Flag to track that a loadUrl timeout occurred
@@ -75,7 +73,8 @@ public class CordovaWebViewImpl implements CordovaWebView {
 
     private Set<Integer> boundKeyCodes = new HashSet<Integer>();
 
-    public static CordovaWebViewEngine createEngine(String className, Context context, CordovaPreferences
preferences) {
+    public static CordovaWebViewEngine createEngine(Context context, CordovaPreferences preferences)
{
+        String className = preferences.getString("webview", SystemWebViewEngine.class.getCanonicalName());
         try {
             Class<?> webViewClass = Class.forName(className);
             Constructor<?> constructor = webViewClass.getConstructor(Context.class,
CordovaPreferences.class);
@@ -85,9 +84,6 @@ public class CordovaWebViewImpl implements CordovaWebView {
         }
     }
 
-    public CordovaWebViewImpl(Context context) {
-        this(context, null);
-    }
     public CordovaWebViewImpl(Context context, CordovaWebViewEngine cordovaWebViewEngine)
{
         this.context = context;
         this.engine = cordovaWebViewEngine;
@@ -102,11 +98,6 @@ public class CordovaWebViewImpl implements CordovaWebView {
         if (this.cordova != null) {
             throw new IllegalStateException();
         }
-        // Happens only when not using CordovaActivity. Usually, engine is set in the constructor.
-        if (engine == null) {
-            String className = preferences.getString("webView", SystemWebViewEngine.class.getCanonicalName());
-            engine = createEngine(className, context, preferences);
-        }
         this.cordova = cordova;
         this.preferences = preferences;
         pluginManager = new PluginManager(this, this.cordova, pluginEntries);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message