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 "base/id_map.h" | |
9 #include "content/common/vr_service.mojom.h" | |
10 #include "platform/PlatformExport.h" | |
11 #include "public/platform/modules/vr/WebVRClient.h" | |
12 #include "wtf/Noncopyable.h" | |
13 | |
14 namespace blink { | |
15 | |
16 class PLATFORM_EXPORT VRDispatcher : public WebVRClient { | |
17 WTF_MAKE_NONCOPYABLE(VRDispatcher); | |
18 public: | |
19 static WebVRClient* create(); | |
20 ~VRDispatcher() override; | |
21 | |
22 // WebVRClient implementation. | |
23 void getDevices(WebVRGetDevicesCallback* callback) override; | |
24 | |
25 void getSensorState(unsigned int index, | |
26 WebHMDSensorState& state) override; | |
27 | |
28 void resetSensor(unsigned int index) override; | |
29 | |
30 private: | |
31 VRDispatcher(); | |
32 | |
33 // Helper method that returns an initialized PermissionServicePtr. | |
34 content::VRServicePtr& GetVRServicePtr(); | |
35 | |
36 // Callback handlers | |
37 void OnGetDevices(int* request_id, | |
38 const mojo::Array<content::VRDeviceInfoPtr>& devices); | |
39 void OnGetSensorState(WebHMDSensorState* state, | |
40 const content::VRSensorStatePtr& mojo_state); | |
41 | |
42 // Tracks requests sent to browser to match replies with callbacks. | |
43 // Owns callback objects. | |
44 IDMap<WebVRGetDevicesCallback, IDMapOwnPointer> pending_requests_; | |
haraken
2016/03/19 00:45:18
Hmm, IDMap looks nasty.
Can we introduce a new ob
RaviKasibhatla
2016/03/21 15:12:01
Done.
| |
45 | |
46 content::VRServicePtr vr_service_; | |
47 }; | |
48 | |
49 } // namespace blink | |
50 | |
51 #endif // BLINK_PLATFORM_VR_VR_DISPATCHER_H_ | |
OLD | NEW |