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

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

Issue 2881233002: WebVR: lock focus while presenting to presenting window (Closed)
Patch Set: 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 e7897cdf8925f17fff2be155bb349d4d31c13f91..661f8787acd1aa5fcf34f5c8f0a67e7ffc9e0c02 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)
@@ -790,7 +790,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(
@@ -849,6 +849,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