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

Unified Diff: third_party/WebKit/Source/modules/vr/NavigatorVR.cpp

Issue 1918143007: Updated Blink WebVR interfaces to WebVR v1 spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@webvr_mojo
Patch Set: Fixed layout test 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « third_party/WebKit/Source/modules/vr/NavigatorVR.h ('k') | third_party/WebKit/Source/modules/vr/NavigatorVR.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698