| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "device/vr/vr_device.h" | 5 #include "device/vr/vr_device.h" |
| 6 #include "device/vr/vr_device_provider.h" | 6 #include "device/vr/vr_device_provider.h" |
| 7 #include "device/vr/vr_service_impl.h" | 7 #include "device/vr/vr_service_impl.h" |
| 8 | 8 |
| 9 namespace device { | 9 namespace device { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 void VRDevice::SetSecureOrigin(bool secure_origin) {} | 25 void VRDevice::SetSecureOrigin(bool secure_origin) {} |
| 26 | 26 |
| 27 void VRDevice::AddService(VRServiceImpl* service) { | 27 void VRDevice::AddService(VRServiceImpl* service) { |
| 28 // Create a VRDisplayImpl for this service/device pair | 28 // Create a VRDisplayImpl for this service/device pair |
| 29 VRDisplayImpl* display_impl = service->GetVRDisplayImpl(this); | 29 VRDisplayImpl* display_impl = service->GetVRDisplayImpl(this); |
| 30 displays_.insert(std::make_pair(service, display_impl)); | 30 displays_.insert(std::make_pair(service, display_impl)); |
| 31 } | 31 } |
| 32 | 32 |
| 33 void VRDevice::RemoveService(VRServiceImpl* service) { | 33 void VRDevice::RemoveService(VRServiceImpl* service) { |
| 34 displays_.erase(service); |
| 34 if (IsPresentingService(service)) | 35 if (IsPresentingService(service)) |
| 35 ExitPresent(); | 36 ExitPresent(); |
| 36 displays_.erase(service); | |
| 37 } | 37 } |
| 38 | 38 |
| 39 bool VRDevice::IsAccessAllowed(VRServiceImpl* service) { | 39 bool VRDevice::IsAccessAllowed(VRServiceImpl* service) { |
| 40 return (!presenting_service_ || presenting_service_ == service); | 40 return (!presenting_service_ || presenting_service_ == service); |
| 41 } | 41 } |
| 42 | 42 |
| 43 bool VRDevice::IsPresentingService(VRServiceImpl* service) { | 43 bool VRDevice::IsPresentingService(VRServiceImpl* service) { |
| 44 return (presenting_service_ && presenting_service_ == service); | 44 return (presenting_service_ && presenting_service_ == service); |
| 45 } | 45 } |
| 46 | 46 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { | 79 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { |
| 80 for (const auto& display : displays_) | 80 for (const auto& display : displays_) |
| 81 display.second->client()->OnDeactivate(reason); | 81 display.second->client()->OnDeactivate(reason); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void VRDevice::SetPresentingService(VRServiceImpl* service) { | 84 void VRDevice::SetPresentingService(VRServiceImpl* service) { |
| 85 presenting_service_ = service; | 85 presenting_service_ = service; |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace device | 88 } // namespace device |
| OLD | NEW |