NavigationBar code cleanup

- Unified code for phone and tablet UI
- Chagned Favicon to use Tiles
- Updates to Tile class

Change-Id: Iecb699a3e5eb848db149705a9142f8f199f02c04
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index cd1388f..3682d69 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -49,8 +49,6 @@
 import android.widget.Toast;
 import android.content.res.TypedArray;
 
-import com.android.browser.Tab.SecurityState;
-
 import org.codeaurora.swe.BrowserCommandLine;
 import org.codeaurora.swe.WebView;
 
@@ -83,8 +81,6 @@
     protected Tab mActiveTab;
     private InputMethodManager mInputManager;
 
-    private Drawable mLockIconSecure;
-    private Drawable mLockIconMixed;
     private Drawable mGenericFavicon;
 
     protected FrameLayout mContentView;
@@ -160,20 +156,6 @@
         }
     }
 
-    private Drawable getLockIconSecure() {
-        if (mLockIconSecure == null) {
-            mLockIconSecure = mActivity.getResources().getDrawable(R.drawable.ic_deco_secure);
-        }
-        return mLockIconSecure;
-    }
-
-    private Drawable getLockIconMixed() {
-        if (mLockIconMixed == null) {
-            mLockIconMixed = mActivity.getResources().getDrawable(R.drawable.ic_deco_secure_partial);
-        }
-        return mLockIconMixed;
-    }
-
     protected Drawable getGenericFavicon() {
         if (mGenericFavicon == null) {
             mGenericFavicon = mActivity.getResources().getDrawable(R.drawable.ic_deco_favicon_normal);
@@ -247,7 +229,7 @@
     public void onTabDataChanged(Tab tab) {
         setUrlTitle(tab);
         setFavicon(tab);
-        updateLockIconToLatest(tab);
+        updateTabSecurityState(tab);
         updateNavigationState(tab);
         mTitleBar.onTabDataChanged(tab);
         mNavigationBar.onTabDataChanged(tab);
@@ -326,6 +308,9 @@
         mBlockFocusAnimations = false;
 
         scheduleRemoveTab(tabToRemove, tabToWaitFor);
+
+        updateTabSecurityState(tab);
+        mTitleBar.setSkipTitleBarAnimations(false);
     }
 
     Tab mTabToRemove = null;
@@ -719,28 +704,12 @@
     /**
      * Update the lock icon to correspond to our latest state.
      */
-    protected void updateLockIconToLatest(Tab t) {
+    private void updateTabSecurityState(Tab t) {
         if (t != null && t.inForeground()) {
-            updateLockIconImage(t.getSecurityState());
+            mNavigationBar.setSecurityState(t.getSecurityState());
         }
     }
 
-    /**
-     * Updates the lock-icon image in the title-bar.
-     */
-    private void updateLockIconImage(SecurityState securityState) {
-        Drawable d = null;
-        if (securityState == SecurityState.SECURITY_STATE_SECURE) {
-            d = getLockIconSecure();
-        } else if (securityState == SecurityState.SECURITY_STATE_MIXED
-                || securityState == SecurityState.SECURITY_STATE_BAD_CERTIFICATE) {
-            // TODO: It would be good to have different icons for insecure vs mixed content.
-            // See http://b/5403800
-            d = getLockIconMixed();
-        }
-        mNavigationBar.setLock(d, securityState);
-    }
-
     protected void setUrlTitle(Tab tab) {
         String url = tab.getUrl();
         String title = tab.getTitle();
@@ -755,8 +724,7 @@
     // Set the favicon in the title bar.
     protected void setFavicon(Tab tab) {
         if (tab.inForeground()) {
-            Bitmap icon = tab.getFavicon();
-            mNavigationBar.setFavicon(icon);
+            mNavigationBar.setFavicon(tab.getWebView().getFavicon());
         }
     }
 
@@ -1060,4 +1028,9 @@
             mTitleBar.setTranslationY(0);
         }
     }
+
+    @Override
+    public boolean shouldCaptureThumbnails() {
+        return true;
+    }
 }