diff options
author | Michael Kolb <kolby@google.com> | 2010-11-19 12:55:12 -0800 |
---|---|---|
committer | Michael Kolb <kolby@google.com> | 2010-11-19 13:58:17 -0800 |
commit | 1bf231334fd4bda8dbde5b9a0345c756a213b3a2 (patch) | |
tree | 412e2abc22e50b45a1d74ada226f84955ed2419e /src/com/android/browser/TabControl.java | |
parent | 63c0266b5d1fca4df859fe4fa3a9555d0783a2b6 (diff) | |
download | packages_apps_browser-1bf231334fd4bda8dbde5b9a0345c756a213b3a2.zip packages_apps_browser-1bf231334fd4bda8dbde5b9a0345c756a213b3a2.tar.gz packages_apps_browser-1bf231334fd4bda8dbde5b9a0345c756a213b3a2.tar.bz2 |
restore all tabs on demand
Bug: 3214151
introduced new flag to determine if all tabs should be restored
controlled by the Ui implementation
Change-Id: I3e296f87a93fae54693bca186bb06ecd6db11d02
Diffstat (limited to 'src/com/android/browser/TabControl.java')
-rw-r--r-- | src/com/android/browser/TabControl.java | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/com/android/browser/TabControl.java b/src/com/android/browser/TabControl.java index aeffbc0..2d90d23 100644 --- a/src/com/android/browser/TabControl.java +++ b/src/com/android/browser/TabControl.java @@ -26,6 +26,7 @@ import android.webkit.WebView; import java.io.File; import java.util.ArrayList; import java.util.HashMap; +import java.util.List; import java.util.Vector; class TabControl { @@ -99,6 +100,13 @@ class TabControl { } /** + * return the list of tabs + */ + List<Tab> getTabs() { + return mTabs; + } + + /** * Return the tab at the specified index. * @return The Tab for the specified index or null if the tab does not * exist. @@ -281,10 +289,14 @@ class TabControl { /** * Restore the state of all the tabs. * @param inState The saved state of all the tabs. + * @param restoreIncognitoTabs Restoring private browsing tabs + * @param restoreAll All webviews get restored, not just the current tab + * (this does not override handling of incognito tabs) * @return True if there were previous tabs that were restored. False if * there was no saved state or restoring the state failed. */ - boolean restoreState(Bundle inState, boolean dontRestoreIncognitoTabs) { + boolean restoreState(Bundle inState, boolean restoreIncognitoTabs, + boolean restoreAll) { final int numTabs = (inState == null) ? -1 : inState.getInt(Tab.NUMTABS, -1); if (numTabs == -1) { @@ -295,7 +307,7 @@ class TabControl { // Determine whether the saved current tab can be restored, and // if not, which tab will take its place. int currentTab = -1; - if (!dontRestoreIncognitoTabs + if (restoreIncognitoTabs || !inState.getBundle(Tab.WEBVIEW + oldCurrentTab).getBoolean(Tab.INCOGNITO)) { currentTab = oldCurrentTab; } else { @@ -317,13 +329,15 @@ class TabControl { for (int i = 0; i < numTabs; i++) { Bundle state = inState.getBundle(Tab.WEBVIEW + i); - if (dontRestoreIncognitoTabs && state != null && state.getBoolean(Tab.INCOGNITO)) { + if (!restoreIncognitoTabs && state != null && state.getBoolean(Tab.INCOGNITO)) { originalTabIndices.put(i, -1); - } else if (i == currentTab) { + } else if (i == currentTab || restoreAll) { Tab t = createNewTab(); // Me must set the current tab before restoring the state // so that all the client classes are set. - setCurrentTab(t); + if (i == currentTab) { + setCurrentTab(t); + } if (!t.restoreState(state)) { Log.w(LOGTAG, "Fail in restoreState, load home page."); t.getWebView().loadUrl(BrowserSettings.getInstance() |