| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef DEVICE_VR_VR_SERVICE_IMPL_H | 5 #ifndef DEVICE_VR_VR_SERVICE_IMPL_H |
| 6 #define DEVICE_VR_VR_SERVICE_IMPL_H | 6 #define DEVICE_VR_VR_SERVICE_IMPL_H |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 | 11 |
| 12 #include "device/vr/vr_device.h" | |
| 13 #include "device/vr/vr_display_impl.h" | |
| 14 #include "device/vr/vr_export.h" | 12 #include "device/vr/vr_export.h" |
| 15 #include "device/vr/vr_service.mojom.h" | 13 #include "device/vr/vr_service.mojom.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
| 17 | 15 |
| 18 namespace device { | 16 namespace device { |
| 19 | 17 |
| 20 class VRServiceImpl : public mojom::VRService { | 18 class VRServiceImpl : public VRService { |
| 21 public: | 19 public: |
| 22 DEVICE_VR_EXPORT ~VRServiceImpl() override; | 20 DEVICE_VR_EXPORT ~VRServiceImpl() override; |
| 23 | 21 |
| 24 DEVICE_VR_EXPORT static void BindRequest( | 22 DEVICE_VR_EXPORT static void BindRequest( |
| 25 mojo::InterfaceRequest<mojom::VRService> request); | 23 mojo::InterfaceRequest<VRService> request); |
| 26 | 24 |
| 27 mojom::VRServiceClient* client() { return client_.get(); } | 25 VRServiceClientPtr& client() { return client_; } |
| 28 | |
| 29 VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); | |
| 30 | 26 |
| 31 private: | 27 private: |
| 32 friend class VRServiceTestBinding; | 28 friend class VRServiceTestBinding; |
| 33 friend class VRDeviceManagerTest; | |
| 34 friend class VRDisplayImpl; | |
| 35 | 29 |
| 36 DEVICE_VR_EXPORT VRServiceImpl(); | 30 DEVICE_VR_EXPORT VRServiceImpl(); |
| 37 | 31 |
| 38 // Mojo connection handling. | 32 // Mojo connection handling. |
| 39 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<mojom::VRService> request); | 33 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<VRService> request); |
| 40 void RemoveFromDeviceManager(); | 34 void RemoveFromDeviceManager(); |
| 41 void RemoveDevice(VRDevice* device); | |
| 42 | 35 |
| 43 // mojom::VRService implementation | 36 // mojom::VRService implementation |
| 44 void SetClient(mojom::VRServiceClientPtr service_client, | 37 void SetClient(VRServiceClientPtr client) override; |
| 45 const SetClientCallback& callback) override; | 38 void GetDisplays(const GetDisplaysCallback& callback) override; |
| 39 void GetPose(uint32_t index, const GetPoseCallback& callback) override; |
| 40 void ResetPose(uint32_t index) override; |
| 46 | 41 |
| 47 using DisplayImplMap = std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>>; | 42 void RequestPresent(uint32_t index, |
| 48 DisplayImplMap displays_; | 43 bool secureOrigin, |
| 44 const RequestPresentCallback& callback) override; |
| 45 void ExitPresent(uint32_t index) override; |
| 46 void SubmitFrame(uint32_t index, VRPosePtr pose) override; |
| 47 void UpdateLayerBounds(uint32_t index, |
| 48 VRLayerBoundsPtr leftBounds, |
| 49 VRLayerBoundsPtr rightBounds) override; |
| 49 | 50 |
| 50 mojom::VRServiceClientPtr client_; | 51 std::unique_ptr<mojo::Binding<VRService>> binding_; |
| 51 | 52 VRServiceClientPtr client_; |
| 52 std::unique_ptr<mojo::Binding<mojom::VRService>> binding_; | |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); | 54 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace device | 57 } // namespace device |
| 58 | 58 |
| 59 #endif // DEVICE_VR_VR_SERVICE_IMPL_H | 59 #endif // DEVICE_VR_VR_SERVICE_IMPL_H |
| OLD | NEW |