Index: third_party/WebKit/Source/modules/vr/NavigatorVR.cpp |
diff --git a/third_party/WebKit/Source/modules/vr/NavigatorVRDevice.cpp b/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp |
similarity index 58% |
rename from third_party/WebKit/Source/modules/vr/NavigatorVRDevice.cpp |
rename to third_party/WebKit/Source/modules/vr/NavigatorVR.cpp |
index 1b72cc4221ea5a665315719e16a4d5c6155c469b..77fae778cb8dd619c6dc2a4f99786aca195e7dee 100644 |
--- a/third_party/WebKit/Source/modules/vr/NavigatorVRDevice.cpp |
+++ b/third_party/WebKit/Source/modules/vr/NavigatorVR.cpp |
@@ -2,7 +2,7 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "modules/vr/NavigatorVRDevice.h" |
+#include "modules/vr/NavigatorVR.h" |
#include "bindings/core/v8/ScriptPromiseResolver.h" |
#include "core/dom/DOMException.h" |
@@ -12,18 +12,16 @@ |
#include "core/frame/LocalFrame.h" |
#include "core/frame/Navigator.h" |
#include "core/page/Page.h" |
-#include "modules/vr/HMDVRDevice.h" |
-#include "modules/vr/PositionSensorVRDevice.h" |
#include "modules/vr/VRController.h" |
+#include "modules/vr/VRDisplay.h" |
+#include "modules/vr/VRDisplayCollection.h" |
#include "modules/vr/VRGetDevicesCallback.h" |
-#include "modules/vr/VRHardwareUnit.h" |
-#include "modules/vr/VRHardwareUnitCollection.h" |
-#include "modules/vr/VRPositionState.h" |
+#include "modules/vr/VRPose.h" |
#include "wtf/PtrUtil.h" |
namespace blink { |
-NavigatorVRDevice* NavigatorVRDevice::from(Document& document) |
+NavigatorVR* NavigatorVR::from(Document& document) |
{ |
if (!document.frame() || !document.frame()->domWindow()) |
return 0; |
@@ -31,22 +29,22 @@ NavigatorVRDevice* NavigatorVRDevice::from(Document& document) |
return &from(navigator); |
} |
-NavigatorVRDevice& NavigatorVRDevice::from(Navigator& navigator) |
+NavigatorVR& NavigatorVR::from(Navigator& navigator) |
{ |
- NavigatorVRDevice* supplement = static_cast<NavigatorVRDevice*>(Supplement<Navigator>::from(navigator, supplementName())); |
+ NavigatorVR* supplement = static_cast<NavigatorVR*>(Supplement<Navigator>::from(navigator, supplementName())); |
if (!supplement) { |
- supplement = new NavigatorVRDevice(navigator.frame()); |
+ supplement = new NavigatorVR(navigator.frame()); |
provideTo(navigator, supplementName(), supplement); |
} |
return *supplement; |
} |
-ScriptPromise NavigatorVRDevice::getVRDevices(ScriptState* scriptState, Navigator& navigator) |
+ScriptPromise NavigatorVR::getVRDisplays(ScriptState* scriptState, Navigator& navigator) |
{ |
- return NavigatorVRDevice::from(navigator).getVRDevices(scriptState); |
+ return NavigatorVR::from(navigator).getVRDisplays(scriptState); |
} |
-ScriptPromise NavigatorVRDevice::getVRDevices(ScriptState* scriptState) |
+ScriptPromise NavigatorVR::getVRDisplays(ScriptState* scriptState) |
{ |
ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); |
ScriptPromise promise = resolver->promise(); |
@@ -59,12 +57,12 @@ ScriptPromise NavigatorVRDevice::getVRDevices(ScriptState* scriptState) |
return promise; |
} |
- controller()->getDevices(WTF::wrapUnique(new VRGetDevicesCallback(resolver, m_hardwareUnits.get()))); |
+ controller()->getDevices(WTF::wrapUnique(new VRGetDevicesCallback(resolver, m_displays.get()))); |
return promise; |
} |
-VRController* NavigatorVRDevice::controller() |
+VRController* NavigatorVR::controller() |
{ |
if (!frame()) |
return 0; |
@@ -72,23 +70,32 @@ VRController* NavigatorVRDevice::controller() |
return VRController::from(*frame()); |
} |
-DEFINE_TRACE(NavigatorVRDevice) |
+Document* NavigatorVR::document() |
{ |
- visitor->trace(m_hardwareUnits); |
+ return m_frame ? m_frame->document() : 0; |
+} |
+ |
+DEFINE_TRACE(NavigatorVR) |
+{ |
+ visitor->trace(m_displays); |
Supplement<Navigator>::trace(visitor); |
DOMWindowProperty::trace(visitor); |
} |
-NavigatorVRDevice::NavigatorVRDevice(LocalFrame* frame) |
+NavigatorVR::NavigatorVR(LocalFrame* frame) |
: DOMWindowProperty(frame) |
{ |
- m_hardwareUnits = new VRHardwareUnitCollection(this); |
+ m_displays = new VRDisplayCollection(this); |
+} |
+ |
+NavigatorVR::~NavigatorVR() |
+{ |
} |
-const char* NavigatorVRDevice::supplementName() |
+const char* NavigatorVR::supplementName() |
{ |
- return "NavigatorVRDevice"; |
+ return "NavigatorVR"; |
} |
} // namespace blink |