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

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: Created 4 years, 8 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_SENSOR_SENSOR_IMPL_H_
6 #define DEVICE_SENSOR_SENSOR_IMPL_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "device/sensor/sensor.mojom.h"
10 #include "device/sensor/sensor_export.h"
11 #include "device/sensor/sensor_service.h"
12 #include "mojo/public/cpp/bindings/strong_binding.h"
13
14 namespace device {
15
16 class SensorImpl : public AmbientLightSensor {
17 public:
18 DEVICE_SENSOR_EXPORT static void Create(
19 mojo::InterfaceRequest<AmbientLightSensor> request);
20
21 private:
22 typedef mojo::Callback<void(AmbientLightSensorReadingPtr)>
23 SensorReadingCallback;
24
25 explicit SensorImpl(mojo::InterfaceRequest<AmbientLightSensor> request);
26 ~SensorImpl() override;
27
28 // AmbientLightSensor interface methods.
29 void QueryNextReading(const SensorReadingCallback& callback) override;
30 void StartReading() override;
31 void StopReading() override;
32
33 void DidChange(const AmbientLightSensorReading& als_reading);
34 void ReportReading();
35
36 mojo::StrongBinding<AmbientLightSensor> binding_;
37 scoped_ptr<SensorService::SensorUpdateSubscription> subscription_;
38 SensorReadingCallback callback_;
39 AmbientLightSensorReading reading_;
40 bool reading_to_report_;
41
42 DISALLOW_COPY_AND_ASSIGN(SensorImpl);
43 };
44
45 } // namespace device
46
47 #endif // DEVICE_SENSOR_SENSOR_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698