Chromium Code Reviews| Index: third_party/WebKit/Source/platform/vr/vr_dispatcher.h |
| diff --git a/third_party/WebKit/Source/platform/vr/vr_dispatcher.h b/third_party/WebKit/Source/platform/vr/vr_dispatcher.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1b11f9d7cf6f8a1d792cb847b45e2ab3a6780429 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/platform/vr/vr_dispatcher.h |
| @@ -0,0 +1,59 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef BLINK_PLATFORM_VR_VR_DISPATCHER_H_ |
| +#define BLINK_PLATFORM_VR_VR_DISPATCHER_H_ |
| + |
| +#include "platform/PlatformExport.h" |
| +#include "public/platform/modules/vr/vr_service.mojom.h" |
| +#include "public/platform/modules/vr/WebVRClient.h" |
| +#include "wtf/Noncopyable.h" |
| + |
| +namespace blink { |
| + |
| +class VRGetDevicesRequest { |
| + WTF_MAKE_NONCOPYABLE(VRGetDevicesRequest); |
|
haraken
2016/03/22 02:39:20
Add USING_FAST_MALLOC().
RaviKasibhatla
2016/03/23 15:20:50
Done.
|
| +public: |
| + explicit VRGetDevicesRequest(WebVRGetDevicesCallback* callback); |
| + ~VRGetDevicesRequest(); |
| + WebVRGetDevicesCallback* get_devices_callback() const; |
| + |
| +private: |
| + WebVRGetDevicesCallback* get_devices_callback_; |
|
haraken
2016/03/22 02:39:20
How is it guaranteed that the WebVRGetDevicesCallb
RaviKasibhatla
2016/03/23 15:20:50
The original web caller actually transfers the res
|
| +}; |
| + |
| +class PLATFORM_EXPORT VRDispatcher : public GarbageCollectedFinalized<VRDispatcher>, public WebVRClient { |
| + WTF_MAKE_NONCOPYABLE(VRDispatcher); |
| + public: |
| + static WebVRClient* create(); |
| + ~VRDispatcher() override; |
| + |
| + // WebVRClient implementation. |
| + void getDevices(WebVRGetDevicesCallback* callback) override; |
| + |
| + void getSensorState(unsigned int index, |
| + WebHMDSensorState& state) override; |
| + |
| + void resetSensor(unsigned int index) override; |
| + |
| + DEFINE_INLINE_TRACE() { } |
| + |
| + private: |
| + VRDispatcher(); |
| + |
| + // Helper method that returns an initialized PermissionServicePtr. |
| + mojom::VRServicePtr& GetVRServicePtr(); |
| + |
| + // Callback handlers |
| + void OnGetDevices(VRGetDevicesRequest* device_request,//int* request_id, |
|
haraken
2016/03/22 02:39:20
Remove the comment and add a TODO?
RaviKasibhatla
2016/03/23 15:20:51
Done.
|
| + const mojo::Array<mojom::VRDeviceInfoPtr>& devices); |
| + void OnGetSensorState(WebHMDSensorState* state, |
| + const mojom::VRSensorStatePtr& mojo_state); |
| + |
| + mojom::VRServicePtr vr_service_; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // BLINK_PLATFORM_VR_VR_DISPATCHER_H_ |