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

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

Issue 1892083002: Generic Sensor API : Ambient Light Sensor API. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re entrancy fix Created 4 years, 6 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
« no previous file with comments | « device/sensor/sensor_export.h ('k') | device/sensor/sensor_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_SENSOR_SENSOR_IMPL_H_
6 #define DEVICE_SENSOR_SENSOR_IMPL_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "device/sensor/sensor.mojom.h"
12 #include "device/sensor/sensor_export.h"
13 #include "device/sensor/sensor_service.h"
14 #include "mojo/public/cpp/bindings/strong_binding.h"
15
16 namespace device {
17
18 class SensorImpl : public AmbientLightSensor {
19 public:
20 DEVICE_SENSOR_EXPORT static void Create(
21 mojo::InterfaceRequest<AmbientLightSensor> request);
22
23 private:
24 typedef mojo::Callback<void(AmbientLightSensorReadingPtr)>
25 SensorReadingCallback;
26
27 explicit SensorImpl(mojo::InterfaceRequest<AmbientLightSensor> request);
28 ~SensorImpl() override;
29
30 // AmbientLightSensor interface methods.
31 void QueryNextReading(const SensorReadingCallback& callback) override;
32 void StartReading() override;
33 void StopReading() override;
34
35 void DidChange(const AmbientLightSensorReading& als_reading);
36 void ReportReading();
37
38 mojo::StrongBinding<AmbientLightSensor> binding_;
39 std::unique_ptr<SensorService::SensorUpdateSubscription> subscription_;
40 SensorReadingCallback callback_;
41 AmbientLightSensorReading reading_;
42 bool reading_to_report_;
43
44 DISALLOW_COPY_AND_ASSIGN(SensorImpl);
45 };
46
47 } // namespace device
48
49 #endif // DEVICE_SENSOR_SENSOR_IMPL_H_
OLDNEW
« no previous file with comments | « device/sensor/sensor_export.h ('k') | device/sensor/sensor_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698