| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "device/vr/vr_device.h" | 8 #include "device/vr/vr_device.h" |
| 9 #include "device/vr/vr_device_manager.h" |
| 9 #include "device/vr/vr_service_impl.h" | 10 #include "device/vr/vr_service_impl.h" |
| 10 | 11 |
| 11 namespace device { | 12 namespace device { |
| 12 | 13 |
| 13 VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, | 14 VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, |
| 14 VRServiceImpl* service, | 15 VRServiceImpl* service, |
| 15 mojom::VRServiceClient* service_client, | 16 mojom::VRServiceClient* service_client, |
| 16 mojom::VRDisplayInfoPtr display_info) | 17 mojom::VRDisplayInfoPtr display_info) |
| 17 : binding_(this), | 18 : binding_(this), |
| 18 device_(device), | 19 device_(device), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 void VRDisplayImpl::OnBlur() { | 40 void VRDisplayImpl::OnBlur() { |
| 40 client_->OnBlur(); | 41 client_->OnBlur(); |
| 41 } | 42 } |
| 42 | 43 |
| 43 void VRDisplayImpl::OnFocus() { | 44 void VRDisplayImpl::OnFocus() { |
| 44 client_->OnFocus(); | 45 client_->OnFocus(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 void VRDisplayImpl::OnActivate(mojom::VRDisplayEventReason reason) { | 48 void VRDisplayImpl::OnActivate(mojom::VRDisplayEventReason reason) { |
| 49 VRDeviceManager* manager = VRDeviceManager::GetInstance(); |
| 50 if (!manager->IsMostRecentlyListeningForActivate(service_)) |
| 51 return; |
| 48 client_->OnActivate(reason); | 52 client_->OnActivate(reason); |
| 49 } | 53 } |
| 50 | 54 |
| 51 void VRDisplayImpl::OnDeactivate(mojom::VRDisplayEventReason reason) { | 55 void VRDisplayImpl::OnDeactivate(mojom::VRDisplayEventReason reason) { |
| 52 client_->OnDeactivate(reason); | 56 client_->OnDeactivate(reason); |
| 53 } | 57 } |
| 54 | 58 |
| 55 void VRDisplayImpl::ResetPose() { | 59 void VRDisplayImpl::ResetPose() { |
| 56 if (!device_->IsAccessAllowed(this)) | 60 if (!device_->IsAccessAllowed(this)) |
| 57 return; | 61 return; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 source_height); | 112 source_height); |
| 109 } | 113 } |
| 110 | 114 |
| 111 void VRDisplayImpl::GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) { | 115 void VRDisplayImpl::GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) { |
| 112 if (!device_->IsAccessAllowed(this)) { | 116 if (!device_->IsAccessAllowed(this)) { |
| 113 return; | 117 return; |
| 114 } | 118 } |
| 115 device_->GetVRVSyncProvider(std::move(request)); | 119 device_->GetVRVSyncProvider(std::move(request)); |
| 116 } | 120 } |
| 117 } | 121 } |
| OLD | NEW |