[go: nahoru, domu]

blob: 4afbc8ba217ae3a67e883dfd9e85e915fd80c1b9 [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"
11#include "base/macros.h"
12#include "device/vr/orientation/orientation_device.h"
13#include "device/vr/vr_device_provider.h"
14#include "device/vr/vr_export.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
21class DEVICE_VR_EXPORT VROrientationDeviceProvider : public VRDeviceProvider {
22 public:
Ken Rockot05499cf2019-12-12 05:22:5423 explicit VROrientationDeviceProvider(
24 mojo::PendingRemote<device::mojom::SensorProvider> sensor_provider);
Anna Maria114d35052017-12-08 23:13:2925 ~VROrientationDeviceProvider() override;
26
27 void Initialize(
Bill Orreb429222018-08-08 21:14:4328 base::RepeatingCallback<void(mojom::XRDeviceId,
Bill Orrbe7e1da2018-06-30 02:10:1429 mojom::VRDisplayInfoPtr,
Miyoung Shin3a4bd172019-10-15 02:55:0130 mojo::PendingRemote<mojom::XRRuntime>)>
31 add_device_callback,
Bill Orreb429222018-08-08 21:14:4332 base::RepeatingCallback<void(mojom::XRDeviceId)> remove_device_callback,
Anna Maria114d35052017-12-08 23:13:2933 base::OnceClosure initialization_complete) override;
34
35 bool Initialized() override;
36
37 private:
38 void DeviceInitialized();
39
40 bool initialized_ = false;
41
Miyoung Shind012ec72019-09-24 03:10:5442 mojo::Remote<device::mojom::SensorProvider> sensor_provider_;
Anna Maria114d35052017-12-08 23:13:2943
44 std::unique_ptr<VROrientationDevice> device_;
45
Miyoung Shin3a4bd172019-10-15 02:55:0146 base::RepeatingCallback<void(mojom::XRDeviceId,
47 mojom::VRDisplayInfoPtr,
48 mojo::PendingRemote<mojom::XRRuntime>)>
Bill Orrbe7e1da2018-06-30 02:10:1449 add_device_callback_;
Anna Maria114d35052017-12-08 23:13:2950 base::OnceClosure initialized_callback_;
51
52 DISALLOW_COPY_AND_ASSIGN(VROrientationDeviceProvider);
53};
54
55} // namespace device
56
57#endif // DEVICE_VR_ORIENTATION_DEVICE_PROVIDER_H