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

Side by Side Diff: device/generic_sensor/platform_sensor_win.h

Issue 2447973003: [sensors] [win] Implement ambient light sensor for Windows platform (Closed)
Patch Set: Rebased to master Created 4 years, 1 month 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_GENERIC_SENSOR_PLATFORM_SENSOR_WIN_H_
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_WIN_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "device/generic_sensor/platform_sensor.h"
10 #include "device/generic_sensor/platform_sensor_reader_win.h"
11
12 namespace base {
13 class SingleThreadTaskRunner;
14 }
15
16 namespace device {
17
18 // Implementation of PlatformSensor interface for Windows platform. Instance
19 // of PlatformSensorWin is bound to IPC thread where PlatformSensorProvider is
20 // running and communication with Windows platform sensor is done through
21 // PlatformSensorReaderWin |sensor_reader_| interface which is bound to sensor
22 // thread and communicates with PlatformSensorWin using
23 // PlatformSensorReaderWin::Client interface. The error and data change events
24 // are forwarded to IPC task runner.
25 class PlatformSensorWin final : public PlatformSensor,
26 public PlatformSensorReaderWin::Client {
27 public:
28 PlatformSensorWin(
29 mojom::SensorType type,
30 mojo::ScopedSharedBufferMapping mapping,
31 PlatformSensorProvider* provider,
32 scoped_refptr<base::SingleThreadTaskRunner> sensor_thread_runner,
33 std::unique_ptr<PlatformSensorReaderWin> sensor_reader);
34
35 PlatformSensorConfiguration GetDefaultConfiguration() override;
36 mojom::ReportingMode GetReportingMode() override;
37
38 // PlatformSensorReaderWin::Client interface implementation.
39 void OnReadingUpdated(const SensorReading& reading) override;
40 void OnSensorError() override;
41
42 protected:
43 ~PlatformSensorWin() override;
44
45 // PlatformSensor interface implementation.
46 bool StartSensor(const PlatformSensorConfiguration& configuration) override;
47 void StopSensor() override;
48 bool CheckSensorConfiguration(
49 const PlatformSensorConfiguration& configuration) override;
50
51 private:
52 scoped_refptr<base::SingleThreadTaskRunner> sensor_thread_runner_;
53 PlatformSensorReaderWin* const sensor_reader_;
54 base::WeakPtrFactory<PlatformSensorWin> weak_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(PlatformSensorWin);
57 };
58
59 } // namespace device
60
61 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_WIN_H_
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor_reader_win.cc ('k') | device/generic_sensor/platform_sensor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698