Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 657c80b1 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 3775 into donut

* changes:
  DO NOT MERGE.
parents 116e8ef1 41d2676d
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -142,6 +142,17 @@ class BrowserFrame extends Handler {
        mLoadInitFromJava = false;
    }

    /**
     * Load a url with "POST" method from the network into the main frame.
     * @param url The url to load.
     * @param data The data for POST request.
     */
    public void postUrl(String url, byte[] data) {
        mLoadInitFromJava = true;
        nativePostUrl(url, data);
        mLoadInitFromJava = false;
    }

    /**
     * Load the content as if it was loaded by the provided base URL. The
     * failUrl is used as the history entry for the load data. If null or
@@ -752,6 +763,8 @@ class BrowserFrame extends Handler {
     */
    private native void nativeLoadUrl(String url);

    private native void nativePostUrl(String url, byte[] postData);

    private native void nativeLoadData(String baseUrl, String data,
            String mimeType, String encoding, String failUrl);

+23 −0
Original line number Diff line number Diff line
@@ -1117,6 +1117,29 @@ public class WebView extends AbsoluteLayout
        clearTextEntry();
    }

    /**
     * Load the url with postData using "POST" method into the WebView. If url
     * is not a network url, it will be loaded with {link
     * {@link #loadUrl(String)} instead.
     * 
     * @param url The url of the resource to load.
     * @param postData The data will be passed to "POST" request.
     * 
     * @hide pending API solidification
     */
    public void postUrl(String url, byte[] postData) {
        if (URLUtil.isNetworkUrl(url)) {
            switchOutDrawHistory();
            HashMap arg = new HashMap();
            arg.put("url", url);
            arg.put("data", postData);
            mWebViewCore.sendMessage(EventHub.POST_URL, arg);
            clearTextEntry();
        } else {
            loadUrl(url);
        }
    }

    /**
     * Load the given data into the WebView. This will load the data into
     * WebView using the data: scheme. Content loaded through this mechanism
+11 −0
Original line number Diff line number Diff line
@@ -544,6 +544,8 @@ final class WebViewCore {
            "WEBKIT_DRAW", // = 130;
            "SYNC_SCROLL", // = 131;
            "REFRESH_PLUGINS", // = 132;
            // this will replace REFRESH_PLUGINS in the next release
            "POST_URL", // = 142;
            "SPLIT_PICTURE_SET", // = 133;
            "CLEAR_CONTENT", // = 134;
            "SET_FINAL_FOCUS", // = 135;
@@ -589,6 +591,8 @@ final class WebViewCore {
        static final int WEBKIT_DRAW = 130;
        static final int SYNC_SCROLL = 131;
        static final int REFRESH_PLUGINS = 132;
        // this will replace REFRESH_PLUGINS in the next release
        static final int POST_URL = 142;
        static final int SPLIT_PICTURE_SET = 133;
        static final int CLEAR_CONTENT = 134;
        
@@ -672,6 +676,13 @@ final class WebViewCore {
                            loadUrl((String) msg.obj);
                            break;

                        case POST_URL: {
                            HashMap param = (HashMap) msg.obj;
                            String url = (String) param.get("url");
                            byte[] data = (byte[]) param.get("data");
                            mBrowserFrame.postUrl(url, data);
                            break;
                        }
                        case LOAD_DATA:
                            HashMap loadParams = (HashMap) msg.obj;
                            String baseUrl = (String) loadParams.get("baseUrl");