void VRController::onPresentComplete(ScriptPromiseResolver* resolver, unsigned index, bool success) { VRDisplay* vrDisplay = getDisplayForIndex(index); if (!vrDisplay) { DOMException* exception = DOMException::create(InvalidStateError, "VRDisplay not found."); resolver->reject(exception); ReportPresentationResult(PresentationResult::VRDisplayNotFound); return; } if (success) { vrDisplay->beginPresent(resolver); } else { vrDisplay->forceExitPresent(); DOMException* exception = DOMException::create( NotAllowedError, "Presentation request was denied."); ReportPresentationResult(PresentationResult::RequestDenied); resolver->reject(exception); } }
void VRController::OnExitPresent(unsigned index) { VRDisplay* vrDisplay = getDisplayForIndex(index); if (vrDisplay) vrDisplay->forceExitPresent(); }