| 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_display_impl.h" | 7 #include "device/vr/vr_display_impl.h" |
| 8 | 8 |
| 9 namespace device { | 9 namespace device { |
| 10 | 10 |
| 11 unsigned int VRDevice::next_id_ = 1; | 11 unsigned int VRDevice::next_id_ = 1; |
| 12 | 12 |
| 13 VRDevice::VRDevice() | 13 VRDevice::VRDevice() |
| 14 : presenting_display_(nullptr), id_(next_id_), weak_ptr_factory_(this) { | 14 : presenting_display_(nullptr), id_(next_id_), weak_ptr_factory_(this) { |
| 15 // Prevent wraparound. Devices with this ID will be treated as invalid. | 15 // Prevent wraparound. Devices with this ID will be treated as invalid. |
| 16 if (next_id_ != VR_DEVICE_LAST_ID) | 16 if (next_id_ != VR_DEVICE_LAST_ID) |
| 17 next_id_++; | 17 next_id_++; |
| 18 } | 18 } |
| 19 | 19 |
| 20 VRDevice::~VRDevice() {} | 20 VRDevice::~VRDevice() {} |
| 21 | 21 |
| 22 void VRDevice::RequestPresent(const base::Callback<void(bool)>& callback) { | |
| 23 callback.Run(true); | |
| 24 } | |
| 25 | |
| 26 void VRDevice::SetSecureOrigin(bool secure_origin) {} | |
| 27 | |
| 28 void VRDevice::AddDisplay(VRDisplayImpl* display) { | 22 void VRDevice::AddDisplay(VRDisplayImpl* display) { |
| 29 displays_.insert(display); | 23 displays_.insert(display); |
| 30 } | 24 } |
| 31 | 25 |
| 32 void VRDevice::RemoveDisplay(VRDisplayImpl* display) { | 26 void VRDevice::RemoveDisplay(VRDisplayImpl* display) { |
| 33 if (CheckPresentingDisplay(display)) | 27 if (CheckPresentingDisplay(display)) |
| 34 ExitPresent(); | 28 ExitPresent(); |
| 35 displays_.erase(display); | 29 displays_.erase(display); |
| 36 } | 30 } |
| 37 | 31 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { | 77 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { |
| 84 for (auto* display : displays_) | 78 for (auto* display : displays_) |
| 85 display->client()->OnDeactivate(reason); | 79 display->client()->OnDeactivate(reason); |
| 86 } | 80 } |
| 87 | 81 |
| 88 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) { | 82 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) { |
| 89 presenting_display_ = display; | 83 presenting_display_ = display; |
| 90 } | 84 } |
| 91 | 85 |
| 92 } // namespace device | 86 } // namespace device |
| OLD | NEW |