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

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

Issue 2317483002: Add support of vrdisplayconnect and vrdisplaydisconnect event (Closed)
Patch Set: Fix typo of Event reason 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/vr/VRController.cpp
diff --git a/third_party/WebKit/Source/modules/vr/VRController.cpp b/third_party/WebKit/Source/modules/vr/VRController.cpp
index bc92c33ec8f19e1640dee2cab9506620a542cbe6..436767e38039af013dda345f1164c46e58bc8d91 100644
--- a/third_party/WebKit/Source/modules/vr/VRController.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRController.cpp
@@ -115,6 +115,28 @@ void VRController::OnDisplayChanged(device::blink::VRDisplayPtr display)
vrDisplay->update(display);
}
+void VRController::OnDisplayConnected(device::blink::VRDisplayPtr display)
+{
+ VRDisplay* vrDisplay = createOrUpdateDisplay(display);
+ if (!vrDisplay)
+ return;
+
+ m_navigatorVR->fireVREvent(VRDisplayEvent::create(
+ EventTypeNames::vrdisplayconnect, true, false, vrDisplay, "connect"));
+}
+
+void VRController::OnDisplayDisconnected(unsigned index)
+{
+ VRDisplay* vrDisplay = getDisplayForIndex(index);
+ if (!vrDisplay)
+ return;
+
+ vrDisplay->disconnected();
+
+ m_navigatorVR->fireVREvent(VRDisplayEvent::create(
+ EventTypeNames::vrdisplaydisconnect, true, false, vrDisplay, "disconnect"));
+}
+
void VRController::contextDestroyed()
{
// If the document context was destroyed, shut down the client connection

Powered by Google App Engine
This is Rietveld 408576698