Index: third_party/WebKit/Source/modules/vr/VRController.h |
diff --git a/third_party/WebKit/Source/modules/vr/VRController.h b/third_party/WebKit/Source/modules/vr/VRController.h |
index eb4e0eaa41bc5c2d2b779aefcdcf36cc6977296f..abc9b80378ba838ea030e06f88e28e625b2101e3 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRController.h |
+++ b/third_party/WebKit/Source/modules/vr/VRController.h |
@@ -7,12 +7,27 @@ |
#include "core/frame/LocalFrameLifecycleObserver.h" |
#include "modules/ModulesExport.h" |
+#include "modules/vr/VRTypeConverters.h" |
#include "platform/Supplementable.h" |
-#include "public/platform/modules/vr/WebVR.h" |
-#include "public/platform/modules/vr/WebVRClient.h" |
+#include "wtf/HashSet.h" |
namespace blink { |
+class ServiceRegistry; |
+class VRGetDevicesCallback; |
+ |
+class VRGetDevicesRequest { |
+ USING_FAST_MALLOC(VRGetDevicesRequest); |
+ WTF_MAKE_NONCOPYABLE(VRGetDevicesRequest); |
+public: |
+ explicit VRGetDevicesRequest(VRGetDevicesCallback*); |
+ ~VRGetDevicesRequest(); |
+ VRGetDevicesCallback* getDevicesCallback() const; |
+ |
+private: |
+ OwnPtr<VRGetDevicesCallback> m_getDevicesCallback; |
+}; |
+ |
class MODULES_EXPORT VRController final |
: public GarbageCollectedFinalized<VRController> |
, public Supplement<LocalFrame> |
@@ -22,25 +37,30 @@ class MODULES_EXPORT VRController final |
public: |
virtual ~VRController(); |
- void getDevices(WebVRGetDevicesCallback*); |
+ void getDevices(VRGetDevicesCallback*); |
void getSensorState(unsigned index, WebHMDSensorState& into); |
void resetSensor(unsigned index); |
- static void provideTo(LocalFrame&, WebVRClient*); |
+ static void provideTo(LocalFrame&, ServiceRegistry*); |
static VRController* from(LocalFrame&); |
static const char* supplementName(); |
DECLARE_VIRTUAL_TRACE(); |
private: |
- VRController(LocalFrame&, WebVRClient*); |
+ VRController(LocalFrame&, ServiceRegistry*); |
// Inherited from LocalFrameLifecycleObserver. |
void willDetachFrameHost() override; |
- WebVRClient* m_client; |
+ // Binding callbacks. |
+ void OnGetDevices(VRGetDevicesRequest*, const mojo::Array<mojom::VRDeviceInfoPtr>&); |
+ void OnGetSensorState(WebHMDSensorState*, const mojom::VRSensorStatePtr&); |
+ |
+ WTF::HashSet<OwnPtr<VRGetDevicesRequest>> m_pendingRequests; |
+ mojom::VRServicePtr m_service; |
}; |
} // namespace blink |