refactor open tab code
Change-Id: Ibcffa5a55b2b7dcf56174f9dd916a565b31506e9
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 3508005..c217e6e 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -108,8 +108,6 @@
// Tab that constructed by this Tab. This is used when this Tab is
// destroyed, it clears all mParentTab values in the children.
private Vector<Tab> mChildTabs;
- // If true, the tab will be removed when back out of the first page.
- private boolean mCloseOnExit;
// If true, the tab is in the foreground of the current activity.
private boolean mInForeground;
// If true, the tab is in page loading state (after onPageStarted,
@@ -191,7 +189,6 @@
static final String CURRTAB = "currentTab";
static final String CURRURL = "currentUrl";
static final String CURRTITLE = "currentTitle";
- static final String CLOSEONEXIT = "closeonexit";
static final String PARENTTAB = "parentTab";
static final String APPID = "appid";
static final String ORIGINALURL = "originalUrl";
@@ -859,9 +856,9 @@
mWebViewController.attachSubWindow(Tab.this);
transport.setWebView(mSubView);
} else {
- final Tab newTab = mWebViewController.openTabAndShow(
- Tab.this,
- IntentHandler.EMPTY_URL_DATA, false, null);
+ final Tab newTab = mWebViewController.openTab(null,
+ Tab.this.isPrivateBrowsingEnabled(),
+ true, true);
if (newTab != Tab.this) {
Tab.this.addChildTab(newTab);
}
@@ -1290,13 +1287,10 @@
// remove later
// Construct a new tab
- Tab(WebViewController wvcontroller, WebView w, boolean closeOnExit, String appId,
- String url) {
+ Tab(WebViewController wvcontroller, WebView w) {
mWebViewController = wvcontroller;
mActivity = mWebViewController.getActivity();
mSettings = BrowserSettings.getInstance();
- mCloseOnExit = closeOnExit;
- mAppId = appId;
mDataController = DataController.getInstance(mActivity);
mCurrentState = new PageState(mActivity, w != null
? w.isPrivateBrowsingEnabled() : false);
@@ -1666,15 +1660,6 @@
return mParentTab;
}
- /**
- * Return whether this tab should be closed when it is backing out of the
- * first page.
- * @return TRUE if this tab should be closed when exit.
- */
- boolean closeOnExit() {
- return mCloseOnExit;
- }
-
private void setLockIconType(LockIcon icon) {
mCurrentState.mLockIcon = icon;
mWebViewController.onUpdatedLockIcon(this);
@@ -1741,7 +1726,6 @@
mSavedState.putString(CURRURL, mCurrentState.mUrl);
mSavedState.putString(CURRTITLE, mCurrentState.mTitle);
- mSavedState.putBoolean(CLOSEONEXIT, mCloseOnExit);
if (mAppId != null) {
mSavedState.putString(APPID, mAppId);
}
@@ -1766,7 +1750,6 @@
// Restore the internal state even if the WebView fails to restore.
// This will maintain the app id, original url and close-on-exit values.
mSavedState = null;
- mCloseOnExit = b.getBoolean(CLOSEONEXIT);
mAppId = b.getString(APPID);
mScreenshot = b.getParcelable(SCREENSHOT);