OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ | 5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ |
6 #define CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ | 6 #define CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ |
7 | 7 |
8 #include "content/browser/device_sensors/data_fetcher_shared_memory_base.h" | 8 #include "content/browser/device_sensors/data_fetcher_shared_memory_base.h" |
9 | 9 |
10 #if !defined(OS_ANDROID) | 10 #if !defined(OS_ANDROID) |
11 #include "content/common/device_sensors/device_light_hardware_buffer.h" | 11 #include "content/common/device_sensors/device_light_hardware_buffer.h" |
12 #include "content/common/device_sensors/device_motion_hardware_buffer.h" | 12 #include "content/common/device_sensors/device_motion_hardware_buffer.h" |
13 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | 13 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" |
14 #endif | 14 #endif |
15 | 15 |
16 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
17 class SuddenMotionSensor; | 17 class SuddenMotionSensor; |
18 #elif defined(OS_WIN) | 18 #elif defined(OS_WIN) |
19 #include <SensorsApi.h> | 19 #include <SensorsApi.h> |
20 #include "base/win/scoped_comptr.h" | 20 #include "base/win/scoped_comptr.h" |
21 #endif | 21 #endif |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 | 24 |
25 #if defined(OS_MACOSX) | 25 #if defined(OS_CHROMEOS) |
| 26 class SensorManagerChromeOS; |
| 27 #elif defined(OS_MACOSX) |
26 class AmbientLightSensor; | 28 class AmbientLightSensor; |
27 #endif | 29 #endif |
28 | 30 |
29 class CONTENT_EXPORT DataFetcherSharedMemory | 31 class CONTENT_EXPORT DataFetcherSharedMemory |
30 : public DataFetcherSharedMemoryBase { | 32 : public DataFetcherSharedMemoryBase { |
31 | 33 |
32 public: | 34 public: |
33 DataFetcherSharedMemory(); | 35 DataFetcherSharedMemory(); |
34 ~DataFetcherSharedMemory() override; | 36 ~DataFetcherSharedMemory() override; |
35 | 37 |
36 private: | 38 private: |
37 bool Start(ConsumerType consumer_type, void* buffer) override; | 39 bool Start(ConsumerType consumer_type, void* buffer) override; |
38 bool Stop(ConsumerType consumer_type) override; | 40 bool Stop(ConsumerType consumer_type) override; |
39 | 41 |
40 #if !defined(OS_ANDROID) | 42 #if !defined(OS_ANDROID) |
41 DeviceMotionHardwareBuffer* motion_buffer_; | 43 DeviceMotionHardwareBuffer* motion_buffer_; |
42 DeviceOrientationHardwareBuffer* orientation_buffer_; | 44 DeviceOrientationHardwareBuffer* orientation_buffer_; |
43 DeviceLightHardwareBuffer* light_buffer_; | 45 DeviceLightHardwareBuffer* light_buffer_; |
44 #endif | 46 #endif |
45 #if defined(OS_MACOSX) | 47 |
| 48 #if defined(OS_CHROMEOS) |
| 49 scoped_ptr<SensorManagerChromeOS> sensor_manager_; |
| 50 #elif defined(OS_MACOSX) |
46 void Fetch(unsigned consumer_bitmask) override; | 51 void Fetch(unsigned consumer_bitmask) override; |
47 FetcherType GetType() const override; | 52 FetcherType GetType() const override; |
48 | 53 |
49 scoped_ptr<AmbientLightSensor> ambient_light_sensor_; | 54 scoped_ptr<AmbientLightSensor> ambient_light_sensor_; |
50 scoped_ptr<SuddenMotionSensor> sudden_motion_sensor_; | 55 scoped_ptr<SuddenMotionSensor> sudden_motion_sensor_; |
51 #elif defined(OS_WIN) | 56 #elif defined(OS_WIN) |
52 class SensorEventSink; | 57 class SensorEventSink; |
53 class SensorEventSinkMotion; | 58 class SensorEventSinkMotion; |
54 class SensorEventSinkOrientation; | 59 class SensorEventSinkOrientation; |
55 | 60 |
56 virtual FetcherType GetType() const override; | 61 virtual FetcherType GetType() const override; |
57 | 62 |
58 bool RegisterForSensor(REFSENSOR_TYPE_ID sensor_type, ISensor** sensor, | 63 bool RegisterForSensor(REFSENSOR_TYPE_ID sensor_type, ISensor** sensor, |
59 scoped_refptr<SensorEventSink> event_sink); | 64 scoped_refptr<SensorEventSink> event_sink); |
60 void DisableSensors(ConsumerType consumer_type); | 65 void DisableSensors(ConsumerType consumer_type); |
61 void SetBufferAvailableState(ConsumerType consumer_type, bool enabled); | 66 void SetBufferAvailableState(ConsumerType consumer_type, bool enabled); |
62 | 67 |
63 base::win::ScopedComPtr<ISensor> sensor_inclinometer_; | 68 base::win::ScopedComPtr<ISensor> sensor_inclinometer_; |
64 base::win::ScopedComPtr<ISensor> sensor_accelerometer_; | 69 base::win::ScopedComPtr<ISensor> sensor_accelerometer_; |
65 base::win::ScopedComPtr<ISensor> sensor_gyrometer_; | 70 base::win::ScopedComPtr<ISensor> sensor_gyrometer_; |
66 #endif | 71 #endif |
67 | 72 |
68 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory); | 73 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory); |
69 }; | 74 }; |
70 | 75 |
71 } // namespace content | 76 } // namespace content |
72 | 77 |
73 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ | 78 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ |
OLD | NEW |