import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.ref.WeakReference;
+import java.net.MalformedURLException;
+import java.net.URL;
import org.chromium.base.ActivityState;
import org.chromium.base.ApplicationStatus;
return mContext;
}
+ public void completeWindowCreation(XWalkViewInternal newXWalkView) {
+ mContent.supplyContentsForPopup(newXWalkView == null ? null : newXWalkView.mContent);
+ }
+
private void init(Context context, AttributeSet attrs) {
// Initialize chromium resources. Assign them the correct ids in
// xwalk core.
// TODO(yongsheng): make it static?
@XWalkAPI
public String getAPIVersion() {
- return "2.1";
+ return "3.0";
}
/**
}
/**
- * Enables remote debugging and returns the URL at which the dev tools server is listening
- * for commands. The allowedUid argument can be used to specify the uid of the process that is
- * permitted to connect.
- * TODO(yongsheng): how to enable this in XWalkPreferencesInternal?
- *
- * @hide
+ * Enables remote debugging and returns the URL at which the dev tools
+ * server is listening for commands.
+ * The allowedUid argument can be used to specify the uid of the process
+ * that is permitted to connect.
+ */
+ public void enableRemoteDebugging(int allowedUid) {
+ if (mContent == null) return;
+ checkThreadSafety();
+ mContent.enableRemoteDebugging(allowedUid);
+ }
+
+ /**
+ * Get the websocket url for remote debugging.
+ * @return the web socket url to remote debug this xwalk view.
+ * null will be returned if remote debugging is not enabled.
+ * @since 4.0
*/
- public String enableRemoteDebugging(int allowedUid) {
+ @XWalkAPI
+ public URL getRemoteDebuggingUrl() {
if (mContent == null) return null;
checkThreadSafety();
- return mContent.enableRemoteDebugging(allowedUid);
+ String wsUrl = mContent.getRemoteDebuggingUrl();
+ if (wsUrl == null || wsUrl.isEmpty()) return null;
+
+ try {
+ return new URL(wsUrl);
+ } catch (MalformedURLException e) {
+ return null;
+ }
}
/**
// Enables remote debugging and returns the URL at which the dev tools server is listening
// for commands. Only the current process is allowed to connect to the server.
- String enableRemoteDebugging() {
- return enableRemoteDebugging(mContext.getApplicationInfo().uid);
+ void enableRemoteDebugging() {
+ enableRemoteDebugging(mContext.getApplicationInfo().uid);
}
void disableRemoteDebugging() {