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

Commit c53471cf authored by Jonathan Dixon's avatar Jonathan Dixon Committed by Android (Google) Code Review
Browse files

Merge "Tidy up usage of URLUtil constants"

parents fb32ab90 0fa72ef1
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -692,13 +692,10 @@ class BrowserFrame extends Handler {
     * @return An InputStream to the android resource
     */
    private InputStream inputStreamForAndroidResource(String url) {
        // This list needs to be kept in sync with the list in
        // external/webkit/WebKit/android/WebCoreSupport/WebUrlLoaderClient.cpp
        final String ANDROID_ASSET = "file:///android_asset/";
        final String ANDROID_RESOURCE = "file:///android_res/";
        final String ANDROID_CONTENT = "content:";
        final String ANDROID_ASSET = URLUtil.ASSET_BASE;
        final String ANDROID_RESOURCE = URLUtil.RESOURCE_BASE;
        final String ANDROID_CONTENT = URLUtil.CONTENT_BASE;

        // file:///android_res
        if (url.startsWith(ANDROID_RESOURCE)) {
            url = url.replaceFirst(ANDROID_RESOURCE, "");
            if (url == null || url.length() == 0) {
@@ -736,8 +733,6 @@ class BrowserFrame extends Handler {
                Log.e(LOGTAG, "Exception: " + url);
                return null;
            }

        // file:///android_asset
        } else if (url.startsWith(ANDROID_ASSET)) {
            url = url.replaceFirst(ANDROID_ASSET, "");
            try {
@@ -747,8 +742,6 @@ class BrowserFrame extends Handler {
            } catch (IOException e) {
                return null;
            }

        // content://
        } else if (mSettings.getAllowContentAccess() &&
                   url.startsWith(ANDROID_CONTENT)) {
            try {
+1 −1
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ class JniUtil {
        return sContext.getPackageName();
    }

    private static final String ANDROID_CONTENT = "content:";
    private static final String ANDROID_CONTENT = URLUtil.CONTENT_BASE;

    /**
     * Called by JNI. Calculates the size of an input stream by reading it.
+0 −1
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package android.webkit;

import android.text.TextUtils;
import java.util.HashMap;
import java.util.regex.Pattern;
import libcore.net.MimeUtils;

+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ public final class URLUtil {
    static final String RESOURCE_BASE = "file:///android_res/";
    static final String FILE_BASE = "file://";
    static final String PROXY_BASE = "file:///cookieless_proxy/";
    static final String CONTENT_BASE = "content:";

    /**
     * Cleans up (if possible) user-entered web addresses
@@ -253,7 +254,7 @@ public final class URLUtil {
     * @return True iff the url is a content: url.
     */
    public static boolean isContentUrl(String url) {
        return (null != url) && url.startsWith("content:");
        return (null != url) && url.startsWith(CONTENT_BASE);
    }

    /**