Commit 8c10eb0a authored by Amirhossein Simjour's avatar Amirhossein Simjour Committed by Commit Bot

VR- Disable hosted dialogs in WebVr

Ideally we should be able to show the dialogs in a meta world when
in WebVR. For now, this patch makes sure that no dialog is opened
in WebVR. Moreover, the dialog will be dismissed.

BUG=none

Change-Id: I32e8d7aed84927f1057a4a13e42622d9eceeb301
Reviewed-on: https://chromium-review.googlesource.com/932442
Commit-Queue: Amirhossein Simjour <asimjour@chromium.org>
Reviewed-by: default avatarYaron Friedman <yfriedman@chromium.org>
Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538844}
parent 5908c5d2
...@@ -1258,7 +1258,7 @@ public class VrShellDelegate ...@@ -1258,7 +1258,7 @@ public class VrShellDelegate
} }
@CalledByNative @CalledByNative
private void exitWebVRPresent() { /* package */ void exitWebVRPresent() {
if (!mInVr) return; if (!mInVr) return;
if (mAutopresentWebVr) { if (mAutopresentWebVr) {
// For autopresent from Daydream home, we do NOT want to show ChromeVR. So if we // For autopresent from Daydream home, we do NOT want to show ChromeVR. So if we
......
...@@ -692,6 +692,7 @@ public class VrShellImpl ...@@ -692,6 +692,7 @@ public class VrShellImpl
*/ */
@Override @Override
public void setDialogView(View view) { public void setDialogView(View view) {
if (getWebVrModeEnabled()) return;
if (view == null) return; if (view == null) return;
assert mVrUiViewContainer.getChildCount() == 0; assert mVrUiViewContainer.getChildCount() == 0;
mVrUiViewContainer.addView(view); mVrUiViewContainer.addView(view);
...@@ -711,6 +712,7 @@ public class VrShellImpl ...@@ -711,6 +712,7 @@ public class VrShellImpl
*/ */
@Override @Override
public void setDialogSize(int width, int height) { public void setDialogSize(int width, int height) {
if (getWebVrModeEnabled()) return;
nativeSetAlertDialogSize(mNativeVrShell, width, height); nativeSetAlertDialogSize(mNativeVrShell, width, height);
} }
...@@ -719,6 +721,23 @@ public class VrShellImpl ...@@ -719,6 +721,23 @@ public class VrShellImpl
*/ */
@Override @Override
public void initVrDialog(int width, int height) { public void initVrDialog(int width, int height) {
if (getWebVrModeEnabled()) {
if (mVrBrowsingEnabled) {
mDelegate.exitWebVRPresent();
} else {
// TODO (asimjour): We should be able to show the dialogs in webvr. But for now,
// we close the dialog. Closing the dialog cannot happen in the show() method,
// therefore we have to post task the call to Presenter to close the dialog.
ThreadUtils.postOnUiThread(new Runnable() {
@Override
public void run() {
mVrModalPresenter.closeCurrentDialog();
}
});
return;
}
}
nativeSetAlertDialog(mNativeVrShell, width, height); nativeSetAlertDialog(mNativeVrShell, width, height);
mAndroidDialogGestureTarget = new AndroidUiGestureTarget( mAndroidDialogGestureTarget = new AndroidUiGestureTarget(
mVrUiViewContainer.getInputTarget(), 1.0f, getNativePageScrollRatio()); mVrUiViewContainer.getInputTarget(), 1.0f, getNativePageScrollRatio());
......
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