Delete some dead code. Add a license header.

This commit is contained in:
Andrew Grieve 2015-02-19 10:31:44 -05:00
parent 88f50a66ff
commit fb0987b824
4 changed files with 23 additions and 16 deletions

View File

@ -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);
}
/**

View File

@ -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() {

View File

@ -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;
}
}

View File

@ -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<PluginEntry> pluginEntries,
CordovaPreferences preferences);
void init(CordovaInterface cordova, List<PluginEntry> 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.