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

Unified Diff: device/vr/vr_device_manager.cc

Issue 2783993002: Send vrdisplayactivate to the most recently focused navigator listening for displayactivate. (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « device/vr/vr_device_manager.h ('k') | device/vr/vr_display_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_device_manager.cc
diff --git a/device/vr/vr_device_manager.cc b/device/vr/vr_device_manager.cc
index 249b3c9259ccfa8208f218a67c8a590e83bc5273..994f202f2f05262f0300b981443eb032f1edf6a1 100644
--- a/device/vr/vr_device_manager.cc
+++ b/device/vr/vr_device_manager.cc
@@ -95,7 +95,7 @@ void VRDeviceManager::AddService(VRServiceImpl* service) {
void VRDeviceManager::RemoveService(VRServiceImpl* service) {
if (service->listening_for_activate()) {
- ListeningForActivateChanged(false);
+ ListeningForActivateChanged(false, service);
}
services_.erase(service);
@@ -112,9 +112,14 @@ unsigned int VRDeviceManager::GetNumberOfConnectedDevices() {
return static_cast<unsigned int>(devices_.size());
}
-void VRDeviceManager::ListeningForActivateChanged(bool listening) {
+void VRDeviceManager::ListeningForActivateChanged(bool listening,
+ VRServiceImpl* service) {
DCHECK(thread_checker_.CalledOnValidThread());
+ if (listening) {
+ most_recently_listening_for_activate_ = service;
+ }
+
bool activate_listeners = listening;
if (!activate_listeners) {
for (auto* service : services_) {
@@ -133,6 +138,13 @@ void VRDeviceManager::ListeningForActivateChanged(bool listening) {
}
}
+bool VRDeviceManager::IsMostRecentlyListeningForActivate(
+ VRServiceImpl* service) {
+ if (!service)
+ return false;
+ return service == most_recently_listening_for_activate_;
+}
+
VRDevice* VRDeviceManager::GetDevice(unsigned int index) {
DCHECK(thread_checker_.CalledOnValidThread());
« no previous file with comments | « device/vr/vr_device_manager.h ('k') | device/vr/vr_display_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698