Snapshot title bar

 Bug: 4982126

Change-Id: I67931d39e3a3ce535b38197ebeee1651241d1a60
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 5551eca..858e13e 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -74,7 +74,7 @@
         Gravity.CENTER);
 
     private static final int MSG_HIDE_TITLEBAR = 1;
-    private static final int HIDE_TITLEBAR_DELAY = 1500; // in ms
+    public static final int HIDE_TITLEBAR_DELAY = 1500; // in ms
 
     Activity mActivity;
     UiController mUiController;
@@ -208,6 +208,7 @@
         setFavicon(tab);
         updateLockIconToLatest(tab);
         updateNavigationState(tab);
+        mTitleBar.onTabDataChanged(tab);
     }
 
     @Override
@@ -431,7 +432,9 @@
             mUiController.endActionMode();
         }
         showTitleBar();
-        mNavigationBar.startEditingUrl(clearInput);
+        if (!getActiveTab().isSnapshot()) {
+            mNavigationBar.startEditingUrl(clearInput);
+        }
     }
 
     boolean canShowTitleBar() {
@@ -443,6 +446,7 @@
     }
 
     protected void showTitleBar() {
+        mHandler.removeMessages(MSG_HIDE_TITLEBAR);
         if (canShowTitleBar()) {
             mTitleBar.show();
         }
@@ -830,13 +834,12 @@
      * as if the user is editing the URL bar or if the page is loading
      */
     public void suggestHideTitleBar() {
-        if (!isLoading() && !isEditingUrl() && !mTitleBar.inAutoLogin()) {
+        if (!isLoading() && !isEditingUrl() && !mTitleBar.wantsToBeVisible()) {
             hideTitleBar();
         }
     }
 
     protected void showTitleBarForDuration() {
-        mHandler.removeMessages(MSG_HIDE_TITLEBAR);
         showTitleBar();
         Message msg = Message.obtain(mHandler, MSG_HIDE_TITLEBAR);
         mHandler.sendMessageDelayed(msg, HIDE_TITLEBAR_DELAY);
@@ -854,7 +857,6 @@
                     && !isTitleBarShowing()
                     && web.getVisibleTitleHeight() == 0
                     && event.getY() > (mInitialY + mTitlebarScrollTriggerSlop)) {
-                mHandler.removeMessages(MSG_HIDE_TITLEBAR);
                 showTitleBar();
             } else if (event.getY() < mInitialY) {
                 mInitialY = event.getY();
diff --git a/src/com/android/browser/Controller.java b/src/com/android/browser/Controller.java
index bba49c2..5b00179 100644
--- a/src/com/android/browser/Controller.java
+++ b/src/com/android/browser/Controller.java
@@ -536,7 +536,7 @@
 
     }
 
-
+    @Override
     public Tab getCurrentTab() {
         return mTabControl.getCurrentTab();
     }
@@ -1463,14 +1463,14 @@
                     menu.setGroupEnabled(R.id.MAIN_MENU, true);
                     menu.setGroupEnabled(R.id.MAIN_SHORTCUT_MENU, true);
                 }
-                final WebView w = getCurrentTopWebView();
+                final Tab t = getCurrentTab();
                 boolean canGoBack = false;
                 boolean canGoForward = false;
                 boolean isHome = false;
-                if (w != null) {
-                    canGoBack = w.canGoBack();
-                    canGoForward = w.canGoForward();
-                    isHome = mSettings.getHomePage().equals(w.getUrl());
+                if (t != null) {
+                    canGoBack = t.canGoBack();
+                    canGoForward = t.canGoForward();
+                    isHome = mSettings.getHomePage().equals(t.getUrl());
                 }
                 final MenuItem back = menu.findItem(R.id.back_menu_id);
                 back.setEnabled(canGoBack);
@@ -1563,11 +1563,11 @@
                 break;
 
             case R.id.back_menu_id:
-                getCurrentTopWebView().goBack();
+                getCurrentTab().goBack();
                 break;
 
             case R.id.forward_menu_id:
-                getCurrentTopWebView().goForward();
+                getCurrentTab().goForward();
                 break;
 
             case R.id.close_menu_id:
@@ -2373,12 +2373,11 @@
 
     @Override
     public void onUserCanceledSsl(Tab tab) {
-        WebView web = tab.getWebView();
         // TODO: Figure out the "right" behavior
-        if (web.canGoBack()) {
-            web.goBack();
+        if (tab.canGoBack()) {
+            tab.goBack();
         } else {
-            web.loadUrl(mSettings.getHomePage());
+            tab.loadUrl(mSettings.getHomePage(), null);
         }
     }
 
@@ -2395,9 +2394,8 @@
             mActivity.moveTaskToBack(true);
             return;
         }
-        WebView w = current.getWebView();
-        if (w.canGoBack()) {
-            w.goBack();
+        if (current.canGoBack()) {
+            current.goBack();
         } else {
             // Check to see if we are closing a window that was created by
             // another window. If so, we switch back to that window.
@@ -2506,7 +2504,8 @@
         }
 
         WebView webView = getCurrentTopWebView();
-        if (webView == null) return false;
+        Tab tab = getCurrentTab();
+        if (webView == null || tab == null) return false;
 
         boolean ctrl = event.hasModifiers(KeyEvent.META_CTRL_ON);
         boolean shift = event.hasModifiers(KeyEvent.META_SHIFT_ON);
@@ -2540,13 +2539,13 @@
                 return true;
             case KeyEvent.KEYCODE_DPAD_LEFT:
                 if (ctrl) {
-                    webView.goBack();
+                    tab.goBack();
                     return true;
                 }
                 break;
             case KeyEvent.KEYCODE_DPAD_RIGHT:
                 if (ctrl) {
-                    webView.goForward();
+                    tab.goForward();
                     return true;
                 }
                 break;
diff --git a/src/com/android/browser/NavScreen.java b/src/com/android/browser/NavScreen.java
index 9486a19..1c35b45 100644
--- a/src/com/android/browser/NavScreen.java
+++ b/src/com/android/browser/NavScreen.java
@@ -129,7 +129,7 @@
         if (web != null) {
             if (mForward == v) {
                 mUi.hideNavScreen(true);
-                web.goForward();
+                mTab.goForward();
             } else if (mRefresh == v) {
                 mUi.hideNavScreen(true);
                 web.reload();
diff --git a/src/com/android/browser/NavigationBarPhone.java b/src/com/android/browser/NavigationBarPhone.java
index c0ce428..7dcf7b5 100644
--- a/src/com/android/browser/NavigationBarPhone.java
+++ b/src/com/android/browser/NavigationBarPhone.java
@@ -156,7 +156,7 @@
         } else if (v == mTabSwitcher) {
             mBaseUi.onMenuKey();
         } else if (mMore == v) {
-            showMenu();
+            showMenu(mMore);
         } else {
             super.onClick(v);
         }
@@ -166,9 +166,9 @@
         return mMenuShowing;
     }
 
-    private void showMenu() {
+    void showMenu(View anchor) {
         mMenuShowing = true;
-        PopupMenu popup = new PopupMenu(mContext, mMore);
+        PopupMenu popup = new PopupMenu(mContext, anchor);
         Menu menu = popup.getMenu();
         popup.getMenuInflater().inflate(R.menu.browser, menu);
         menu.setGroupVisible(R.id.NAV_MENU, false);
diff --git a/src/com/android/browser/NavigationBarTablet.java b/src/com/android/browser/NavigationBarTablet.java
index b7b3ed9..45c1e75 100644
--- a/src/com/android/browser/NavigationBarTablet.java
+++ b/src/com/android/browser/NavigationBarTablet.java
@@ -107,12 +107,11 @@
     }
 
     void updateNavigationState(Tab tab) {
-        WebView web = tab.getWebView();
-        if (web != null) {
-            mBackButton.setImageResource(web.canGoBack()
+        if (tab != null) {
+            mBackButton.setImageResource(tab.canGoBack()
                     ? R.drawable.ic_back_holo_dark
                     : R.drawable.ic_back_disabled_holo_dark);
-            mForwardButton.setImageResource(web.canGoForward()
+            mForwardButton.setImageResource(tab.canGoForward()
                     ? R.drawable.ic_forward_holo_dark
                     : R.drawable.ic_forward_disabled_holo_dark);
         }
@@ -127,9 +126,9 @@
     @Override
     public void onClick(View v) {
         if (mBackButton == v) {
-            mUiController.getCurrentTopWebView().goBack();
+            mUiController.getCurrentTab().goBack();
         } else if (mForwardButton == v) {
-            mUiController.getCurrentTopWebView().goForward();
+            mUiController.getCurrentTab().goForward();
         } else if (mStar == v) {
             mUiController.bookmarkCurrentPage(true);
         } else if (mAllButton == v) {
diff --git a/src/com/android/browser/PieControlPhone.java b/src/com/android/browser/PieControlPhone.java
index 2b8d5d9..c4b28fa 100644
--- a/src/com/android/browser/PieControlPhone.java
+++ b/src/com/android/browser/PieControlPhone.java
@@ -82,9 +82,8 @@
     @Override
     public void onClick(View v) {
         Tab tab = mUiController.getTabControl().getCurrentTab();
-        WebView web = tab.getWebView();
         if (mBack.getView() == v) {
-            web.goBack();
+            tab.goBack();
         } else if (mUrl.getView() == v) {
             mUi.editUrl(false);
         } else if (mShowTabs.getView() == v) {
diff --git a/src/com/android/browser/PieControlXLarge.java b/src/com/android/browser/PieControlXLarge.java
index 2c29fa1..a036e0d 100644
--- a/src/com/android/browser/PieControlXLarge.java
+++ b/src/com/android/browser/PieControlXLarge.java
@@ -129,9 +129,9 @@
         Tab tab = mUiController.getTabControl().getCurrentTab();
         WebView web = tab.getWebView();
         if (mBack.getView() == v) {
-            web.goBack();
+            tab.goBack();
         } else if (mForward.getView() == v) {
-            web.goForward();
+            tab.goForward();
         } else if (mRefresh.getView() == v) {
             if (tab.inPageLoad()) {
                 web.stopLoading();
diff --git a/src/com/android/browser/SnapshotBar.java b/src/com/android/browser/SnapshotBar.java
new file mode 100644
index 0000000..b2959a3
--- /dev/null
+++ b/src/com/android/browser/SnapshotBar.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.browser;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.os.Handler;
+import android.os.Message;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewConfiguration;
+import android.view.ViewPropertyAnimator;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+public class SnapshotBar extends LinearLayout implements OnClickListener {
+
+    private static final int MSG_SHOW_TITLE = 1;
+    private static final long DURATION_SHOW_DATE = BaseUi.HIDE_TITLEBAR_DELAY;
+
+    private ImageView mFavicon;
+    private View mGoLive;
+    private TextView mDate;
+    private TextView mTitle;
+    private View mBookmarks;
+    private TitleBar mTitleBar;
+    private View mTabSwitcher;
+    private View mOverflowMenu;
+    private View mToggleContainer;
+    private boolean mIsAnimating;
+    private ViewPropertyAnimator mTitleAnimator, mDateAnimator;
+    private float mAnimRadius = 20f;
+    private View mDateContainer;
+
+    public SnapshotBar(Context context) {
+        super(context);
+    }
+
+    public SnapshotBar(Context context, AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public SnapshotBar(Context context, AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    public void setTitleBar(TitleBar titleBar) {
+        mTitleBar = titleBar;
+        setFavicon(null);
+    }
+
+    private Handler mHandler = new Handler() {
+        @Override
+        public void handleMessage(Message msg) {
+            if (msg.what == MSG_SHOW_TITLE) {
+                mIsAnimating = false;
+                showTitle();
+                mTitleBar.getUi().showTitleBarForDuration();
+            }
+        }
+    };
+
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        mGoLive = mFavicon = (ImageView) findViewById(R.id.favicon);
+        if (mGoLive == null) {
+            mGoLive = findViewById(R.id.date_icon);
+        }
+        mDate = (TextView) findViewById(R.id.date);
+        mTitle = (TextView) findViewById(R.id.title);
+        mBookmarks = findViewById(R.id.all_btn);
+        mTabSwitcher = findViewById(R.id.tab_switcher);
+        mOverflowMenu = findViewById(R.id.more);
+        mToggleContainer = findViewById(R.id.toggle_container);
+        mDateContainer = findViewById(R.id.date_container);
+
+        if (mBookmarks != null) {
+            mBookmarks.setOnClickListener(this);
+        }
+        if (mTabSwitcher != null) {
+            mTabSwitcher.setOnClickListener(this);
+        }
+        if (mOverflowMenu != null) {
+            mOverflowMenu.setOnClickListener(this);
+            boolean showMenu = !ViewConfiguration.get(getContext())
+                    .hasPermanentMenuKey();
+            mOverflowMenu.setVisibility(showMenu ? VISIBLE : GONE);
+        }
+        if (mToggleContainer != null) {
+            mToggleContainer.setOnClickListener(this);
+            resetAnimation();
+        }
+        mGoLive.setOnClickListener(this);
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        super.onLayout(changed, l, t, r, b);
+        if (mToggleContainer != null) {
+            mAnimRadius = mToggleContainer.getHeight() / 2f;
+        }
+    }
+
+    void resetAnimation() {
+        if (mToggleContainer == null) {
+            // No animation needed/used
+            return;
+        }
+        if (mTitleAnimator != null) {
+            mTitleAnimator.cancel();
+            mTitleAnimator = null;
+        }
+        if (mDateAnimator != null) {
+            mDateAnimator.cancel();
+            mDateAnimator = null;
+        }
+        mIsAnimating = false;
+        mHandler.removeMessages(MSG_SHOW_TITLE);
+        mTitle.setAlpha(1f);
+        mTitle.setTranslationY(0f);
+        mTitle.setRotationX(0f);
+        mDateContainer.setAlpha(0f);
+        mDateContainer.setTranslationY(-mAnimRadius);
+        mDateContainer.setRotationX(90f);
+    }
+
+    private void showDate() {
+        mTitleAnimator = mTitle.animate()
+                .alpha(0f)
+                .translationY(mAnimRadius)
+                .rotationX(-90f);
+        mDateAnimator = mDateContainer.animate()
+                .alpha(1f)
+                .translationY(0f)
+                .rotationX(0f);
+    }
+
+    private void showTitle() {
+        mTitleAnimator = mTitle.animate()
+                .alpha(1f)
+                .translationY(0f)
+                .rotationX(0f);
+        mDateAnimator = mDateContainer.animate()
+                .alpha(0f)
+                .translationY(-mAnimRadius)
+                .rotationX(90f);
+    }
+
+    @Override
+    public void onClick(View v) {
+        if (mBookmarks == v) {
+            mTitleBar.getUiController().bookmarksOrHistoryPicker(false);
+        } else if (mGoLive == v) {
+            goLive();
+        } else if (mTabSwitcher == v) {
+            mTitleBar.getUi().onMenuKey();
+        } else if (mOverflowMenu == v) {
+            NavigationBarBase navBar = mTitleBar.getNavigationBar();
+            if (navBar instanceof NavigationBarPhone) {
+                ((NavigationBarPhone)navBar).showMenu(mOverflowMenu);
+            }
+        } else if (mToggleContainer == v && !mIsAnimating) {
+            mIsAnimating = true;
+            showDate();
+            mTitleBar.getUi().showTitleBar();
+            Message m = mHandler.obtainMessage(MSG_SHOW_TITLE);
+            mHandler.sendMessageDelayed(m, DURATION_SHOW_DATE);
+        }
+    }
+
+    private void goLive() {
+        Tab t = mTitleBar.getUi().getActiveTab();
+        t.loadUrl(t.getUrl(), null);
+    }
+
+    public void onTabDataChanged(Tab tab) {
+        if (!tab.isSnapshot()) return;
+        SnapshotTab snapshot = (SnapshotTab) tab;
+        DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.LONG);
+        mDate.setText(dateFormat.format(new Date(snapshot.getDateCreated())));
+        String title = snapshot.getTitle();
+        if (TextUtils.isEmpty(title)) {
+            title = UrlUtils.stripUrl(snapshot.getUrl());
+        }
+        mTitle.setText(title);
+        setFavicon(tab.getFavicon());
+        resetAnimation();
+    }
+
+    public void setFavicon(Bitmap icon) {
+        if (mFavicon == null) return;
+        mFavicon.setImageDrawable(mTitleBar.getUi().getFaviconDrawable(icon));
+    }
+
+    public boolean isAnimating() {
+        return mIsAnimating;
+    }
+
+}
diff --git a/src/com/android/browser/SnapshotTab.java b/src/com/android/browser/SnapshotTab.java
index f0abf58..e57502f 100644
--- a/src/com/android/browser/SnapshotTab.java
+++ b/src/com/android/browser/SnapshotTab.java
@@ -28,6 +28,7 @@
 import com.android.browser.provider.SnapshotProvider.Snapshots;
 
 import java.io.ByteArrayInputStream;
+import java.util.Map;
 import java.util.zip.GZIPInputStream;
 
 
@@ -38,19 +39,16 @@
     private long mSnapshotId;
     private LoadData mLoadTask;
     private WebViewFactory mWebViewFactory;
-    // TODO: Support non-persistent webview's on phone
-    private boolean mPersistentWebview;
     private int mBackgroundColor;
+    private long mDateCreated;
+    private boolean mIsLive;
 
     public SnapshotTab(WebViewController wvcontroller, long snapshotId) {
         super(wvcontroller, null);
         mSnapshotId = snapshotId;
         mWebViewFactory = mWebViewController.getWebViewFactory();
-        mPersistentWebview = !BrowserActivity.isTablet(wvcontroller.getActivity());
-        if (mPersistentWebview) {
-            WebView web = mWebViewFactory.createWebView(false);
-            setWebView(web);
-        }
+        WebView web = mWebViewFactory.createWebView(false);
+        setWebView(web);
         loadData();
     }
 
@@ -71,9 +69,6 @@
     void putInBackground() {
         if (getWebView() == null) return;
         super.putInBackground();
-        if (!mPersistentWebview) {
-            super.destroy();
-        }
     }
 
     void loadData() {
@@ -90,7 +85,7 @@
 
     @Override
     public boolean isSnapshot() {
-        return true;
+        return !mIsLive;
     }
 
     public long getSnapshotId() {
@@ -107,6 +102,40 @@
         return false;
     }
 
+    public long getDateCreated() {
+        return mDateCreated;
+    }
+
+    @Override
+    public void loadUrl(String url, Map<String, String> headers) {
+        if (!mIsLive) {
+            mIsLive = true;
+            getWebView().clearViewState();
+        }
+        super.loadUrl(url, headers);
+    }
+
+    @Override
+    public boolean canGoBack() {
+        return super.canGoBack() || mIsLive;
+    }
+
+    @Override
+    public boolean canGoForward() {
+        return mIsLive && super.canGoForward();
+    }
+
+    @Override
+    public void goBack() {
+        if (super.canGoBack()) {
+            super.goBack();
+        } else {
+            mIsLive = false;
+            getWebView().stopLoading();
+            loadData();
+        }
+    }
+
     static class LoadData extends AsyncTask<Void, Void, Cursor> {
 
         static final String[] PROJECTION = new String[] {
@@ -116,6 +145,7 @@
             Snapshots.FAVICON, // 3
             Snapshots.VIEWSTATE, // 4
             Snapshots.BACKGROUND, // 5
+            Snapshots.DATE_CREATED, // 6
         };
 
         private SnapshotTab mTab;
@@ -156,6 +186,7 @@
                         }
                     }
                     mTab.mBackgroundColor = result.getInt(5);
+                    mTab.mDateCreated = result.getLong(6);
                     mTab.mWebViewController.onPageFinished(mTab);
                 }
             } finally {
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 4558717..beac2ff 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -1457,6 +1457,8 @@
     void destroy() {
         if (mMainView != null) {
             dismissSubWindow();
+            // Make sure the embedded title bar isn't still attached
+            mMainView.setEmbeddedTitleBar(null);
             // save the WebView to call destroy() after detach it from the tab
             WebView webView = mMainView;
             setWebView(null);
@@ -1971,4 +1973,24 @@
         }
     }
 
+    public boolean canGoBack() {
+        return mMainView != null ? mMainView.canGoBack() : false;
+    }
+
+    public boolean canGoForward() {
+        return mMainView != null ? mMainView.canGoForward() : false;
+    }
+
+    public void goBack() {
+        if (mMainView != null) {
+            mMainView.goBack();
+        }
+    }
+
+    public void goForward() {
+        if (mMainView != null) {
+            mMainView.goForward();
+        }
+    }
+
 }
diff --git a/src/com/android/browser/TitleBar.java b/src/com/android/browser/TitleBar.java
index 4e93124..9848a39 100644
--- a/src/com/android/browser/TitleBar.java
+++ b/src/com/android/browser/TitleBar.java
@@ -51,6 +51,7 @@
     private AutologinBar mAutoLogin;
     private NavigationBarBase mNavBar;
     private boolean mUseQuickControls;
+    private SnapshotBar mSnapshotBar;
 
     //state
     private boolean mShowing;
@@ -75,6 +76,8 @@
         mAutoLogin.setTitleBar(this);
         mNavBar = (NavigationBarBase) findViewById(R.id.taburlbar);
         mNavBar.setTitleBar(this);
+        mSnapshotBar = (SnapshotBar) findViewById(R.id.snapshotbar);
+        mSnapshotBar.setTitleBar(this);
     }
 
     public BaseUi getUi() {
@@ -91,7 +94,7 @@
     }
 
     void setShowProgressOnly(boolean progress) {
-        if (progress && !inAutoLogin()) {
+        if (progress && !wantsToBeVisible()) {
             mNavBar.setVisibility(View.GONE);
         } else {
             mNavBar.setVisibility(View.VISIBLE);
@@ -208,7 +211,7 @@
             mInLoad = false;
             mNavBar.onProgressStopped();
             // check if needs to be hidden
-            if (!isEditingUrl() && !inAutoLogin()) {
+            if (!isEditingUrl() && !wantsToBeVisible()) {
                 hide();
                 if (mUseQuickControls) {
                     setShowProgressOnly(false);
@@ -286,7 +289,13 @@
         }
     }
 
-    public boolean inAutoLogin() {
+    public boolean wantsToBeVisible() {
+        return inAutoLogin()
+            || (mSnapshotBar.getVisibility() == View.VISIBLE
+                    && mSnapshotBar.isAnimating());
+    }
+
+    private boolean inAutoLogin() {
         return mAutoLogin.getVisibility() == View.VISIBLE;
     }
 
@@ -338,4 +347,15 @@
         return super.focusSearch(focused, dir);
     }
 
+    public void onTabDataChanged(Tab tab) {
+        mSnapshotBar.onTabDataChanged(tab);
+        if (tab.isSnapshot()) {
+            mSnapshotBar.setVisibility(VISIBLE);
+            mNavBar.setVisibility(GONE);
+        } else {
+            mSnapshotBar.setVisibility(GONE);
+            mNavBar.setVisibility(VISIBLE);
+        }
+    }
+
 }
diff --git a/src/com/android/browser/UiController.java b/src/com/android/browser/UiController.java
index 58fdb93..421dc14 100644
--- a/src/com/android/browser/UiController.java
+++ b/src/com/android/browser/UiController.java
@@ -36,6 +36,8 @@
 
     WebView getCurrentTopWebView();
 
+    Tab getCurrentTab();
+
     TabControl getTabControl();
 
     List<Tab> getTabs();