| 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 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool VRDevice::IsAccessAllowed(VRServiceImpl* service) { | 37 bool VRDevice::IsAccessAllowed(VRServiceImpl* service) { |
| 38 return (!presenting_service_ || presenting_service_ == service); | 38 return (!presenting_service_ || presenting_service_ == service); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool VRDevice::IsPresentingService(VRServiceImpl* service) { | 41 bool VRDevice::IsPresentingService(VRServiceImpl* service) { |
| 42 return (presenting_service_ && presenting_service_ == service); | 42 return (presenting_service_ && presenting_service_ == service); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void VRDevice::OnDisplayChanged() { | 45 void VRDevice::OnChanged() { |
| 46 mojom::VRDisplayInfoPtr vr_device_info = GetVRDevice(); | 46 mojom::VRDisplayInfoPtr vr_device_info = GetVRDevice(); |
| 47 if (vr_device_info.is_null()) | 47 if (vr_device_info.is_null()) |
| 48 return; | 48 return; |
| 49 | 49 |
| 50 for (const auto& display : displays_) | 50 for (const auto& display : displays_) |
| 51 display.second->client()->OnDisplayChanged(vr_device_info.Clone()); | 51 display.second->client()->OnChanged(vr_device_info.Clone()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void VRDevice::OnExitPresent() { | 54 void VRDevice::OnExitPresent() { |
| 55 DisplayClientMap::iterator it = displays_.find(presenting_service_); | 55 DisplayClientMap::iterator it = displays_.find(presenting_service_); |
| 56 if (it != displays_.end()) | 56 if (it != displays_.end()) |
| 57 it->second->client()->OnExitPresent(); | 57 it->second->client()->OnExitPresent(); |
| 58 | 58 |
| 59 SetPresentingService(nullptr); | 59 SetPresentingService(nullptr); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void VRDevice::OnDisplayBlur() { | 62 void VRDevice::OnBlur() { |
| 63 for (const auto& display : displays_) | 63 for (const auto& display : displays_) |
| 64 display.second->client()->OnDisplayBlur(); | 64 display.second->client()->OnBlur(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void VRDevice::OnDisplayFocus() { | 67 void VRDevice::OnFocus() { |
| 68 for (const auto& display : displays_) | 68 for (const auto& display : displays_) |
| 69 display.second->client()->OnDisplayFocus(); | 69 display.second->client()->OnFocus(); |
| 70 } |
| 71 |
| 72 void VRDevice::OnActivate(mojom::VRDisplayEventReason reason) { |
| 73 for (const auto& display : displays_) |
| 74 display.second->client()->OnActivate(reason); |
| 75 } |
| 76 |
| 77 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { |
| 78 for (const auto& display : displays_) |
| 79 display.second->client()->OnDeactivate(reason); |
| 70 } | 80 } |
| 71 | 81 |
| 72 void VRDevice::SetPresentingService(VRServiceImpl* service) { | 82 void VRDevice::SetPresentingService(VRServiceImpl* service) { |
| 73 presenting_service_ = service; | 83 presenting_service_ = service; |
| 74 } | 84 } |
| 75 | 85 |
| 76 } // namespace device | 86 } // namespace device |
| OLD | NEW |