Move Tab layout code to UI
Change-Id: Ic2d81345883bba22329b4f805c44a68b14e174e3
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 3647a20..8a3bc27 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -85,7 +85,7 @@
// The Geolocation permissions prompt
private GeolocationPermissionsPrompt mGeolocationPermissionsPrompt;
// Main WebView wrapper
- private LinearLayout mContainer;
+ private View mContainer;
// Main WebView
private WebView mMainView;
// Subwindow container
@@ -128,8 +128,6 @@
// the lock icon type and previous lock icon type for the tab
private int mLockIconType;
private int mPrevLockIconType;
- // Inflation service for making subwindows.
- private final LayoutInflater mInflateService;
// The listener that gets invoked when a download is started from the
// mMainView
private final DownloadListener mDownloadListener;
@@ -1205,11 +1203,6 @@
mInPageLoad = false;
mInForeground = false;
- mInflateService = LayoutInflater.from(mActivity);
-
- // The tab consists of a container view, which contains the main
- // WebView, as well as any other UI elements associated with the tab.
- mContainer = (LinearLayout) mInflateService.inflate(R.layout.tab, null);
mDownloadListener = new DownloadListener() {
public void onDownloadStart(String url, String userAgent,
@@ -1246,16 +1239,14 @@
if (mMainView == w) {
return;
}
+
// If the WebView is changing, the page will be reloaded, so any ongoing
// Geolocation permission requests are void.
if (mGeolocationPermissionsPrompt != null) {
mGeolocationPermissionsPrompt.hide();
}
- // Just remove the old one.
- FrameLayout wrapper =
- (FrameLayout) mContainer.findViewById(R.id.webview_wrapper);
- wrapper.removeView(mMainView);
+ mWebViewController.onSetWebView(this, w);
// set the new one
mMainView = w;
@@ -1451,6 +1442,10 @@
return mMainView;
}
+ void setViewContainer(View container) {
+ mContainer = container;
+ }
+
View getViewContainer() {
return mContainer;
}