OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLINK_PLATFORM_VR_VR_DISPATCHER_H_ | |
6 #define BLINK_PLATFORM_VR_VR_DISPATCHER_H_ | |
7 | |
8 #include "platform/PlatformExport.h" | |
9 #include "public/platform/modules/vr/vr_service.mojom.h" | |
10 #include "public/platform/modules/vr/WebVRClient.h" | |
11 #include "wtf/Noncopyable.h" | |
12 | |
13 namespace blink { | |
14 | |
15 class VRGetDevicesRequest { | |
16 WTF_MAKE_NONCOPYABLE(VRGetDevicesRequest); | |
haraken
2016/03/22 02:39:20
Add USING_FAST_MALLOC().
RaviKasibhatla
2016/03/23 15:20:50
Done.
| |
17 public: | |
18 explicit VRGetDevicesRequest(WebVRGetDevicesCallback* callback); | |
19 ~VRGetDevicesRequest(); | |
20 WebVRGetDevicesCallback* get_devices_callback() const; | |
21 | |
22 private: | |
23 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
| |
24 }; | |
25 | |
26 class PLATFORM_EXPORT VRDispatcher : public GarbageCollectedFinalized<VRDispatch er>, public WebVRClient { | |
27 WTF_MAKE_NONCOPYABLE(VRDispatcher); | |
28 public: | |
29 static WebVRClient* create(); | |
30 ~VRDispatcher() override; | |
31 | |
32 // WebVRClient implementation. | |
33 void getDevices(WebVRGetDevicesCallback* callback) override; | |
34 | |
35 void getSensorState(unsigned int index, | |
36 WebHMDSensorState& state) override; | |
37 | |
38 void resetSensor(unsigned int index) override; | |
39 | |
40 DEFINE_INLINE_TRACE() { } | |
41 | |
42 private: | |
43 VRDispatcher(); | |
44 | |
45 // Helper method that returns an initialized PermissionServicePtr. | |
46 mojom::VRServicePtr& GetVRServicePtr(); | |
47 | |
48 // Callback handlers | |
49 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.
| |
50 const mojo::Array<mojom::VRDeviceInfoPtr>& devices); | |
51 void OnGetSensorState(WebHMDSensorState* state, | |
52 const mojom::VRSensorStatePtr& mojo_state); | |
53 | |
54 mojom::VRServicePtr vr_service_; | |
55 }; | |
56 | |
57 } // namespace blink | |
58 | |
59 #endif // BLINK_PLATFORM_VR_VR_DISPATCHER_H_ | |
OLD | NEW |