Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: device/vr/vr_device.cc

Issue 2510873003: Clean up WebVR RequestPresent and make callback asynchronous. (Closed)
Patch Set: Fix FakeVRDevice Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/vr/vr_device.h ('k') | device/vr/vr_display_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 unsigned int VRDevice::next_id_ = 1; 11 unsigned int VRDevice::next_id_ = 1;
12 12
13 VRDevice::VRDevice() : presenting_service_(nullptr), id_(next_id_) { 13 VRDevice::VRDevice() : presenting_service_(nullptr), id_(next_id_) {
14 // Prevent wraparound. Devices with this ID will be treated as invalid. 14 // Prevent wraparound. Devices with this ID will be treated as invalid.
15 if (next_id_ != VR_DEVICE_LAST_ID) 15 if (next_id_ != VR_DEVICE_LAST_ID)
16 next_id_++; 16 next_id_++;
17 } 17 }
18 18
19 VRDevice::~VRDevice() {} 19 VRDevice::~VRDevice() {}
20 20
21 bool VRDevice::RequestPresent(bool secure_origin) { 21 void VRDevice::RequestPresent(const base::Callback<void(bool)>& callback) {
22 return true; 22 callback.Run(true);
23 }; 23 }
24
25 void VRDevice::SetSecureOrigin(bool secure_origin) {}
24 26
25 void VRDevice::AddService(VRServiceImpl* service) { 27 void VRDevice::AddService(VRServiceImpl* service) {
26 // Create a VRDisplayImpl for this service/device pair 28 // Create a VRDisplayImpl for this service/device pair
27 VRDisplayImpl* display_impl = service->GetVRDisplayImpl(this); 29 VRDisplayImpl* display_impl = service->GetVRDisplayImpl(this);
28 displays_.insert(std::make_pair(service, display_impl)); 30 displays_.insert(std::make_pair(service, display_impl));
29 } 31 }
30 32
31 void VRDevice::RemoveService(VRServiceImpl* service) { 33 void VRDevice::RemoveService(VRServiceImpl* service) {
32 if (IsPresentingService(service)) 34 if (IsPresentingService(service))
33 ExitPresent(); 35 ExitPresent();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) { 79 void VRDevice::OnDeactivate(mojom::VRDisplayEventReason reason) {
78 for (const auto& display : displays_) 80 for (const auto& display : displays_)
79 display.second->client()->OnDeactivate(reason); 81 display.second->client()->OnDeactivate(reason);
80 } 82 }
81 83
82 void VRDevice::SetPresentingService(VRServiceImpl* service) { 84 void VRDevice::SetPresentingService(VRServiceImpl* service) {
83 presenting_service_ = service; 85 presenting_service_ = service;
84 } 86 }
85 87
86 } // namespace device 88 } // namespace device
OLDNEW
« no previous file with comments | « device/vr/vr_device.h ('k') | device/vr/vr_display_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698