Commit 75832eec authored by Amirhossein Simjour's avatar Amirhossein Simjour Committed by Commit Bot

VR: Stop injecting Views for UI elements when browsing is not enabled

Do not add Views for Clank UI in VR when VrBrowsing is not enabled.

BUG=779126

Change-Id: Iecd228366cd3f56d74ca5944b47b70b78cb7d14c
Reviewed-on: https://chromium-review.googlesource.com/902003Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Amirhossein Simjour <asimjour@chromium.org>
Cr-Commit-Position: refs/heads/master@{#534449}
parent e4b8412d
......@@ -162,19 +162,7 @@ public class VrShellImpl extends GvrLayout implements VrShell, SurfaceHolder.Cal
getUiLayout().setCloseButtonListener(mDelegate.getVrCloseButtonListener());
if (ChromeFeatureList.isEnabled(ChromeFeatureList.VR_BROWSING_NATIVE_ANDROID_UI)) {
mNonVrModalDialogManager = mActivity.getModalDialogManager();
mNonVrModalDialogManager.cancelAllDialogs();
mActivity.setModalDialogManager(new ModalDialogManager(
new VrModalPresenter(this), ModalDialogManager.APP_MODAL));
}
ViewGroup decor = (ViewGroup) mActivity.getWindow().getDecorView();
mUiView = new FrameLayout(decor.getContext());
LayoutParams params = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
decor.addView(mUiView, params);
mVrUiViewContainer = new VrViewContainer(mActivity);
mUiView.addView(mVrUiViewContainer);
if (mVrBrowsingEnabled) injectVrHostedUiView();
mTabRedirectHandler = new TabRedirectHandler(mActivity) {
@Override
......@@ -281,6 +269,22 @@ public class VrShellImpl extends GvrLayout implements VrShell, SurfaceHolder.Cal
mNonVrViews = viewContainer;
}
private void injectVrHostedUiView() {
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.VR_BROWSING_NATIVE_ANDROID_UI)) return;
mNonVrModalDialogManager = mActivity.getModalDialogManager();
mNonVrModalDialogManager.cancelAllDialogs();
mActivity.setModalDialogManager(
new ModalDialogManager(new VrModalPresenter(this), ModalDialogManager.APP_MODAL));
ViewGroup decor = (ViewGroup) mActivity.getWindow().getDecorView();
mUiView = new FrameLayout(decor.getContext());
LayoutParams params = new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
decor.addView(mUiView, params);
mVrUiViewContainer = new VrViewContainer(mActivity);
mUiView.addView(mVrUiViewContainer);
}
private void removeVrRootView() {
ViewGroup parent = (ViewGroup) mNonVrViews.getParent();
assert mNonVrViews.getChildCount() == 1;
......@@ -530,7 +534,7 @@ public class VrShellImpl extends GvrLayout implements VrShell, SurfaceHolder.Cal
@CalledByNative
public void dialogSurfaceCreated(Surface surface) {
mVrUiViewContainer.setSurface(surface);
if (mVrBrowsingEnabled) mVrUiViewContainer.setSurface(surface);
}
@Override
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment