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

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

Issue 2317483002: Add support of vrdisplayconnect and vrdisplaydisconnect event (Closed)
Patch Set: Address most comments from bajones@ Created 4 years, 3 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 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 "modules/ModulesExport.h" 10 #include "modules/ModulesExport.h"
11 #include "modules/vr/VRDisplay.h" 11 #include "modules/vr/VRDisplay.h"
12 #include "modules/vr/VRDisplayEvent.h" 12 #include "modules/vr/VRDisplayEvent.h"
13 #include "platform/AsyncMethodRunner.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 : public GarbageCollectedFinalized<Naviga torVR>, public Supplement<Navigator>, public DOMWindowProperty { 25 class MODULES_EXPORT NavigatorVR final : public GarbageCollectedFinalized<Naviga torVR>, public Supplement<Navigator>, public DOMWindowProperty {
25 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVR); 26 USING_GARBAGE_COLLECTED_MIXIN(NavigatorVR);
26 WTF_MAKE_NONCOPYABLE(NavigatorVR); 27 WTF_MAKE_NONCOPYABLE(NavigatorVR);
27 public: 28 public:
28 static NavigatorVR* from(Document&); 29 static NavigatorVR* from(Document&);
29 static NavigatorVR& from(Navigator&); 30 static NavigatorVR& from(Navigator&);
30 virtual ~NavigatorVR(); 31 virtual ~NavigatorVR();
31 32
32 static ScriptPromise getVRDisplays(ScriptState*, Navigator&); 33 static ScriptPromise getVRDisplays(ScriptState*, Navigator&);
33 ScriptPromise getVRDisplays(ScriptState*); 34 ScriptPromise getVRDisplays(ScriptState*);
34 35
35 VRController* controller(); 36 VRController* controller();
36 Document* document(); 37 Document* document();
37 38
39 void fireVREvent(VRDisplayEvent*);
40
38 DECLARE_VIRTUAL_TRACE(); 41 DECLARE_VIRTUAL_TRACE();
39 42
40 private: 43 private:
41 friend class VRDisplay; 44 friend class VRDisplay;
42 friend class VRGetDevicesCallback; 45 friend class VRGetDevicesCallback;
43 46
44 explicit NavigatorVR(LocalFrame*); 47 explicit NavigatorVR(LocalFrame*);
45 48
46 static const char* supplementName(); 49 static const char* supplementName();
47 50
48 void fireVRDisplayPresentChange(VRDisplay*); 51 void fireVRDisplayPresentChange(VRDisplay*);
49 52
53 void dispatchOneEvent();
54
55 bool isVREvent(const AtomicString&);
56
50 Member<VRController> m_controller; 57 Member<VRController> m_controller;
58 bool m_hasEventListener;
59 HeapDeque<Member<VRDisplayEvent>> m_pendingEvents;
60 Member<AsyncMethodRunner<NavigatorVR>> m_dispatchOneEventRunner;
bajones 2016/09/09 05:53:00 Looks like the only change actually needed in this
51 }; 61 };
52 62
53 } // namespace blink 63 } // namespace blink
54 64
55 #endif // NavigatorVR_h 65 #endif // NavigatorVR_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698