Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(970)

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.cpp

Issue 2859533003: WebVR: lock focus while presenting to presenting window (Closed)
Patch Set: Update comment + fix comment line lengths Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/vr/VRDisplay.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
index 27228f4c3112e7f043355473a92f84f67ce20b10..adf94d840f7337e81cab5df8e953f5cd578a2046 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.cpp
@@ -105,7 +105,7 @@ void VRDisplay::Update(const device::mojom::blink::VRDisplayInfoPtr& display) {
}
bool VRDisplay::getFrameData(VRFrameData* frame_data) {
- if (!navigator_vr_->IsFocused() || !frame_pose_ || display_blurred_)
+ if (!FocusedOrPresenting() || !frame_pose_ || display_blurred_)
return false;
if (!frame_data)
@@ -794,7 +794,7 @@ void VRDisplay::OnVSync(device::mojom::blink::VRPosePtr pose,
}
void VRDisplay::ConnectVSyncProvider() {
- if (!navigator_vr_->IsFocused() || vr_v_sync_provider_.is_bound())
+ if (!FocusedOrPresenting() || vr_v_sync_provider_.is_bound())
return;
display_->GetVRVSyncProvider(mojo::MakeRequest(&vr_v_sync_provider_));
vr_v_sync_provider_.set_connection_error_handler(ConvertToBaseCallback(
@@ -853,6 +853,12 @@ void VRDisplay::FocusChanged() {
ConnectVSyncProvider();
}
+bool VRDisplay::FocusedOrPresenting() {
+ // TODO(mthiesse, crbug.com/687411): Focused state should be determined
+ // browser-side to correctly track which display should be receiving input.
+ return navigator_vr_->IsFocused() || is_presenting_;
+}
+
DEFINE_TRACE(VRDisplay) {
EventTargetWithInlineData::Trace(visitor);
ContextLifecycleObserver::Trace(visitor);
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRDisplay.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698