Commit fb0c86e6 authored by Amirhossein Simjour's avatar Amirhossein Simjour Committed by Commit Bot

Reset Floating flag when dialog is not floating

Floating flag should be set to false when a Dialog is not anchored
to the main content.

Bug: 833466
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_vr
Change-Id: Idad148d25bc1d51e6ba2b764426d2b8dc6b380a4
Reviewed-on: https://chromium-review.googlesource.com/1024231Reviewed-by: default avatarBiao She <bshe@chromium.org>
Commit-Queue: Amirhossein Simjour <asimjour@chromium.org>
Cr-Commit-Position: refs/heads/master@{#552868}
parent 7b444fb5
......@@ -34,6 +34,7 @@ public class VrDialog extends FrameLayout {
DIALOG_WIDTH, ViewGroup.LayoutParams.WRAP_CONTENT, Gravity.LEFT));
setBackgroundColor(Color.WHITE);
mVrDialogManager = vrDialogManager;
mVrDialogManager.setDialogFloating(false);
}
/**
......
......@@ -49,7 +49,9 @@ public interface VrDialogManager {
void initVrDialog(int width, int height);
/**
* Set dialog as floating. This means that Dialog can change its position
* Set dialog as floating or not floating. Floting means that Dialog can change its position.
*
* @param floating indicates if the dialog is floating.
*/
void setDialogFloating();
void setDialogFloating(boolean floating);
}
\ No newline at end of file
......@@ -28,6 +28,7 @@ public class VrPopupWindow extends PopupWindow {
super(context);
mContext = context;
mVrDialogManager = vrDialogManager;
mVrDialogManager.setDialogFloating(true);
}
@Override
......@@ -44,7 +45,6 @@ public class VrPopupWindow extends PopupWindow {
mVrPopupContainer.addView(dialogView, params);
mVrDialogManager.setDialogView(mVrPopupContainer);
mVrDialogManager.initVrDialog(getWidth(), getHeight());
mVrDialogManager.setDialogFloating();
mVrDialogManager.setDialogLocation(x, y);
mIsShowing = true;
}
......
......@@ -786,8 +786,8 @@ public class VrShellImpl
}
@Override
public void setDialogFloating() {
nativeSetDialogFloating(mNativeVrShell);
public void setDialogFloating(boolean floating) {
nativeSetDialogFloating(mNativeVrShell, floating);
}
/**
......@@ -1163,7 +1163,7 @@ public class VrShellImpl
private native void nativeSetDialogBufferSize(long nativeVrShell, float width, float height);
private native void nativeSetAlertDialogSize(long nativeVrShell, float width, float height);
private native void nativeSetDialogLocation(long nativeVrShell, float x, float y);
private native void nativeSetDialogFloating(long nativeVrShell);
private native void nativeSetDialogFloating(long nativeVrShell, boolean floating);
private native void nativeShowToast(long nativeVrShell, String text);
private native void nativeCancelToast(long nativeVrShell);
private native void nativeSetHistoryButtonsEnabled(
......
......@@ -628,11 +628,12 @@ void VrShell::SetDialogLocation(JNIEnv* env,
gl_thread_->GetVrShellGl(), x, y));
}
void VrShell::SetDialogFloating(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj) {
PostToGlThread(FROM_HERE, base::BindOnce(&VrShellGl::SetDialogFloating,
gl_thread_->GetVrShellGl()));
void VrShell::SetDialogFloating(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
bool floating) {
PostToGlThread(FROM_HERE,
base::BindOnce(&VrShellGl::SetDialogFloating,
gl_thread_->GetVrShellGl(), floating));
}
void VrShell::ShowToast(JNIEnv* env,
......
......@@ -227,7 +227,8 @@ class VrShell : device::GvrGamepadDataProvider,
float x,
float y);
void SetDialogFloating(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
const base::android::JavaParamRef<jobject>& obj,
bool floating);
void ShowToast(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj,
......
......@@ -886,8 +886,8 @@ void VrShellGl::SetDialogLocation(float x, float y) {
ui_->SetDialogLocation(x, y);
}
void VrShellGl::SetDialogFloating() {
ui_->SetDialogFloating();
void VrShellGl::SetDialogFloating(bool floating) {
ui_->SetDialogFloating(floating);
}
void VrShellGl::ShowToast(const base::string16& text) {
......
......@@ -312,7 +312,7 @@ class VrShellGl : public device::mojom::VRPresentationProvider {
void SetAlertDialogSize(float width, float height);
void SetDialogLocation(float x, float y);
void SetDialogFloating();
void SetDialogFloating(bool floating);
void ShowToast(const base::string16& text);
void CancelToast();
......
......@@ -250,8 +250,8 @@ void Ui::SetDialogLocation(float x, float y) {
model_->hosted_platform_ui.rect.set_x(x);
}
void Ui::SetDialogFloating() {
model_->hosted_platform_ui.floating = true;
void Ui::SetDialogFloating(bool floating) {
model_->hosted_platform_ui.floating = floating;
}
void Ui::ShowPlatformToast(const base::string16& text) {
......
......@@ -121,7 +121,7 @@ class Ui : public BrowserUiInterface, public KeyboardUiInterface {
float height);
void SetAlertDialogSize(float width, float height);
void SetDialogLocation(float x, float y);
void SetDialogFloating();
void SetDialogFloating(bool floating);
void ShowPlatformToast(const base::string16& text);
void CancelPlatformToast();
bool ShouldRenderWebVr();
......
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