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

Commit d58ccff7 authored by Patrick Scott's avatar Patrick Scott
Browse files

Add a boolean indicating if the apple-touch-icon is precomposed.

parent 408cf852
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -605,8 +605,8 @@ class BrowserFrame extends Handler {
    }
    }


    // Called by JNI when an apple-touch-icon attribute was found.
    // Called by JNI when an apple-touch-icon attribute was found.
    private void didReceiveTouchIconUrl(String url) {
    private void didReceiveTouchIconUrl(String url, boolean precomposed) {
        mCallbackProxy.onReceivedTouchIconUrl(url);
        mCallbackProxy.onReceivedTouchIconUrl(url, precomposed);
    }
    }


    /**
    /**
+7 −4
Original line number Original line Diff line number Diff line
@@ -249,7 +249,7 @@ class CallbackProxy extends Handler {
            case RECEIVED_TOUCH_ICON_URL:
            case RECEIVED_TOUCH_ICON_URL:
                if (mWebChromeClient != null) {
                if (mWebChromeClient != null) {
                    mWebChromeClient.onReceivedTouchIconUrl(mWebView,
                    mWebChromeClient.onReceivedTouchIconUrl(mWebView,
                            (String) msg.obj);
                            (String) msg.obj, msg.arg1 == 1);
                }
                }
                break;
                break;


@@ -1065,19 +1065,22 @@ class CallbackProxy extends Handler {
        sendMessage(obtainMessage(RECEIVED_ICON, icon));
        sendMessage(obtainMessage(RECEIVED_ICON, icon));
    }
    }


    /* package */ void onReceivedTouchIconUrl(String url) {
    /* package */ void onReceivedTouchIconUrl(String url, boolean precomposed) {
        // We should have a current item but we do not want to crash so check
        // We should have a current item but we do not want to crash so check
        // for null.
        // for null.
        WebHistoryItem i = mBackForwardList.getCurrentItem();
        WebHistoryItem i = mBackForwardList.getCurrentItem();
        if (i != null) {
        if (i != null) {
            if (precomposed || i.getTouchIconUrl() != null) {
                i.setTouchIconUrl(url);
                i.setTouchIconUrl(url);
            }
            }
        }
        // Do an unsynchronized quick check to avoid posting if no callback has
        // Do an unsynchronized quick check to avoid posting if no callback has
        // been set.
        // been set.
        if (mWebChromeClient == null) {
        if (mWebChromeClient == null) {
            return;
            return;
        }
        }
        sendMessage(obtainMessage(RECEIVED_TOUCH_ICON_URL, url));
        sendMessage(obtainMessage(RECEIVED_TOUCH_ICON_URL,
                precomposed ? 1 : 0, 0, url));
    }
    }


    public void onReceivedTitle(String title) {
    public void onReceivedTitle(String title) {
+3 −1
Original line number Original line Diff line number Diff line
@@ -48,9 +48,11 @@ public class WebChromeClient {
     * Notify the host application of the url for an apple-touch-icon.
     * Notify the host application of the url for an apple-touch-icon.
     * @param view The WebView that initiated the callback.
     * @param view The WebView that initiated the callback.
     * @param url The icon url.
     * @param url The icon url.
     * @param precomposed True if the url is for a precomposed touch icon.
     * @hide pending council approval
     * @hide pending council approval
     */
     */
    public void onReceivedTouchIconUrl(WebView view, String url) {}
    public void onReceivedTouchIconUrl(WebView view, String url,
            boolean precomposed) {}


    /**
    /**
     * A callback interface used by the host application to notify
     * A callback interface used by the host application to notify