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 #ifndef DEVICE_VR_VR_DEVICE_H | 5 #ifndef DEVICE_VR_VR_DEVICE_H |
6 #define DEVICE_VR_VR_DEVICE_H | 6 #define DEVICE_VR_VR_DEVICE_H |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "device/vr/vr_export.h" | 10 #include "device/vr/vr_export.h" |
11 #include "device/vr/vr_service.mojom.h" | 11 #include "device/vr/vr_service.mojom.h" |
12 | 12 |
13 namespace device { | 13 namespace device { |
14 | 14 |
15 class VRDisplayImpl; | 15 class VRDisplayImpl; |
16 | 16 |
17 const unsigned int VR_DEVICE_LAST_ID = 0xFFFFFFFF; | 17 const unsigned int VR_DEVICE_LAST_ID = 0xFFFFFFFF; |
18 | 18 |
| 19 // Represents one of the platform's VR devices. Owned by the respective |
| 20 // VRDeviceProvider. |
19 class DEVICE_VR_EXPORT VRDevice { | 21 class DEVICE_VR_EXPORT VRDevice { |
20 public: | 22 public: |
21 VRDevice(); | 23 VRDevice(); |
22 virtual ~VRDevice(); | 24 virtual ~VRDevice(); |
23 | 25 |
24 unsigned int id() const { return id_; } | 26 unsigned int id() const { return id_; } |
25 | 27 |
26 virtual void GetVRDevice( | 28 // Queries VR device for display info and calls onCreated once the display |
27 const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback) = 0; | 29 // info object is created. If the query fails onCreated will be called with a |
| 30 // nullptr as argument. onCreated can be called before this function returns. |
| 31 virtual void CreateVRDisplayInfo( |
| 32 const base::Callback<void(mojom::VRDisplayInfoPtr)>& onCreated) = 0; |
28 virtual void ResetPose() = 0; | 33 virtual void ResetPose() = 0; |
29 | 34 |
30 virtual void RequestPresent(const base::Callback<void(bool)>& callback) = 0; | 35 virtual void RequestPresent(const base::Callback<void(bool)>& callback) = 0; |
31 virtual void SetSecureOrigin(bool secure_origin) = 0; | 36 virtual void SetSecureOrigin(bool secure_origin) = 0; |
32 virtual void ExitPresent() = 0; | 37 virtual void ExitPresent() = 0; |
33 virtual void SubmitFrame(mojom::VRPosePtr pose) = 0; | 38 virtual void SubmitFrame(mojom::VRPosePtr pose) = 0; |
34 virtual void UpdateLayerBounds(int16_t frame_index, | 39 virtual void UpdateLayerBounds(int16_t frame_index, |
35 mojom::VRLayerBoundsPtr left_bounds, | 40 mojom::VRLayerBoundsPtr left_bounds, |
36 mojom::VRLayerBoundsPtr right_bounds) = 0; | 41 mojom::VRLayerBoundsPtr right_bounds) = 0; |
37 virtual void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) = 0; | 42 virtual void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) = 0; |
(...skipping 29 matching lines...) Expand all Loading... |
67 static unsigned int next_id_; | 72 static unsigned int next_id_; |
68 | 73 |
69 base::WeakPtrFactory<VRDevice> weak_ptr_factory_; | 74 base::WeakPtrFactory<VRDevice> weak_ptr_factory_; |
70 | 75 |
71 DISALLOW_COPY_AND_ASSIGN(VRDevice); | 76 DISALLOW_COPY_AND_ASSIGN(VRDevice); |
72 }; | 77 }; |
73 | 78 |
74 } // namespace device | 79 } // namespace device |
75 | 80 |
76 #endif // DEVICE_VR_VR_DEVICE_H | 81 #endif // DEVICE_VR_VR_DEVICE_H |
OLD | NEW |