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 |
22 void VRDevice::AddDisplay(VRDisplayImpl* display) { | 28 void VRDevice::AddDisplay(VRDisplayImpl* display) { |
23 displays_.insert(display); | 29 displays_.insert(display); |
24 } | 30 } |
25 | 31 |
26 void VRDevice::RemoveDisplay(VRDisplayImpl* display) { | 32 void VRDevice::RemoveDisplay(VRDisplayImpl* display) { |
27 if (CheckPresentingDisplay(display)) | 33 if (CheckPresentingDisplay(display)) |
28 ExitPresent(); | 34 ExitPresent(); |
29 displays_.erase(display); | 35 displays_.erase(display); |
30 } | 36 } |
31 | 37 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { | 83 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { |
78 for (auto* display : displays_) | 84 for (auto* display : displays_) |
79 display->client()->OnDeactivate(reason); | 85 display->client()->OnDeactivate(reason); |
80 } | 86 } |
81 | 87 |
82 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) { | 88 void VRDevice::SetPresentingDisplay(VRDisplayImpl* display) { |
83 presenting_display_ = display; | 89 presenting_display_ = display; |
84 } | 90 } |
85 | 91 |
86 } // namespace device | 92 } // namespace device |
OLD | NEW |