| 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" |
| 12 #include "device/vr/vr_export.h" | 14 #include "device/vr/vr_export.h" |
| 13 #include "device/vr/vr_service.mojom.h" | 15 #include "device/vr/vr_service.mojom.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 15 | 17 |
| 16 namespace device { | 18 namespace device { |
| 17 | 19 |
| 18 class VRServiceImpl : public VRService { | 20 class VRServiceImpl : public mojom::VRService { |
| 19 public: | 21 public: |
| 20 DEVICE_VR_EXPORT ~VRServiceImpl() override; | 22 DEVICE_VR_EXPORT ~VRServiceImpl() override; |
| 21 | 23 |
| 22 DEVICE_VR_EXPORT static void BindRequest( | 24 DEVICE_VR_EXPORT static void BindRequest( |
| 23 mojo::InterfaceRequest<VRService> request); | 25 mojo::InterfaceRequest<mojom::VRService> request); |
| 24 | 26 |
| 25 VRServiceClientPtr& client() { return client_; } | 27 mojom::VRServiceClient* client() { return client_.get(); } |
| 28 |
| 29 VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); |
| 26 | 30 |
| 27 private: | 31 private: |
| 28 friend class VRServiceTestBinding; | 32 friend class VRServiceTestBinding; |
| 33 friend class VRDeviceManagerTest; |
| 34 friend class VRDisplayImpl; |
| 29 | 35 |
| 30 DEVICE_VR_EXPORT VRServiceImpl(); | 36 DEVICE_VR_EXPORT VRServiceImpl(); |
| 31 | 37 |
| 32 // Mojo connection handling. | 38 // Mojo connection handling. |
| 33 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<VRService> request); | 39 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<mojom::VRService> request); |
| 34 void RemoveFromDeviceManager(); | 40 void RemoveFromDeviceManager(); |
| 41 void RemoveDevice(VRDevice* device); |
| 35 | 42 |
| 36 // mojom::VRService implementation | 43 // mojom::VRService implementation |
| 37 void SetClient(VRServiceClientPtr client) override; | 44 void SetClient(mojom::VRServiceClientPtr service_client, |
| 38 void GetDisplays(const GetDisplaysCallback& callback) override; | 45 const SetClientCallback& callback) override; |
| 39 void GetPose(uint32_t index, const GetPoseCallback& callback) override; | |
| 40 void ResetPose(uint32_t index) override; | |
| 41 | 46 |
| 42 void RequestPresent(uint32_t index, | 47 using DisplayImplMap = std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>>; |
| 43 bool secureOrigin, | 48 DisplayImplMap displays_; |
| 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; | |
| 50 | 49 |
| 51 std::unique_ptr<mojo::Binding<VRService>> binding_; | 50 mojom::VRServiceClientPtr client_; |
| 52 VRServiceClientPtr client_; | 51 |
| 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 |