forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathorientation_session.h
60 lines (48 loc) · 2.22 KB
/
orientation_session.h
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
// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_VR_ORIENTATION_ORIENTATION_SESSION_H_
#define DEVICE_VR_ORIENTATION_ORIENTATION_SESSION_H_
#include "base/component_export.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "device/vr/public/mojom/isolated_xr_service.mojom.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
namespace device {
class VROrientationDevice;
// VR device process implementation of a XRFrameDataProvider within a session
// that exposes device orientation sensors.
// VROrientationSession objects are owned by their respective
// VROrientationDevice instances.
class COMPONENT_EXPORT(VR_ORIENTATION) VROrientationSession
: public mojom::XRFrameDataProvider,
public mojom::XRSessionController {
public:
VROrientationSession(VROrientationDevice* device,
mojo::PendingReceiver<mojom::XRFrameDataProvider>,
mojo::PendingReceiver<mojom::XRSessionController>);
~VROrientationSession() override;
void GetEnvironmentIntegrationProvider(
mojo::PendingAssociatedReceiver<mojom::XREnvironmentIntegrationProvider>
environment_provider) override;
// Accessible to tests.
protected:
// mojom::XRFrameDataProvider
void GetFrameData(mojom::XRFrameDataRequestOptionsPtr options,
GetFrameDataCallback callback) override;
// mojom::XRSessionController
void SetFrameDataRestricted(bool frame_data_restricted) override;
void OnMojoConnectionError();
mojo::Receiver<mojom::XRFrameDataProvider> magic_window_receiver_;
mojo::Receiver<mojom::XRSessionController> session_controller_receiver_;
raw_ptr<device::VROrientationDevice> device_;
bool restrict_frame_data_ = true;
// This must be the last member
base::WeakPtrFactory<VROrientationSession> weak_ptr_factory_{this};
};
} // namespace device
#endif // DEVICE_VR_ORIENTATION_ORIENTATION_SESSION_H_