Don't embed titlebar in WebView

    Bug: 5032345

The titlebar gets attached to an overlay and tracks the scrolling
of the WebView at the top of the page.

Change-Id: I60b2163bb7a3642813823995278722455f566f36
diff --git a/src/com/android/browser/PhoneUi.java b/src/com/android/browser/PhoneUi.java
index 5afb9c4..d02a3d2 100644
--- a/src/com/android/browser/PhoneUi.java
+++ b/src/com/android/browser/PhoneUi.java
@@ -124,7 +124,6 @@
                 if (!mOptionsMenuOpen || mExtendedMenuOpen) {
                     if (mUseQuickControls && !mTitleBar.isEditingUrl()) {
                         mTitleBar.setShowProgressOnly(true);
-                        setTitleGravity(Gravity.TOP);
                     }
                     showTitleBar();
                 }
@@ -167,11 +166,9 @@
         // Request focus on the top window.
         if (mUseQuickControls) {
             mPieControl.forceToTop(mContentView);
+            view.setTitleBar(null);
         } else {
-            // check if title bar is already attached by animation
-            if (mTitleBar.getParent() == null) {
-                WebViewClassic.fromWebView(view).setEmbeddedTitleBar(mTitleBar);
-            }
+            view.setTitleBar(mTitleBar);
         }
         if (tab.isInVoiceSearchMode()) {
             showVoiceTitleBar(tab.getVoiceDisplayTitle(), tab.getVoiceSearchResults());
@@ -268,41 +265,16 @@
     }
 
     @Override
-    protected void setTitleGravity(int gravity) {
-        if (mUseQuickControls) {
-            FrameLayout.LayoutParams lp =
-                    (FrameLayout.LayoutParams) mTitleBar.getLayoutParams();
-            lp.gravity = gravity;
-            mTitleBar.setLayoutParams(lp);
-        } else {
-            super.setTitleGravity(gravity);
-        }
-    }
-
-    @Override
     public void setUseQuickControls(boolean useQuickControls) {
         mUseQuickControls = useQuickControls;
         mTitleBar.setUseQuickControls(mUseQuickControls);
         if (useQuickControls) {
             mPieControl = new PieControlPhone(mActivity, mUiController, this);
             mPieControl.attachToContainer(mContentView);
-            WebView web = getWebView();
-            if (web != null) {
-                WebViewClassic.fromWebView(web).setEmbeddedTitleBar(null);
-            }
         } else {
             if (mPieControl != null) {
                 mPieControl.removeFromContainer(mContentView);
             }
-            WebView web = getWebView();
-            if (web != null) {
-                // make sure we can re-parent titlebar
-                if ((mTitleBar != null) && (mTitleBar.getParent() != null)) {
-                    ((ViewGroup) mTitleBar.getParent()).removeView(mTitleBar);
-                }
-                WebViewClassic.fromWebView(web).setEmbeddedTitleBar(mTitleBar);
-            }
-            setTitleGravity(Gravity.NO_GRAVITY);
         }
         updateUrlBarAutoShowManagerTarget();
     }