OLD | NEW |
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 NavigatorVR_h | 5 #ifndef NavigatorVR_h |
6 #define NavigatorVR_h | 6 #define NavigatorVR_h |
7 | 7 |
8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
9 #include "core/frame/DOMWindowProperty.h" | 9 #include "core/frame/DOMWindowProperty.h" |
| 10 #include "core/frame/LocalDOMWindow.h" |
10 #include "modules/ModulesExport.h" | 11 #include "modules/ModulesExport.h" |
11 #include "modules/vr/VRDisplay.h" | 12 #include "modules/vr/VRDisplay.h" |
12 #include "modules/vr/VRDisplayEvent.h" | 13 #include "modules/vr/VRDisplayEvent.h" |
13 #include "platform/Supplementable.h" | 14 #include "platform/Supplementable.h" |
14 #include "platform/heap/Handle.h" | 15 #include "platform/heap/Handle.h" |
15 #include "public/platform/WebVector.h" | 16 #include "public/platform/WebVector.h" |
16 #include "wtf/Noncopyable.h" | 17 #include "wtf/Noncopyable.h" |
17 | 18 |
18 namespace blink { | 19 namespace blink { |
19 | 20 |
20 class Document; | 21 class Document; |
21 class Navigator; | 22 class Navigator; |
22 class VRController; | 23 class VRController; |
23 | 24 |
24 class MODULES_EXPORT NavigatorVR final | 25 class MODULES_EXPORT NavigatorVR final |
25 : public GarbageCollectedFinalized<NavigatorVR>, | 26 : public GarbageCollectedFinalized<NavigatorVR>, |
26 public Supplement<Navigator>, | 27 public Supplement<Navigator>, |
27 public DOMWindowProperty { | 28 public DOMWindowProperty, |
| 29 public LocalDOMWindow::EventListenerObserver { |
28 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVR); | 30 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVR); |
29 WTF_MAKE_NONCOPYABLE(NavigatorVR); | 31 WTF_MAKE_NONCOPYABLE(NavigatorVR); |
30 | 32 |
31 public: | 33 public: |
32 static NavigatorVR* from(Document&); | 34 static NavigatorVR* from(Document&); |
33 static NavigatorVR& from(Navigator&); | 35 static NavigatorVR& from(Navigator&); |
34 virtual ~NavigatorVR(); | 36 virtual ~NavigatorVR(); |
35 | 37 |
36 static ScriptPromise getVRDisplays(ScriptState*, Navigator&); | 38 static ScriptPromise getVRDisplays(ScriptState*, Navigator&); |
37 ScriptPromise getVRDisplays(ScriptState*); | 39 ScriptPromise getVRDisplays(ScriptState*); |
38 | 40 |
39 VRController* controller(); | 41 VRController* controller(); |
40 Document* document(); | 42 Document* document(); |
41 | 43 |
42 // Queues up event to be fired soon. | 44 // Queues up event to be fired soon. |
43 void enqueueVREvent(VRDisplayEvent*); | 45 void enqueueVREvent(VRDisplayEvent*); |
44 | 46 |
45 // Dispatches a user gesture event immediately. | 47 // Dispatches a user gesture event immediately. |
46 void dispatchVRGestureEvent(VRDisplayEvent*); | 48 void dispatchVRGestureEvent(VRDisplayEvent*); |
47 | 49 |
| 50 // Inherited from LocalDOMWindow::EventListenerObserver. |
| 51 void didAddEventListener(LocalDOMWindow*, const AtomicString&) override; |
| 52 void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) override; |
| 53 void didRemoveAllEventListeners(LocalDOMWindow*) override; |
| 54 |
48 DECLARE_VIRTUAL_TRACE(); | 55 DECLARE_VIRTUAL_TRACE(); |
49 | 56 |
50 private: | 57 private: |
51 friend class VRDisplay; | 58 friend class VRDisplay; |
52 friend class VRGetDevicesCallback; | 59 friend class VRGetDevicesCallback; |
53 | 60 |
54 explicit NavigatorVR(LocalFrame*); | 61 explicit NavigatorVR(LocalFrame*); |
55 | 62 |
56 static const char* supplementName(); | 63 static const char* supplementName(); |
57 | 64 |
58 void fireVRDisplayPresentChange(VRDisplay*); | 65 void fireVRDisplayPresentChange(VRDisplay*); |
59 | 66 |
60 Member<VRController> m_controller; | 67 Member<VRController> m_controller; |
61 }; | 68 }; |
62 | 69 |
63 } // namespace blink | 70 } // namespace blink |
64 | 71 |
65 #endif // NavigatorVR_h | 72 #endif // NavigatorVR_h |
OLD | NEW |