Show the title bar when pressing bringing up the menu.

Show an actionable title bar at the top of the screen when the
menu shows.

Change TitleBar* to take a Bitmap for setFavicon, and move the
logic for creating the drawable into TitleBar, so that we can
update directly from the WebView (whose getFavicon method returns
a bitmap).

Remove CUSTOM_BROWSER_BAR, since we are set on using our custom
title bar, and it enabled me to put mGenericFavicon in TitleBar.

Also take screen density into account when sizing the icons for
the title bar.

Change-Id: I3ee6b1d02e8845299f9cd1f648b271543683954a
diff --git a/src/com/android/browser/TitleBarSet.java b/src/com/android/browser/TitleBarSet.java
index c71cfa7..9cfce86 100644
--- a/src/com/android/browser/TitleBarSet.java
+++ b/src/com/android/browser/TitleBarSet.java
@@ -18,6 +18,7 @@
 
 import android.content.Context;
 import android.database.DataSetObserver;
+import android.graphics.Bitmap;
 import android.graphics.drawable.Drawable;
 import android.util.AttributeSet;
 import android.util.Log;
@@ -74,7 +75,7 @@
             return;
         }
         int newSelection = mCount;
-        TitleBar titleBar = new TitleBar(getContext(), view, mBrowserActivity);
+        TitleBar titleBar = new TitleBar(mBrowserActivity, view);
         mTitleBars.add(titleBar);
         mCount++;
         // Need to refresh our list
@@ -118,9 +119,10 @@
         if (webview.getProgress() == 100) {
             titleBar.setProgress(100);
             titleBar.setTitleAndUrl(webview.getTitle(), webview.getUrl());
-            // FIXME: Pass in a bitmap, so we can always update the bitmap
-            // properly
-            //titleBar.setFavicon(webview.getFavicon());
+            // FIXME: BrowserActivity looks at the back forward list.  Is this
+            // better?
+            titleBar.setFavicon(webview.getFavicon());
+            mBrowserActivity.updateLockIconToLatest();
         }
     }
 
@@ -218,15 +220,15 @@
 
     /**
      * Update the Favicon of the currently selected tab.
-     * @param d The new Drawable for the Favicon
+     * @param icon The new bitmap for the favicon
      * @param topWindow The WebView which posted the update.  If it does not
      *                  match the WebView of the currently selected tab, do
      *                  nothing, since that tab is not being displayed.
      */
-    /* package */ void setFavicon(Drawable d, WebView topWindow) {
+    /* package */ void setFavicon(Bitmap icon, WebView topWindow) {
         TitleBar current = selectedTitleBar();
         if (current != null && current.getWebView() == topWindow) {
-            current.setFavicon(d);
+            current.setFavicon(icon);
         }
     }