Chromium Code Reviews| 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 // Browser process representation of a WebVR site session. Instantiated through | |
| 21 // Mojo once the user navigates to a web site containing WebVR. | |
|
mthiesse
2017/03/13 22:17:29
nit: s/navigates to a web site/loads a page/
tiborg
2017/03/13 23:00:58
Done.
| |
| 22 // It instantiates a VRDisplayImpl for each newly connected VRDisplay and sends | |
| 23 // the display's info to the browser process through its connected | |
| 24 // mojom::VRServiceClient. | |
| 20 class VRServiceImpl : public mojom::VRService { | 25 class VRServiceImpl : public mojom::VRService { |
|
amp
2017/03/13 22:26:05
Not required for this change, but VRServiceImpl se
tiborg
2017/03/13 23:00:58
Yep, agreed. VRSession sounds good to me. Should b
bajones
2017/03/13 23:04:57
May want to be careful with that. VRSession will h
amp
2017/03/14 17:05:50
Thanks for the clarification Brandon. I thought I
| |
| 21 public: | 26 public: |
| 22 DEVICE_VR_EXPORT VRServiceImpl(); | 27 DEVICE_VR_EXPORT VRServiceImpl(); |
| 23 DEVICE_VR_EXPORT ~VRServiceImpl() override; | 28 DEVICE_VR_EXPORT ~VRServiceImpl() override; |
| 24 | 29 |
| 25 DEVICE_VR_EXPORT static void Create( | 30 DEVICE_VR_EXPORT static void Create( |
| 26 mojo::InterfaceRequest<mojom::VRService> request); | 31 mojo::InterfaceRequest<mojom::VRService> request); |
| 27 | 32 |
| 28 mojom::VRServiceClient* client() { return client_.get(); } | |
| 29 | |
| 30 DEVICE_VR_EXPORT VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); | |
| 31 | |
| 32 // mojom::VRService implementation | 33 // mojom::VRService implementation |
| 34 // Adds this service to the VRDeviceManager. | |
| 33 void SetClient(mojom::VRServiceClientPtr service_client, | 35 void SetClient(mojom::VRServiceClientPtr service_client, |
| 34 const SetClientCallback& callback) override; | 36 const SetClientCallback& callback) override; |
| 35 | 37 |
| 36 bool listening_for_activate() { return listening_for_activate_; } | 38 bool listening_for_activate() { return listening_for_activate_; } |
| 37 | 39 |
| 40 // Tell the render process that a new VR device is available. | |
| 41 void ConnectDevice(VRDevice* device); | |
| 42 | |
| 38 private: | 43 private: |
| 39 friend class FakeVRServiceClient; | 44 friend class FakeVRServiceClient; |
| 40 friend class VRDeviceManagerTest; | 45 friend class VRDeviceManagerTest; |
| 41 friend class VRDisplayImpl; | |
| 42 friend class VRDisplayImplTest; | 46 friend class VRDisplayImplTest; |
| 43 friend class VRServiceImplTest; | 47 friend class VRServiceImplTest; |
| 44 | 48 |
| 45 void RemoveDevice(VRDevice* device); | |
| 46 | |
| 47 void SetListeningForActivate(bool listening) override; | 49 void SetListeningForActivate(bool listening) override; |
| 50 void OnVRDisplayInfoCreated(VRDevice* device, | |
| 51 mojom::VRDisplayInfoPtr display_info); | |
| 48 | 52 |
| 49 std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_; | 53 std::map<VRDevice*, std::unique_ptr<VRDisplayImpl>> displays_; |
| 50 | 54 |
| 51 mojom::VRServiceClientPtr client_; | 55 mojom::VRServiceClientPtr client_; |
| 52 | 56 |
| 53 bool listening_for_activate_; | 57 bool listening_for_activate_; |
| 54 | 58 |
| 59 base::WeakPtrFactory<VRServiceImpl> weak_ptr_factory_; | |
| 60 | |
| 61 // Getter for testing. | |
| 62 VRDisplayImpl* GetVRDisplayImpl(VRDevice* device); | |
| 63 | |
| 55 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); | 64 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); |
| 56 }; | 65 }; |
| 57 | 66 |
| 58 } // namespace device | 67 } // namespace device |
| 59 | 68 |
| 60 #endif // DEVICE_VR_VR_SERVICE_IMPL_H | 69 #endif // DEVICE_VR_VR_SERVICE_IMPL_H |
| OLD | NEW |