Add a callback for the url of an apple-touch-icon.

Hide the apis until this is a well-tested feature. The url is reported rather
than the actual icon since it may never be used. The apple-touch-icon is meant
for shortcuts on the home screen.
diff --git a/core/java/android/provider/Browser.java b/core/java/android/provider/Browser.java
index b95e4e1..92bc814 100644
--- a/core/java/android/provider/Browser.java
+++ b/core/java/android/provider/Browser.java
@@ -107,7 +107,8 @@
     public static final String[] HISTORY_PROJECTION = new String[] {
         BookmarkColumns._ID, BookmarkColumns.URL, BookmarkColumns.VISITS,
         BookmarkColumns.DATE, BookmarkColumns.BOOKMARK, BookmarkColumns.TITLE,
-        BookmarkColumns.FAVICON, BookmarkColumns.THUMBNAIL };
+        BookmarkColumns.FAVICON, BookmarkColumns.THUMBNAIL,
+        BookmarkColumns.TOUCH_ICON };
 
     /* these indices dependent on HISTORY_PROJECTION */
     public static final int HISTORY_PROJECTION_ID_INDEX = 0;
@@ -121,6 +122,10 @@
      * @hide
      */
     public static final int HISTORY_PROJECTION_THUMBNAIL_INDEX = 7;
+    /**
+     * @hide
+     */
+    public static final int HISTORY_PROJECTION_TOUCH_ICON_INDEX = 8;
 
     /* columns needed to determine whether to truncate history */
     public static final String[] TRUNCATE_HISTORY_PROJECTION = new String[] {
@@ -521,6 +526,10 @@
          * @hide
          */
         public static final String THUMBNAIL = "thumbnail";
+        /**
+         * @hide
+         */
+        public static final String TOUCH_ICON = "touch_icon";
     }
 
     public static class SearchColumns implements BaseColumns {
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index e6ccd70..06581c1 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -615,6 +615,11 @@
         mCallbackProxy.onReceivedIcon(icon);
     }
 
+    // Called by JNI when an apple-touch-icon attribute was found.
+    private void didReceiveTouchIconUrl(String url) {
+        mCallbackProxy.onReceivedTouchIconUrl(url);
+    }
+
     /**
      * Request a new window from the client.
      * @return The BrowserFrame object stored in the new WebView.
diff --git a/core/java/android/webkit/CallbackProxy.java b/core/java/android/webkit/CallbackProxy.java
index ed77ce8..b2277cb 100644
--- a/core/java/android/webkit/CallbackProxy.java
+++ b/core/java/android/webkit/CallbackProxy.java
@@ -104,6 +104,7 @@
     private static final int ADD_MESSAGE_TO_CONSOLE              = 129;
     private static final int GEOLOCATION_PERMISSIONS_SHOW_PROMPT = 130;
     private static final int GEOLOCATION_PERMISSIONS_HIDE_PROMPT = 131;
+    private static final int RECEIVED_TOUCH_ICON_URL             = 132;
 
     // Message triggered by the client to resume execution
     private static final int NOTIFY                              = 200;
@@ -244,6 +245,13 @@
                 }
                 break;
 
+            case RECEIVED_TOUCH_ICON_URL:
+                if (mWebChromeClient != null) {
+                    mWebChromeClient.onReceivedTouchIconUrl(mWebView,
+                            (String) msg.obj);
+                }
+                break;
+
             case RECEIVED_TITLE:
                 if (mWebChromeClient != null) {
                     mWebChromeClient.onReceivedTitle(mWebView,
@@ -1054,6 +1062,21 @@
         sendMessage(obtainMessage(RECEIVED_ICON, icon));
     }
 
+    /* package */ void onReceivedTouchIconUrl(String url) {
+        // We should have a current item but we do not want to crash so check
+        // for null.
+        WebHistoryItem i = mBackForwardList.getCurrentItem();
+        if (i != null) {
+            i.setTouchIconUrl(url);
+        }
+        // Do an unsynchronized quick check to avoid posting if no callback has
+        // been set.
+        if (mWebChromeClient == null) {
+            return;
+        }
+        sendMessage(obtainMessage(RECEIVED_TOUCH_ICON_URL, url));
+    }
+
     public void onReceivedTitle(String title) {
         // Do an unsynchronized quick check to avoid posting if no callback has
         // been set.
diff --git a/core/java/android/webkit/WebChromeClient.java b/core/java/android/webkit/WebChromeClient.java
index d52406d..c10bc97 100644
--- a/core/java/android/webkit/WebChromeClient.java
+++ b/core/java/android/webkit/WebChromeClient.java
@@ -45,6 +45,14 @@
     public void onReceivedIcon(WebView view, Bitmap icon) {}
 
     /**
+     * Notify the host application of the url for an apple-touch-icon.
+     * @param view The WebView that initiated the callback.
+     * @param url The icon url.
+     * @hide pending council approval
+     */
+    public void onReceivedTouchIconUrl(WebView view, String url) {}
+
+    /**
      * A callback interface used by the host application to notify
      * the current page that its custom view has been dismissed.
      *
diff --git a/core/java/android/webkit/WebHistoryItem.java b/core/java/android/webkit/WebHistoryItem.java
index fd26b98..abd8237 100644
--- a/core/java/android/webkit/WebHistoryItem.java
+++ b/core/java/android/webkit/WebHistoryItem.java
@@ -39,6 +39,8 @@
     private Bitmap mFavicon;
     // The pre-flattened data used for saving the state.
     private byte[] mFlattenedData;
+    // The apple-touch-icon url for use when adding the site to the home screen
+    private String mTouchIconUrl;
 
     /**
      * Basic constructor that assigns a unique id to the item. Called by JNI
@@ -127,6 +129,14 @@
     }
 
     /**
+     * Return the touch icon url.
+     * @hide
+     */
+    public String getTouchIconUrl() {
+        return mTouchIconUrl;
+    }
+
+    /**
      * Set the favicon.
      * @param icon A Bitmap containing the favicon for this history item.
      * Note: The VM ensures 32-bit atomic read/write operations so we don't have
@@ -137,6 +147,14 @@
     }
 
     /**
+     * Set the touch icon url.
+     * @hide
+     */
+    /*package*/ void setTouchIconUrl(String url) {
+        mTouchIconUrl = url;
+    }
+
+    /**
      * Get the pre-flattened data.
      * Note: The VM ensures 32-bit atomic read/write operations so we don't have
      * to synchronize this method.
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 3b81eed..444ef54 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2003,6 +2003,15 @@
     }
 
     /**
+     * Get the touch icon url for the apple-touch-icon <link> element.
+     * @hide
+     */
+    public String getTouchIconUrl() {
+        WebHistoryItem h = mCallbackProxy.getBackForwardList().getCurrentItem();
+        return h != null ? h.getTouchIconUrl() : null;
+    }
+
+    /**
      * Get the progress for the current page.
      * @return The progress for the current page between 0 and 100.
      */