in src/main/java/com/phonegap/plugins/childBrowser/ChildBrowser.java [68:115]
public PluginResult execute(String action, JSONArray args, String callbackId) {
PluginResult.Status status = PluginResult.Status.OK;
String result = "";
try {
if (action.equals("showWebPage")) {
this.browserCallbackId = callbackId;
// If the ChildBrowser is already open then throw an error
if (dialog != null && dialog.isShowing()) {
return new PluginResult(PluginResult.Status.ERROR, "ChildBrowser is already open");
}
result = this.showWebPage(args.getString(0), args.optJSONObject(1));
if (result.length() > 0) {
status = PluginResult.Status.ERROR;
return new PluginResult(status, result);
} else {
PluginResult pluginResult = new PluginResult(status, result);
pluginResult.setKeepCallback(true);
return pluginResult;
}
}
else if (action.equals("close")) {
closeDialog();
JSONObject obj = new JSONObject();
obj.put("type", CLOSE_EVENT);
PluginResult pluginResult = new PluginResult(status, obj);
pluginResult.setKeepCallback(false);
return pluginResult;
}
else if (action.equals("openExternal")) {
result = this.openExternal(args.getString(0), args.optBoolean(1));
if (result.length() > 0) {
status = PluginResult.Status.ERROR;
}
}
else {
status = PluginResult.Status.INVALID_ACTION;
}
return new PluginResult(status, result);
} catch (JSONException e) {
return new PluginResult(PluginResult.Status.JSON_EXCEPTION);
}
}