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..9ce0eab0999425914c7fe7bb999b0ff89fe69724 100644 |
--- a/third_party/WebKit/Source/modules/vr/VRController.h |
+++ b/third_party/WebKit/Source/modules/vr/VRController.h |
@@ -8,11 +8,19 @@ |
#include "core/frame/LocalFrameLifecycleObserver.h" |
#include "modules/ModulesExport.h" |
#include "platform/Supplementable.h" |
+#include "public/platform/WebCallbacks.h" |
+#include "public/platform/WebVector.h" |
#include "public/platform/modules/vr/WebVR.h" |
-#include "public/platform/modules/vr/WebVRClient.h" |
+#include "public/platform/modules/vr/vr_service.mojom-wtf.h" |
+#include "wtf/Vector.h" |
namespace blink { |
+class ServiceRegistry; |
+ |
+// Success and failure callbacks for getDevices. |
+using WebVRGetDevicesCallback = WebCallbacks<const WebVector<WebVRDevice>&, void>; |
+ |
class MODULES_EXPORT VRController final |
: public GarbageCollectedFinalized<VRController> |
, public Supplement<LocalFrame> |
@@ -24,23 +32,32 @@ public: |
void getDevices(WebVRGetDevicesCallback*); |
- void getSensorState(unsigned index, WebHMDSensorState& into); |
+ 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*); |
+ |
+ mojom::wtf::VRServicePtr& service(); |
+ |
+ // Callback handlers |
+ void OnGetDevices(const mojo::WTFArray<mojom::wtf::VRDeviceInfoPtr>& devices); |
+ void OnGetSensorState(const mojom::wtf::VRSensorStatePtr& mojoState); |
// Inherited from LocalFrameLifecycleObserver. |
void willDetachFrameHost() override; |
- WebVRClient* m_client; |
+ ServiceRegistry* m_registry; |
+ mojom::wtf::VRServicePtr m_service; |
+ WebHMDSensorState* m_pendingState; |
+ Vector<OwnPtr<WebVRGetDevicesCallback>> m_pendingDeviceRequests; |
}; |
} // namespace blink |