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

Unified Diff: device/vr/android/gvr/gvr_device.cc

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 side-by-side diff with in-line comments
Download patch
Index: device/vr/android/gvr/gvr_device.cc
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc
index f3eebd59c73aa5acbea725c52c065e584428d15d..b6003218477150e6919adbd5b3e1c256d6d25f1b 100644
--- a/device/vr/android/gvr/gvr_device.cc
+++ b/device/vr/android/gvr/gvr_device.cc
@@ -24,7 +24,10 @@ static const uint64_t kPredictionTimeWithoutVsyncNanos = 50000000;
} // namespace
GvrDevice::GvrDevice(VRDeviceProvider* provider, GvrDelegate* delegate)
- : VRDevice(provider), delegate_(delegate) {}
+ : VRDevice(provider),
+ delegate_(delegate),
+ isConnected_(false),
+ isConnectionStatusChanged_(false) {}
GvrDevice::~GvrDevice() {}
@@ -163,4 +166,19 @@ void GvrDevice::UpdateLayerBounds(VRLayerBoundsPtr leftBounds,
rightBounds->width, rightBounds->height);
}
+// It will poll status from device and resolve it.
+void GvrDevice::PollEvents(VRClientDispatcher* client) {
+ if (isConnectionStatusChanged_) {
+ client->OnDeviceConnectionStatusChanged(this, isConnected_);
bajones 2016/09/09 05:53:00 Let's call this in UpdateConnectionStatus and avoi
+ isConnectionStatusChanged_ = false;
+ }
+}
+
+void GvrDevice::UpdateConnectionStatus(bool isConnected) {
+ if (isConnected_ != isConnected) {
+ isConnected_ = isConnected;
+ isConnectionStatusChanged_ = true;
+ }
+}
+
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698