Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(213)

Side by Side Diff: device/sensors/sensor_impl.h

Issue 2078433002: [sensors] Introduce Generic Sensor API interfaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for review comments. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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_SENSORS_SENSOR_IMPL_H_
6 #define DEVICE_SENSORS_SENSOR_IMPL_H_
7
8 #include "base/macros.h"
9 #include "device/sensors/platform_sensor.h"
10 #include "device/sensors/public/interfaces/sensor.mojom.h"
11 #include "mojo/public/cpp/bindings/strong_binding.h"
12
13 namespace device {
14 namespace mojom {
15
16 // Implementation of Sensor mojo interface.
17 // Instances of this class are created by SensorProviderImpl.
18 class SensorImpl final : public Sensor, public device::PlatformSensor::Client {
19 public:
20 SensorImpl(mojo::InterfaceRequest<Sensor> request,
21 scoped_refptr<device::PlatformSensor> sensor);
22 ~SensorImpl() override;
23
24 SensorClientRequest GetClient();
25
26 private:
27 // Sensor implementation.
28 void AddConfiguration(SensorConfigurationPtr configuration,
29 const AddConfigurationCallback& callback) override;
30 void RemoveConfiguration(
31 SensorConfigurationPtr configuration,
32 const RemoveConfigurationCallback& callback) override;
33
34 // device::Sensor::Client implementation.
35 void OnSensorReadingChanged() override;
36 void OnSensorError() override;
37
38 private:
39 scoped_refptr<device::PlatformSensor> sensor_;
40 mojo::StrongBinding<Sensor> binding_;
41 SensorClientPtr client_;
42 DISALLOW_COPY_AND_ASSIGN(SensorImpl);
43 };
44
45 } // namespace mojom
46 } // namespace device
47
48 #endif // DEVICE_SENSORS_SENSOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698