| 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" | 12 #include "device/vr/vr_device.h" |
| 13 #include "device/vr/vr_display_impl.h" | 13 #include "device/vr/vr_display_impl.h" |
| 14 #include "device/vr/vr_export.h" | 14 #include "device/vr/vr_export.h" |
| 15 #include "device/vr/vr_service.mojom.h" | 15 #include "device/vr/vr_service.mojom.h" |
| 16 #include "mojo/public/cpp/bindings/binding.h" | 16 #include "mojo/public/cpp/bindings/binding.h" |
| 17 | 17 |
| 18 namespace device { | 18 namespace device { |
| 19 | 19 |
| 20 class VRServiceImpl : public mojom::VRService { | 20 class VRServiceImpl : public mojom::VRService { |
| 21 public: | 21 public: |
| 22 DEVICE_VR_EXPORT VRServiceImpl(); |
| 22 DEVICE_VR_EXPORT ~VRServiceImpl() override; | 23 DEVICE_VR_EXPORT ~VRServiceImpl() override; |
| 23 | 24 |
| 24 DEVICE_VR_EXPORT static void BindRequest( | 25 DEVICE_VR_EXPORT static void Create( |
| 25 mojo::InterfaceRequest<mojom::VRService> request); | 26 mojo::InterfaceRequest<mojom::VRService> request); |
| 26 | 27 |
| 27 mojom::VRServiceClient* client() { return client_.get(); } | 28 mojom::VRServiceClient* client() { return client_.get(); } |
| 28 | 29 |
| 29 DEVICE_VR_EXPORT VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); | 30 DEVICE_VR_EXPORT VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); |
| 30 | 31 |
| 31 // mojom::VRService implementation | 32 // mojom::VRService implementation |
| 32 void SetClient(mojom::VRServiceClientPtr service_client, | 33 void SetClient(mojom::VRServiceClientPtr service_client, |
| 33 const SetClientCallback& callback) override; | 34 const SetClientCallback& callback) override; |
| 34 | 35 |
| 35 bool listening_for_activate() { return listening_for_activate_; } | 36 bool listening_for_activate() { return listening_for_activate_; } |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 friend class FakeVRServiceClient; | 39 friend class FakeVRServiceClient; |
| 39 friend class VRDeviceManagerTest; | 40 friend class VRDeviceManagerTest; |
| 40 friend class VRDisplayImpl; | 41 friend class VRDisplayImpl; |
| 41 friend class VRDisplayImplTest; | 42 friend class VRDisplayImplTest; |
| 42 friend class VRServiceImplTest; | 43 friend class VRServiceImplTest; |
| 43 | 44 |
| 44 DEVICE_VR_EXPORT VRServiceImpl(); | |
| 45 | |
| 46 // Mojo connection handling. | |
| 47 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<mojom::VRService> request); | |
| 48 void RemoveFromDeviceManager(); | |
| 49 void RemoveDevice(VRDevice* device); | 45 void RemoveDevice(VRDevice* device); |
| 50 | 46 |
| 51 void SetListeningForActivate(bool listening) override; | 47 void SetListeningForActivate(bool listening) override; |
| 52 | 48 |
| 53 using DisplayImplMap = std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>>; | 49 std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_; |
| 54 DisplayImplMap displays_; | |
| 55 | 50 |
| 56 mojom::VRServiceClientPtr client_; | 51 mojom::VRServiceClientPtr client_; |
| 57 | 52 |
| 58 bool listening_for_activate_; | 53 bool listening_for_activate_; |
| 59 | 54 |
| 60 std::unique_ptr<mojo::Binding<mojom::VRService>> binding_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); | 55 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); |
| 63 }; | 56 }; |
| 64 | 57 |
| 65 } // namespace device | 58 } // namespace device |
| 66 | 59 |
| 67 #endif // DEVICE_VR_VR_SERVICE_IMPL_H | 60 #endif // DEVICE_VR_VR_SERVICE_IMPL_H |
| OLD | NEW |