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

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

Issue 2317483002: Add support of vrdisplayconnect and vrdisplaydisconnect event (Closed)
Patch Set: fix missing brace 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 87fea396354c6aee52faa57ee75ec9d40fd90b47..48635b8115b27556955cbafcf94327d32334128b 100644
--- a/third_party/WebKit/Source/modules/vr/VRController.cpp
+++ b/third_party/WebKit/Source/modules/vr/VRController.cpp
@@ -177,6 +177,28 @@ void VRController::OnExitPresent(unsigned index)
vrDisplay->forceExitPresent();
}
+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
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRController.h ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698