Exemple #1
0
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);
  }
}
Exemple #2
0
void VRController::OnExitPresent(unsigned index) {
  VRDisplay* vrDisplay = getDisplayForIndex(index);
  if (vrDisplay)
    vrDisplay->forceExitPresent();
}