| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include <utility> |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "device/vr/vr_device.h" |
| 9 #include "device/vr/vr_service_impl.h" |
| 10 |
| 11 namespace device { |
| 12 |
| 13 VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service) |
| 14 : binding_(this) { |
| 15 device_ = device; |
| 16 service_.reset(service); |
| 17 mojom::VRDisplayInfoPtr display_info = device->GetVRDevice(); |
| 18 service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(), |
| 19 std::move(display_info)); |
| 20 } |
| 21 |
| 22 VRDisplayImpl::~VRDisplayImpl() {} |
| 23 |
| 24 void VRDisplayImpl::SetClient(mojom::VRDisplayClientPtr client) { |
| 25 client_ = std::move(client); |
| 26 } |
| 27 |
| 28 void VRDisplayImpl::GetPose(const GetPoseCallback& callback) { |
| 29 callback.Run(device_->GetPose(service_.get())); |
| 30 } |
| 31 |
| 32 void VRDisplayImpl::ResetPose() { |
| 33 device_->ResetPose(service_.get()); |
| 34 } |
| 35 |
| 36 void VRDisplayImpl::RequestPresent(bool secureOrigin, |
| 37 const RequestPresentCallback& callback) { |
| 38 callback.Run(device_->RequestPresent(service_.get(), secureOrigin)); |
| 39 } |
| 40 |
| 41 void VRDisplayImpl::ExitPresent() { |
| 42 device_->ExitPresent(service_.get()); |
| 43 } |
| 44 |
| 45 void VRDisplayImpl::SubmitFrame(mojom::VRPosePtr pose) { |
| 46 device_->SubmitFrame(service_.get(), std::move(pose)); |
| 47 } |
| 48 |
| 49 void VRDisplayImpl::UpdateLayerBounds(mojom::VRLayerBoundsPtr leftBounds, |
| 50 mojom::VRLayerBoundsPtr rightBounds) { |
| 51 device_->UpdateLayerBounds(service_.get(), std::move(leftBounds), |
| 52 std::move(rightBounds)); |
| 53 } |
| 54 } |
| OLD | NEW |