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

Unified Diff: device/vr/vr_device.cc

Issue 2471433002: Implement WebVR presentation pausing for VR Shell Menu Mode (Closed)
Patch Set: Add comments to VRDisplay Created 4 years, 1 month 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/vr_device.cc
diff --git a/device/vr/vr_device.cc b/device/vr/vr_device.cc
index c580d5fff4cc3eb8dceeba35a1c7ab05b33c42cc..4ee151cb33bbff029cdfc1e02d029baa86aa81ba 100644
--- a/device/vr/vr_device.cc
+++ b/device/vr/vr_device.cc
@@ -10,8 +10,10 @@ namespace device {
unsigned int VRDevice::next_id_ = 1;
-VRDevice::VRDevice(VRDeviceProvider* provider)
- : presenting_service_(nullptr), provider_(provider), id_(next_id_) {
+VRDevice::VRDevice(scoped_refptr<VRDeviceProvider> provider)
+ : presenting_service_(nullptr),
+ provider_(std::move(provider)),
+ id_(next_id_) {
// Prevent wraparound. Devices with this ID will be treated as invalid.
if (next_id_ != VR_DEVICE_LAST_ID)
next_id_++;
@@ -19,6 +21,10 @@ VRDevice::VRDevice(VRDeviceProvider* provider)
VRDevice::~VRDevice() {}
+scoped_refptr<VRDeviceProvider> VRDevice::provider() const {
+ return provider_;
+}
+
bool VRDevice::RequestPresent(VRServiceImpl* service, bool secure_origin) {
return true;
};
@@ -63,4 +69,20 @@ void VRDevice::OnExitPresent(VRServiceImpl* service) {
}
}
+void VRDevice::OnDisplayBlur() {
+ for (const auto& display : displays_) {
+ mojom::VRDisplayClient* client = display.second->client();
+ if (client)
dcheng 2016/11/11 00:48:21 Does this need to null check? I believe that we bi
mthiesse 2016/11/11 20:19:21 Done.
+ client->OnDisplayBlur();
+ }
+}
+
+void VRDevice::OnDisplayFocus() {
+ for (const auto& display : displays_) {
+ mojom::VRDisplayClient* client = display.second->client();
+ if (client)
+ client->OnDisplayFocus();
+ }
+}
+
} // namespace device

Powered by Google App Engine
This is Rietveld 408576698