Overhaul handling tab data updates

 Bug: 2127502, 3191165
 Pushed some state tracking to the tab for URL, title, favicon,
 and lock status. This allowed me to remove many duplicate methods
 of updating that data, preventing the UI from getting out of sync
 with the web view.

Change-Id: I995caa98068ad03ca37710207b5ab57bb9d801ab
diff --git a/src/com/android/browser/XLargeUi.java b/src/com/android/browser/XLargeUi.java
index 11642af..dcba39b 100644
--- a/src/com/android/browser/XLargeUi.java
+++ b/src/com/android/browser/XLargeUi.java
@@ -145,12 +145,6 @@
     // WebView callbacks
 
     @Override
-    public void onPageStarted(Tab tab, String url, Bitmap favicon) {
-        super.onPageStarted(tab, url, favicon);
-        mTabBar.onPageStarted(tab, url, favicon);
-    }
-
-    @Override
     public void bookmarkedStatusHasChanged(Tab tab) {
         if (tab.inForeground()) {
             boolean isBookmark = tab.isBookmarkedSite();
@@ -160,16 +154,8 @@
     }
 
     @Override
-    public void onPageFinished(Tab tab, String url) {
-        mTabBar.onPageFinished(tab);
-        super.onPageFinished(tab, url);
-        if (mUseQuickControls) {
-            mFakeTitleBar.setShowProgressOnly(false);
-        }
-    }
-
-    @Override
-    public void onProgressChanged(Tab tab, int progress) {
+    public void onProgressChanged(Tab tab) {
+        int progress = tab.getLoadProgress();
         mTabBar.onProgress(tab, progress);
         if (tab.inForeground()) {
             mFakeTitleBar.setProgress(progress);
@@ -229,7 +215,6 @@
         } else {
             revertVoiceTitleBar(tab);
         }
-        resetTitleIconAndProgress(tab);
         updateLockIconToLatest(tab);
         tab.getTopWindow().requestFocus();
     }
@@ -331,16 +316,16 @@
     }
 
     @Override
-    public void setUrlTitle(Tab tab, String url, String title) {
-        super.setUrlTitle(tab, url, title);
-        mTabBar.onUrlAndTitle(tab, url, title);
+    public void setUrlTitle(Tab tab) {
+        super.setUrlTitle(tab);
+        mTabBar.onUrlAndTitle(tab, tab.getUrl(), tab.getTitle());
     }
 
     // Set the favicon in the title bar.
     @Override
-    public void setFavicon(Tab tab, Bitmap icon) {
-        super.setFavicon(tab, icon);
-        mTabBar.onFavicon(tab, icon);
+    public void setFavicon(Tab tab) {
+        super.setFavicon(tab);
+        mTabBar.onFavicon(tab, tab.getFavicon());
     }
 
     @Override
@@ -358,7 +343,7 @@
     @Override
     public void revertVoiceTitleBar(Tab tab) {
         mTitleBar.setInVoiceMode(false, null);
-        String url = tab.getCurrentUrl();
+        String url = tab.getUrl();
         mTitleBar.setDisplayTitle(url);
         mFakeTitleBar.setInVoiceMode(false, null);
         mFakeTitleBar.setDisplayTitle(url);