Chromium Code Reviews| Index: device/vr/vr_service_impl.h |
| diff --git a/device/vr/vr_service_impl.h b/device/vr/vr_service_impl.h |
| index ba8b6b162dd3949158b6676a41159a3ba858dc60..4f2058a6ac015962ae2e3e085bf740ecc9b26259 100644 |
| --- a/device/vr/vr_service_impl.h |
| +++ b/device/vr/vr_service_impl.h |
| @@ -17,6 +17,11 @@ |
| namespace device { |
| +// Browser process representation of a WebVR site session. Instantiated through |
| +// Mojo once the user loads a page containing WebVR. |
| +// It instantiates a VRDisplayImpl for each newly connected VRDisplay and sends |
| +// the display's info to the render process through its connected |
| +// mojom::VRServiceClient. |
| class VRServiceImpl : public mojom::VRService { |
| public: |
| DEVICE_VR_EXPORT VRServiceImpl(); |
| @@ -25,26 +30,25 @@ class VRServiceImpl : public mojom::VRService { |
| DEVICE_VR_EXPORT static void Create( |
| mojo::InterfaceRequest<mojom::VRService> request); |
| - mojom::VRServiceClient* client() { return client_.get(); } |
| - |
| - DEVICE_VR_EXPORT VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); |
| - |
| // mojom::VRService implementation |
| + // Adds this service to the VRDeviceManager. |
| void SetClient(mojom::VRServiceClientPtr service_client, |
| const SetClientCallback& callback) override; |
| bool listening_for_activate() { return listening_for_activate_; } |
| + // Tells the render process that a new VR device is available. |
| + void ConnectDevice(VRDevice* device); |
| + |
| private: |
| friend class FakeVRServiceClient; |
| friend class VRDeviceManagerTest; |
| - friend class VRDisplayImpl; |
| friend class VRDisplayImplTest; |
| friend class VRServiceImplTest; |
| - void RemoveDevice(VRDevice* device); |
| - |
| void SetListeningForActivate(bool listening) override; |
| + void OnVRDisplayInfoCreated(VRDevice* device, |
| + mojom::VRDisplayInfoPtr display_info); |
| std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_; |
| @@ -52,6 +56,11 @@ class VRServiceImpl : public mojom::VRService { |
| bool listening_for_activate_; |
| + base::WeakPtrFactory<VRServiceImpl> weak_ptr_factory_; |
| + |
| + // Getter for testing. |
| + VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); |
|
dcheng
2017/03/16 05:38:22
There's a weak convention of suffixing this with '
tiborg
2017/03/16 15:02:40
Oh, perfect! Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); |
| }; |