Avi Drissman | 0db8484 | 2022-09-13 19:47:04 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Lei Zhang | 4d3c581 | 2021-04-21 20:31:05 | [diff] [blame] | 5 | #ifndef DEVICE_VR_ORIENTATION_ORIENTATION_DEVICE_PROVIDER_H_ |
| 6 | #define DEVICE_VR_ORIENTATION_ORIENTATION_DEVICE_PROVIDER_H_ |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 7 | |
| 8 | #include <memory> |
| 9 | |
Alexander Cooper | cb573b0 | 2020-04-21 22:16:35 | [diff] [blame] | 10 | #include "base/component_export.h" |
Avi Drissman | bb9cd02 | 2023-01-11 01:03:29 | [diff] [blame^] | 11 | #include "base/functional/callback_forward.h" |
Keishi Hattori | e175ac5 | 2022-06-07 06:24:57 | [diff] [blame] | 12 | #include "base/memory/raw_ptr.h" |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 13 | #include "device/vr/orientation/orientation_device.h" |
Alexander Cooper | 20e912c7 | 2020-04-20 22:51:28 | [diff] [blame] | 14 | #include "device/vr/public/cpp/vr_device_provider.h" |
Miyoung Shin | 3a4bd17 | 2019-10-15 02:55:01 | [diff] [blame] | 15 | #include "mojo/public/cpp/bindings/pending_remote.h" |
Miyoung Shin | d012ec7 | 2019-09-24 03:10:54 | [diff] [blame] | 16 | #include "mojo/public/cpp/bindings/remote.h" |
Ke He | 31d0bb0 | 2018-02-24 07:16:24 | [diff] [blame] | 17 | #include "services/device/public/mojom/sensor_provider.mojom.h" |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 18 | |
| 19 | namespace device { |
| 20 | |
Alexander Cooper | cb573b0 | 2020-04-21 22:16:35 | [diff] [blame] | 21 | class COMPONENT_EXPORT(VR_ORIENTATION) VROrientationDeviceProvider |
| 22 | : public VRDeviceProvider { |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 23 | public: |
Ken Rockot | 05499cf | 2019-12-12 05:22:54 | [diff] [blame] | 24 | explicit VROrientationDeviceProvider( |
| 25 | mojo::PendingRemote<device::mojom::SensorProvider> sensor_provider); |
Peter Boström | ec0e766 | 2021-09-23 21:20:57 | [diff] [blame] | 26 | |
| 27 | VROrientationDeviceProvider(const VROrientationDeviceProvider&) = delete; |
| 28 | VROrientationDeviceProvider& operator=(const VROrientationDeviceProvider&) = |
| 29 | delete; |
| 30 | |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 31 | ~VROrientationDeviceProvider() override; |
| 32 | |
Alexander Cooper | 6aa525b | 2021-12-16 21:56:34 | [diff] [blame] | 33 | void Initialize(VRDeviceProviderClient* client) override; |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 34 | |
| 35 | bool Initialized() override; |
| 36 | |
| 37 | private: |
| 38 | void DeviceInitialized(); |
| 39 | |
| 40 | bool initialized_ = false; |
| 41 | |
Miyoung Shin | d012ec7 | 2019-09-24 03:10:54 | [diff] [blame] | 42 | mojo::Remote<device::mojom::SensorProvider> sensor_provider_; |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 43 | |
| 44 | std::unique_ptr<VROrientationDevice> device_; |
Keishi Hattori | e175ac5 | 2022-06-07 06:24:57 | [diff] [blame] | 45 | raw_ptr<VRDeviceProviderClient> client_ = nullptr; |
Anna Maria | 114d3505 | 2017-12-08 23:13:29 | [diff] [blame] | 46 | }; |
| 47 | |
| 48 | } // namespace device |
| 49 | |
Lei Zhang | 4d3c581 | 2021-04-21 20:31:05 | [diff] [blame] | 50 | #endif // DEVICE_VR_ORIENTATION_ORIENTATION_DEVICE_PROVIDER_H_ |