use thumbnails in tab switcher

Change-Id: I0c7bda38c4c12448822f575f6fe0670f87b3eb7b
diff --git a/src/com/android/browser/ActiveTabsPage.java b/src/com/android/browser/ActiveTabsPage.java
index 5e27eab..52d943f 100644
--- a/src/com/android/browser/ActiveTabsPage.java
+++ b/src/com/android/browser/ActiveTabsPage.java
@@ -18,6 +18,7 @@
 
 import android.content.Context;
 import android.graphics.Bitmap;
+import android.text.TextUtils;
 import android.util.AttributeSet;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -141,23 +142,30 @@
                 view = mInflater.inflate(R.layout.tab_view, parent, false);
             }
             ImageView favicon = (ImageView) view.findViewById(R.id.favicon);
-            TextView title = (TextView) view.findViewById(R.id.title);
-            TextView url = (TextView) view.findViewById(R.id.url);
+            ImageView thumbnail = (ImageView) view.findViewById(R.id.thumb);
+            TextView title = (TextView) view.findViewById(R.id.label);
             Tab tab = getItem(position);
 
-            title.setText(tab.getTitle());
-            url.setText(tab.getUrl());
+            String label = tab.getTitle();
+            if (TextUtils.isEmpty(label)) {
+                label = tab.getUrl();
+            }
+            title.setText(label);
+            Bitmap thumbnailBitmap = tab.getScreenshot();
+            if (thumbnailBitmap == null) {
+                thumbnail.setImageResource(R.drawable.browser_thumbnail);
+            } else {
+                thumbnail.setImageBitmap(thumbnailBitmap);
+            }
             Bitmap faviconBitmap = tab.getFavicon();
             if (tab.isPrivateBrowsingEnabled()) {
                 favicon.setImageResource(R.drawable.ic_incognito_holo_dark);
-                favicon.setBackgroundDrawable(null);
             } else {
                 if (faviconBitmap == null) {
                     favicon.setImageResource(R.drawable.app_web_browser_sm);
                 } else {
                     favicon.setImageBitmap(faviconBitmap);
                 }
-                favicon.setBackgroundResource(R.drawable.bookmark_list_favicon_bg);
             }
             View close = view.findViewById(R.id.close);
             close.setTag(position);