Move Tab layout code to UI
Change-Id: Ic2d81345883bba22329b4f805c44a68b14e174e3
diff --git a/src/com/android/browser/BaseUi.java b/src/com/android/browser/BaseUi.java
index 5f8944f..2b3a9e5 100644
--- a/src/com/android/browser/BaseUi.java
+++ b/src/com/android/browser/BaseUi.java
@@ -427,6 +427,24 @@
mainView.setEmbeddedTitleBar(null);
}
+ @Override
+ public void onSetWebView(Tab tab, WebView webView) {
+ View container = tab.getViewContainer();
+ if (container == null) {
+ // The tab consists of a container view, which contains the main
+ // WebView, as well as any other UI elements associated with the tab.
+ container = mActivity.getLayoutInflater().inflate(R.layout.tab,
+ null);
+ tab.setViewContainer(container);
+ }
+ if (tab.getWebView() != webView) {
+ // Just remove the old one.
+ FrameLayout wrapper =
+ (FrameLayout) container.findViewById(R.id.webview_wrapper);
+ wrapper.removeView(tab.getWebView());
+ }
+ }
+
/**
* create a sub window container and webview for the tab
* Note: this methods operates through side-effects for now