[go: nahoru, domu]

blob: 1d6e8149a883ad0205f54bc881665819a64a515b [file] [log] [blame]
Anna Maria114d35052017-12-08 23:13:291// Copyright 2017 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef DEVICE_VR_ORIENTATION_DEVICE_PROVIDER_H
6#define DEVICE_VR_ORIENTATION_DEVICE_PROVIDER_H
7
8#include <memory>
9
10#include "base/callback_forward.h"
Alexander Coopercb573b02020-04-21 22:16:3511#include "base/component_export.h"
Anna Maria114d35052017-12-08 23:13:2912#include "base/macros.h"
13#include "device/vr/orientation/orientation_device.h"
Alexander Cooper20e912c72020-04-20 22:51:2814#include "device/vr/public/cpp/vr_device_provider.h"
Miyoung Shin3a4bd172019-10-15 02:55:0115#include "mojo/public/cpp/bindings/pending_remote.h"
Miyoung Shind012ec72019-09-24 03:10:5416#include "mojo/public/cpp/bindings/remote.h"
Ke He31d0bb02018-02-24 07:16:2417#include "services/device/public/mojom/sensor_provider.mojom.h"
Anna Maria114d35052017-12-08 23:13:2918
19namespace device {
20
Alexander Coopercb573b02020-04-21 22:16:3521class COMPONENT_EXPORT(VR_ORIENTATION) VROrientationDeviceProvider
22 : public VRDeviceProvider {
Anna Maria114d35052017-12-08 23:13:2923 public:
Ken Rockot05499cf2019-12-12 05:22:5424 explicit VROrientationDeviceProvider(
25 mojo::PendingRemote<device::mojom::SensorProvider> sensor_provider);
Anna Maria114d35052017-12-08 23:13:2926 ~VROrientationDeviceProvider() override;
27
28 void Initialize(
Bill Orreb429222018-08-08 21:14:4329 base::RepeatingCallback<void(mojom::XRDeviceId,
Bill Orrbe7e1da2018-06-30 02:10:1430 mojom::VRDisplayInfoPtr,
Miyoung Shin3a4bd172019-10-15 02:55:0131 mojo::PendingRemote<mojom::XRRuntime>)>
32 add_device_callback,
Bill Orreb429222018-08-08 21:14:4333 base::RepeatingCallback<void(mojom::XRDeviceId)> remove_device_callback,
Anna Maria114d35052017-12-08 23:13:2934 base::OnceClosure initialization_complete) override;
35
36 bool Initialized() override;
37
38 private:
39 void DeviceInitialized();
40
41 bool initialized_ = false;
42
Miyoung Shind012ec72019-09-24 03:10:5443 mojo::Remote<device::mojom::SensorProvider> sensor_provider_;
Anna Maria114d35052017-12-08 23:13:2944
45 std::unique_ptr<VROrientationDevice> device_;
46
Miyoung Shin3a4bd172019-10-15 02:55:0147 base::RepeatingCallback<void(mojom::XRDeviceId,
48 mojom::VRDisplayInfoPtr,
49 mojo::PendingRemote<mojom::XRRuntime>)>
Bill Orrbe7e1da2018-06-30 02:10:1450 add_device_callback_;
Anna Maria114d35052017-12-08 23:13:2951 base::OnceClosure initialized_callback_;
52
53 DISALLOW_COPY_AND_ASSIGN(VROrientationDeviceProvider);
54};
55
56} // namespace device
57
58#endif // DEVICE_VR_ORIENTATION_DEVICE_PROVIDER_H