Commit 2f750a3a authored by Aldo Culquicondor's avatar Aldo Culquicondor Committed by Commit Bot

VR: Notify delegate when UI has finished loading

This allows the tests to be able to submit events only when the UI
is fully loaded.

Bug: 864840, 864161
Change-Id: I41bb0364d3019910fc0b924fd25fe4a9486e6e90
Reviewed-on: https://chromium-review.googlesource.com/1142033Reviewed-by: default avatarMichael Thiessen <mthiesse@chromium.org>
Commit-Queue: Aldo Culquicondor <acondor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576207}
parent d71d77e5
...@@ -32,6 +32,11 @@ public interface VrShell extends VrDialogManager, VrToastManager { ...@@ -32,6 +32,11 @@ public interface VrShell extends VrDialogManager, VrToastManager {
*/ */
void teardown(); void teardown();
/**
* Returns true if VrShell UI has finished loading.
*/
boolean hasUiFinishedLoading();
/** /**
* Sets whether we're presenting WebVR content or not. * Sets whether we're presenting WebVR content or not.
*/ */
......
...@@ -2000,7 +2000,7 @@ public class VrShellDelegate ...@@ -2000,7 +2000,7 @@ public class VrShellDelegate
@VisibleForTesting @VisibleForTesting
protected boolean isVrEntryComplete() { protected boolean isVrEntryComplete() {
return mInVr && !mProbablyInDon; return mInVr && !mProbablyInDon && getVrShell().hasUiFinishedLoading();
} }
@VisibleForTesting @VisibleForTesting
......
...@@ -804,6 +804,11 @@ public class VrShellImpl ...@@ -804,6 +804,11 @@ public class VrShellImpl
shutdown(); shutdown();
} }
@Override
public boolean hasUiFinishedLoading() {
return nativeHasUiFinishedLoading(mNativeVrShell);
}
/** /**
* Set View for the Dialog that should show up on top of the main content. * Set View for the Dialog that should show up on top of the main content.
*/ */
...@@ -1277,6 +1282,7 @@ public class VrShellImpl ...@@ -1277,6 +1282,7 @@ public class VrShellImpl
boolean reprojectedRendering, float displayWidthMeters, float displayHeightMeters, boolean reprojectedRendering, float displayWidthMeters, float displayHeightMeters,
int displayWidthPixels, int displayHeightPixels, boolean pauseContent, int displayWidthPixels, int displayHeightPixels, boolean pauseContent,
boolean lowDensity, boolean isStandaloneVrDevice); boolean lowDensity, boolean isStandaloneVrDevice);
private native boolean nativeHasUiFinishedLoading(long nativeVrShell);
private native void nativeSetSurface(long nativeVrShell, Surface surface); private native void nativeSetSurface(long nativeVrShell, Surface surface);
private native void nativeSwapContents(long nativeVrShell, Tab tab); private native void nativeSwapContents(long nativeVrShell, Tab tab);
private native void nativeSetAndroidGestureTarget( private native void nativeSetAndroidGestureTarget(
......
...@@ -209,6 +209,12 @@ void VrShell::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { ...@@ -209,6 +209,12 @@ void VrShell::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) {
delete this; delete this;
} }
bool VrShell::HasUiFinishedLoading(
JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj) {
return ui_finished_loading_;
}
void VrShell::SwapContents(JNIEnv* env, void VrShell::SwapContents(JNIEnv* env,
const JavaParamRef<jobject>& obj, const JavaParamRef<jobject>& obj,
const JavaParamRef<jobject>& tab) { const JavaParamRef<jobject>& tab) {
...@@ -1202,6 +1208,7 @@ void VrShell::OnAssetsLoaded(AssetsLoadStatus status, ...@@ -1202,6 +1208,7 @@ void VrShell::OnAssetsLoaded(AssetsLoadStatus status,
AssetsLoader::GetInstance()->GetMetricsHelper()->OnAssetsLoaded( AssetsLoader::GetInstance()->GetMetricsHelper()->OnAssetsLoaded(
status, component_version); status, component_version);
ui_finished_loading_ = true;
} }
void VrShell::LoadAssets() { void VrShell::LoadAssets() {
...@@ -1223,6 +1230,7 @@ void VrShell::OnAssetsComponentReady() { ...@@ -1223,6 +1230,7 @@ void VrShell::OnAssetsComponentReady() {
void VrShell::OnAssetsComponentWaitTimeout() { void VrShell::OnAssetsComponentWaitTimeout() {
ui_->OnAssetsUnavailable(); ui_->OnAssetsUnavailable();
ui_finished_loading_ = true;
} }
void VrShell::SetCookieInfo(const CookieInfoList& cookie_info_list) {} void VrShell::SetCookieInfo(const CookieInfoList& cookie_info_list) {}
......
...@@ -78,6 +78,8 @@ class VrShell : device::GvrGamepadDataProvider, ...@@ -78,6 +78,8 @@ class VrShell : device::GvrGamepadDataProvider,
int display_height_pixels, int display_height_pixels,
bool pause_content, bool pause_content,
bool low_density); bool low_density);
bool HasUiFinishedLoading(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj);
void SwapContents(JNIEnv* env, void SwapContents(JNIEnv* env,
const base::android::JavaParamRef<jobject>& obj, const base::android::JavaParamRef<jobject>& obj,
const base::android::JavaParamRef<jobject>& web_contents); const base::android::JavaParamRef<jobject>& web_contents);
...@@ -371,6 +373,7 @@ class VrShell : device::GvrGamepadDataProvider, ...@@ -371,6 +373,7 @@ class VrShell : device::GvrGamepadDataProvider,
base::OneShotTimer waiting_for_assets_component_timer_; base::OneShotTimer waiting_for_assets_component_timer_;
bool can_load_new_assets_ = false; bool can_load_new_assets_ = false;
bool ui_finished_loading_ = false;
base::WaitableEvent gl_surface_created_event_; base::WaitableEvent gl_surface_created_event_;
gfx::AcceleratedWidget surface_window_ = nullptr; gfx::AcceleratedWidget surface_window_ = nullptr;
......
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