Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(188)

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRController.h

Issue 1808203005: [OnionSoup] Moving VR service from content to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked as per new comments. Fixed build errors! Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef VRController_h 5 #ifndef VRController_h
6 #define VRController_h 6 #define VRController_h
7 7
8 #include "core/frame/LocalFrameLifecycleObserver.h" 8 #include "core/frame/LocalFrameLifecycleObserver.h"
9 #include "modules/ModulesExport.h" 9 #include "modules/ModulesExport.h"
10 #include "modules/vr/VRTypeConverters.h"
10 #include "platform/Supplementable.h" 11 #include "platform/Supplementable.h"
11 #include "public/platform/modules/vr/WebVR.h" 12 #include "wtf/HashSet.h"
12 #include "public/platform/modules/vr/WebVRClient.h"
13 13
14 namespace blink { 14 namespace blink {
15 15
16 class ServiceRegistry;
17 class VRGetDevicesCallback;
18
19 class VRGetDevicesRequest {
20 USING_FAST_MALLOC(VRGetDevicesRequest);
21 WTF_MAKE_NONCOPYABLE(VRGetDevicesRequest);
22 public:
23 explicit VRGetDevicesRequest(VRGetDevicesCallback*);
24 ~VRGetDevicesRequest();
25 VRGetDevicesCallback* getDevicesCallback() const;
26
27 private:
28 OwnPtr<VRGetDevicesCallback> m_getDevicesCallback;
29 };
30
16 class MODULES_EXPORT VRController final 31 class MODULES_EXPORT VRController final
17 : public GarbageCollectedFinalized<VRController> 32 : public GarbageCollectedFinalized<VRController>
18 , public Supplement<LocalFrame> 33 , public Supplement<LocalFrame>
19 , public LocalFrameLifecycleObserver { 34 , public LocalFrameLifecycleObserver {
20 USING_GARBAGE_COLLECTED_MIXIN(VRController); 35 USING_GARBAGE_COLLECTED_MIXIN(VRController);
21 WTF_MAKE_NONCOPYABLE(VRController); 36 WTF_MAKE_NONCOPYABLE(VRController);
22 public: 37 public:
23 virtual ~VRController(); 38 virtual ~VRController();
24 39
25 void getDevices(WebVRGetDevicesCallback*); 40 void getDevices(VRGetDevicesCallback*);
26 41
27 void getSensorState(unsigned index, WebHMDSensorState& into); 42 void getSensorState(unsigned index, WebHMDSensorState& into);
28 43
29 void resetSensor(unsigned index); 44 void resetSensor(unsigned index);
30 45
31 static void provideTo(LocalFrame&, WebVRClient*); 46 static void provideTo(LocalFrame&, ServiceRegistry*);
32 static VRController* from(LocalFrame&); 47 static VRController* from(LocalFrame&);
33 static const char* supplementName(); 48 static const char* supplementName();
34 49
35 DECLARE_VIRTUAL_TRACE(); 50 DECLARE_VIRTUAL_TRACE();
36 51
37 private: 52 private:
38 VRController(LocalFrame&, WebVRClient*); 53 VRController(LocalFrame&, ServiceRegistry*);
39 54
40 // Inherited from LocalFrameLifecycleObserver. 55 // Inherited from LocalFrameLifecycleObserver.
41 void willDetachFrameHost() override; 56 void willDetachFrameHost() override;
42 57
43 WebVRClient* m_client; 58 // Binding callbacks.
59 void OnGetDevices(VRGetDevicesRequest*, const mojo::Array<mojom::VRDeviceInf oPtr>&);
60 void OnGetSensorState(WebHMDSensorState*, const mojom::VRSensorStatePtr&);
61
62 WTF::HashSet<OwnPtr<VRGetDevicesRequest>> m_pendingRequests;
63 mojom::VRServicePtr m_service;
44 }; 64 };
45 65
46 } // namespace blink 66 } // namespace blink
47 67
48 #endif // VRController_h 68 #endif // VRController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698