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
diff --git a/src/com/android/browser/TabBar.java b/src/com/android/browser/TabBar.java
index 169f934..69e0bd2 100644
--- a/src/com/android/browser/TabBar.java
+++ b/src/com/android/browser/TabBar.java
@@ -40,6 +40,7 @@
import android.widget.TextView;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
@@ -96,20 +97,23 @@
// TODO: Change enabled states based on whether you can go
// back/forward. Probably should be done inside onPageStarted.
- // build tabs
- int tabcount = mTabControl.getTabCount();
- for (int i = 0; i < tabcount; i++) {
- Tab tab = mTabControl.getTab(i);
- TabViewData data = buildTab(tab);
- TabView tv = buildView(data);
- }
- mTabs.setSelectedTab(mTabControl.getCurrentIndex());
+ updateTabs(mUiController.getTabs());
mUserRequestedUrlbar = false;
mTitleVisible = true;
mButtonWidth = -1;
}
+ void updateTabs(List<Tab> tabs) {
+ mTabs.clearTabs();
+ mTabMap.clear();
+ for (Tab tab : tabs) {
+ TabViewData data = buildTab(tab);
+ TabView tv = buildView(data);
+ }
+ mTabs.setSelectedTab(mTabControl.getCurrentIndex());
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (mButtonWidth == -1) {
@@ -270,7 +274,7 @@
}
if (mTabData.mTab != null) {
mIncognito.setVisibility(
- mTabData.mTab.getWebView().isPrivateBrowsingEnabled() ?
+ mTabData.mTab.isPrivateBrowsingEnabled() ?
View.VISIBLE : View.GONE);
}
}