Chromium Code Reviews| 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); | |
|
dcheng
2016/11/08 18:15:44
Nit: please initialize |device_| and |service_| in
| |
| 17 mojom::VRDisplayInfoPtr display_info = device->GetVRDevice(); | |
| 18 service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(), | |
| 19 mojo::GetProxy(&client_), | |
| 20 std::move(display_info)); | |
| 21 } | |
| 22 | |
| 23 VRDisplayImpl::~VRDisplayImpl() {} | |
| 24 | |
| 25 void VRDisplayImpl::GetPose(const GetPoseCallback& callback) { | |
| 26 callback.Run(device_->GetPose(service_.get())); | |
| 27 } | |
| 28 | |
| 29 void VRDisplayImpl::ResetPose() { | |
| 30 device_->ResetPose(service_.get()); | |
| 31 } | |
| 32 | |
| 33 void VRDisplayImpl::RequestPresent(bool secureOrigin, | |
| 34 const RequestPresentCallback& callback) { | |
| 35 callback.Run(device_->RequestPresent(service_.get(), secureOrigin)); | |
| 36 } | |
| 37 | |
| 38 void VRDisplayImpl::ExitPresent() { | |
| 39 device_->ExitPresent(service_.get()); | |
| 40 } | |
| 41 | |
| 42 void VRDisplayImpl::SubmitFrame(mojom::VRPosePtr pose) { | |
| 43 device_->SubmitFrame(service_.get(), std::move(pose)); | |
| 44 } | |
| 45 | |
| 46 void VRDisplayImpl::UpdateLayerBounds(mojom::VRLayerBoundsPtr leftBounds, | |
| 47 mojom::VRLayerBoundsPtr rightBounds) { | |
| 48 device_->UpdateLayerBounds(service_.get(), std::move(leftBounds), | |
| 49 std::move(rightBounds)); | |
| 50 } | |
| 51 } | |
| OLD | NEW |