blob: 237223a33182046b2079d0ac9fcfb1e1b3280a9a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_VR_OPENXR_OPENXR_DEVICE_H_
#define DEVICE_VR_OPENXR_OPENXR_DEVICE_H_
#include <memory>
#include "base/macros.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/vr_device_base.h"
#include "device/vr/vr_export.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
namespace device {
class OpenXrRenderLoop;
class OpenXrStatics;
class DEVICE_VR_EXPORT OpenXrDevice
: public VRDeviceBase,
public mojom::XRSessionController,
public mojom::XRCompositorHost {
public:
OpenXrDevice(OpenXrStatics* openxr_statics);
~OpenXrDevice() override;
// VRDeviceBase
void RequestSession(
mojom::XRRuntimeSessionOptionsPtr options,
mojom::XRRuntime::RequestSessionCallback callback) override;
mojo::PendingRemote<mojom::XRCompositorHost> BindCompositorHost();
private:
// XRSessionController
void SetFrameDataRestricted(bool restricted) override;
// XRCompositorHost
void CreateImmersiveOverlay(
mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver) override;
void EnsureRenderLoop();
void OnRequestSessionResult(mojom::XRRuntime::RequestSessionCallback callback,
bool result,
mojom::XRSessionPtr session);
void OnPresentingControllerMojoConnectionError();
std::unique_ptr<OpenXrRenderLoop> render_loop_;
mojo::Receiver<mojom::XRSessionController> exclusive_controller_receiver_{
this};
mojo::Receiver<mojom::XRCompositorHost> compositor_host_receiver_{this};
mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver_;
base::WeakPtrFactory<OpenXrDevice> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(OpenXrDevice);
};
} // namespace device
#endif // DEVICE_VR_OPENXR_OPENXR_DEVICE_H_
|