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

Unified Diff: device/vr/vr_device.cc

Issue 2471433002: Implement WebVR presentation pausing for VR Shell Menu Mode (Closed)
Patch Set: rebase 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
« no previous file with comments | « device/vr/vr_device.h ('k') | device/vr/vr_device_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_device.cc
diff --git a/device/vr/vr_device.cc b/device/vr/vr_device.cc
index c580d5fff4cc3eb8dceeba35a1c7ab05b33c42cc..efcd0a393c32728f71f830ef6cc652a129aa8593 100644
--- a/device/vr/vr_device.cc
+++ b/device/vr/vr_device.cc
@@ -10,8 +10,7 @@ namespace device {
unsigned int VRDevice::next_id_ = 1;
-VRDevice::VRDevice(VRDeviceProvider* provider)
- : presenting_service_(nullptr), provider_(provider), id_(next_id_) {
+VRDevice::VRDevice() : presenting_service_(nullptr), id_(next_id_) {
// Prevent wraparound. Devices with this ID will be treated as invalid.
if (next_id_ != VR_DEVICE_LAST_ID)
next_id_++;
@@ -47,20 +46,24 @@ void VRDevice::OnDisplayChanged() {
if (vr_device_info.is_null())
return;
- for (const auto& display : displays_) {
- mojom::VRDisplayClient* client = display.second->client();
- if (client)
- client->OnDisplayChanged(vr_device_info.Clone());
- }
+ for (const auto& display : displays_)
+ display.second->client()->OnDisplayChanged(vr_device_info.Clone());
}
void VRDevice::OnExitPresent(VRServiceImpl* service) {
DisplayClientMap::iterator it = displays_.find(service);
- if (it != displays_.end()) {
- mojom::VRDisplayClient* client = it->second->client();
- if (client)
- client->OnExitPresent();
- }
+ if (it != displays_.end())
+ it->second->client()->OnExitPresent();
+}
+
+void VRDevice::OnDisplayBlur() {
+ for (const auto& display : displays_)
+ display.second->client()->OnDisplayBlur();
+}
+
+void VRDevice::OnDisplayFocus() {
+ for (const auto& display : displays_)
+ display.second->client()->OnDisplayFocus();
}
} // namespace device
« no previous file with comments | « device/vr/vr_device.h ('k') | device/vr/vr_device_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698