From fb0987b824bcac9481a5daf4a32162b903f78de1 Mon Sep 17 00:00:00 2001 From: Andrew Grieve Date: Thu, 19 Feb 2015 10:31:44 -0500 Subject: [PATCH] Delete some dead code. Add a license header. --- .../org/apache/cordova/AndroidWebView.java | 9 ++++---- .../org/apache/cordova/CordovaActivity.java | 2 -- .../src/org/apache/cordova/CordovaBridge.java | 6 +---- .../org/apache/cordova/CordovaWebView.java | 22 ++++++++++++++----- 4 files changed, 23 insertions(+), 16 deletions(-) diff --git a/framework/src/org/apache/cordova/AndroidWebView.java b/framework/src/org/apache/cordova/AndroidWebView.java index de171f21..a5f568b4 100755 --- a/framework/src/org/apache/cordova/AndroidWebView.java +++ b/framework/src/org/apache/cordova/AndroidWebView.java @@ -80,6 +80,7 @@ public class AndroidWebView extends WebView implements CordovaWebView { private long lastMenuEventTime = 0; + private NativeToJsMessageQueue nativeToJsMessageQueue; CordovaBridge bridge; /** custom view created by the browser (a video player for example) */ @@ -123,7 +124,7 @@ public class AndroidWebView extends WebView implements CordovaWebView { pluginManager = new PluginManager(this, this.cordova, pluginEntries); cookieManager = new AndroidCookieManager(this); resourceApi = new CordovaResourceApi(this.getContext(), pluginManager); - NativeToJsMessageQueue nativeToJsMessageQueue = new NativeToJsMessageQueue(); + nativeToJsMessageQueue = new NativeToJsMessageQueue(); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.NoOpBridgeMode()); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.LoadUrlBridgeMode(this, cordova)); nativeToJsMessageQueue.addBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode(new NativeToJsMessageQueue.OnlineEventsBridgeMode.OnlineEventsBridgeModeDelegate() { @@ -137,7 +138,7 @@ public class AndroidWebView extends WebView implements CordovaWebView { cordova.getActivity().runOnUiThread(r); } })); - bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue, this.cordova.getActivity().getPackageName()); + bridge = new CordovaBridge(pluginManager, nativeToJsMessageQueue); initWebViewSettings(); pluginManager.addService(CoreAndroid.PLUGIN_NAME, CoreAndroid.class.getCanonicalName()); pluginManager.init(); @@ -403,14 +404,14 @@ public class AndroidWebView extends WebView implements CordovaWebView { * (This is a convenience method) */ public void sendJavascript(String statement) { - bridge.getMessageQueue().addJavaScript(statement); + nativeToJsMessageQueue.addJavaScript(statement); } /** * Send a plugin result back to JavaScript. */ public void sendPluginResult(PluginResult result, String callbackId) { - bridge.getMessageQueue().addPluginResult(result, callbackId); + nativeToJsMessageQueue.addPluginResult(result, callbackId); } /** diff --git a/framework/src/org/apache/cordova/CordovaActivity.java b/framework/src/org/apache/cordova/CordovaActivity.java index bc262a6c..08876aba 100755 --- a/framework/src/org/apache/cordova/CordovaActivity.java +++ b/framework/src/org/apache/cordova/CordovaActivity.java @@ -19,7 +19,6 @@ package org.apache.cordova; import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; import java.util.Locale; @@ -350,7 +349,6 @@ public class CordovaActivity extends Activity { // If errorUrl specified, then load it final String errorUrl = preferences.getString("errorUrl", null); - CordovaUriHelper helper = new CordovaUriHelper(this.cordovaInterface, appView); if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) { // Load URL on UI thread me.runOnUiThread(new Runnable() { diff --git a/framework/src/org/apache/cordova/CordovaBridge.java b/framework/src/org/apache/cordova/CordovaBridge.java index bf955883..50eb9012 100644 --- a/framework/src/org/apache/cordova/CordovaBridge.java +++ b/framework/src/org/apache/cordova/CordovaBridge.java @@ -36,7 +36,7 @@ public class CordovaBridge { private NativeToJsMessageQueue jsMessageQueue; private volatile int expectedBridgeSecret = -1; // written by UI thread, read by JS thread. - public CordovaBridge(PluginManager pluginManager, NativeToJsMessageQueue jsMessageQueue, String packageName) { + public CordovaBridge(PluginManager pluginManager, NativeToJsMessageQueue jsMessageQueue) { this.pluginManager = pluginManager; this.jsMessageQueue = jsMessageQueue; } @@ -177,8 +177,4 @@ public class CordovaBridge { } return null; } - - public NativeToJsMessageQueue getMessageQueue() { - return jsMessageQueue; - } } diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java index 3b209d5e..de04c6aa 100644 --- a/framework/src/org/apache/cordova/CordovaWebView.java +++ b/framework/src/org/apache/cordova/CordovaWebView.java @@ -1,3 +1,19 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + http://www.apache.org/licenses/LICENSE-2.0 + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ package org.apache.cordova; import java.util.Map; @@ -5,15 +21,13 @@ import java.util.List; import android.content.Context; import android.content.Intent; -import android.net.Uri; import android.view.View; import android.webkit.WebChromeClient.CustomViewCallback; public interface CordovaWebView { public static final String CORDOVA_VERSION = "4.0.0-dev"; - void init(CordovaInterface cordova, List pluginEntries, - CordovaPreferences preferences); + void init(CordovaInterface cordova, List pluginEntries, CordovaPreferences preferences); View getView(); @@ -39,9 +53,7 @@ public interface CordovaWebView { /** * Send JavaScript statement back to JavaScript. - * (This is a convenience method) * - * @param statement * Deprecated (https://issues.apache.org/jira/browse/CB-6851) * Instead of executing snippets of JS, you should use the exec bridge * to create a Java->JS communication channel.