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

This commit is contained in:
Patrick Scott
2009-09-18 16:29:00 -04:00
parent 408cf85207
commit d58ccff769
3 changed files with 12 additions and 7 deletions

View File

@@ -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);
} }
/** /**

View File

@@ -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) {
i.setTouchIconUrl(url); if (precomposed || i.getTouchIconUrl() != null) {
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) {

View File

@@ -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