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

Unified Diff: device/vr/vr_display_impl.cc

Issue 2493063004: Fix exiting WebVR via Android UI not fully exiting fullscreen. (Closed)
Patch Set: Rebase pt. 2 Created 4 years, 1 month 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 | « device/vr/vr_device.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_display_impl.cc
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc
index c074205324a54b1caac4cfe169283a4f61a772d8..1449c55f4b79c579435013905b88db5bfc868518 100644
--- a/device/vr/vr_display_impl.cc
+++ b/device/vr/vr_display_impl.cc
@@ -21,29 +21,51 @@ VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
VRDisplayImpl::~VRDisplayImpl() {}
void VRDisplayImpl::GetPose(const GetPoseCallback& callback) {
- callback.Run(device_->GetPose(service_.get()));
+ if (!device_->IsAccessAllowed(service_.get())) {
+ callback.Run(nullptr);
+ return;
+ }
+
+ callback.Run(device_->GetPose());
}
void VRDisplayImpl::ResetPose() {
- device_->ResetPose(service_.get());
+ if (!device_->IsAccessAllowed(service_.get()))
+ return;
+
+ device_->ResetPose();
}
void VRDisplayImpl::RequestPresent(bool secureOrigin,
const RequestPresentCallback& callback) {
- callback.Run(device_->RequestPresent(service_.get(), secureOrigin));
+ if (!device_->IsAccessAllowed(service_.get())) {
+ callback.Run(false);
+ return;
+ }
+
+ bool success = device_->RequestPresent(secureOrigin);
+ if (success) {
+ device_->SetPresentingService(service_.get());
+ }
+ callback.Run(success);
}
void VRDisplayImpl::ExitPresent() {
- device_->ExitPresent(service_.get());
+ if (device_->IsPresentingService(service_.get()))
+ device_->ExitPresent();
}
void VRDisplayImpl::SubmitFrame(mojom::VRPosePtr pose) {
- device_->SubmitFrame(service_.get(), std::move(pose));
+ if (!device_->IsPresentingService(service_.get()))
+ return;
+ device_->SubmitFrame(std::move(pose));
}
void VRDisplayImpl::UpdateLayerBounds(mojom::VRLayerBoundsPtr leftBounds,
mojom::VRLayerBoundsPtr rightBounds) {
- device_->UpdateLayerBounds(service_.get(), std::move(leftBounds),
- std::move(rightBounds));
+ if (!device_->IsAccessAllowed(service_.get()))
+ return;
+
+ device_->UpdateLayerBounds(std::move(leftBounds), std::move(rightBounds));
}
}
« no previous file with comments | « device/vr/vr_device.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698