Upstream version 10.39.233.0
[platform/framework/web/crosswalk.git] / src / xwalk / runtime / android / core_internal / src / org / xwalk / core / internal / XWalkViewInternal.java
index fbc91f4..f57dc48 100644 (file)
@@ -25,6 +25,8 @@ import java.io.File;
 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;
@@ -250,6 +252,10 @@ public class XWalkViewInternal extends android.widget.FrameLayout {
         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.
@@ -698,7 +704,7 @@ public class XWalkViewInternal extends android.widget.FrameLayout {
     // TODO(yongsheng): make it static?
     @XWalkAPI
     public String getAPIVersion() {
-        return "2.1";
+        return "3.0";
     }
 
     /**
@@ -763,17 +769,35 @@ public class XWalkViewInternal extends android.widget.FrameLayout {
     }
 
     /**
-     * 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;
+        }
     }
 
     /**
@@ -825,8 +849,8 @@ public class XWalkViewInternal extends android.widget.FrameLayout {
 
     // 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() {