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_CHROMEOS) | 25 #if defined(OS_MACOSX) |
26 class SensorManagerChromeOS; | |
27 #elif defined(OS_MACOSX) | |
28 class AmbientLightSensor; | 26 class AmbientLightSensor; |
29 #endif | 27 #endif |
30 | 28 |
31 class CONTENT_EXPORT DataFetcherSharedMemory | 29 class CONTENT_EXPORT DataFetcherSharedMemory |
32 : public DataFetcherSharedMemoryBase { | 30 : public DataFetcherSharedMemoryBase { |
33 | 31 |
34 public: | 32 public: |
35 DataFetcherSharedMemory(); | 33 DataFetcherSharedMemory(); |
36 ~DataFetcherSharedMemory() override; | 34 ~DataFetcherSharedMemory() override; |
37 | 35 |
38 private: | 36 private: |
39 bool Start(ConsumerType consumer_type, void* buffer) override; | 37 bool Start(ConsumerType consumer_type, void* buffer) override; |
40 bool Stop(ConsumerType consumer_type) override; | 38 bool Stop(ConsumerType consumer_type) override; |
41 | 39 |
42 #if !defined(OS_ANDROID) | 40 #if !defined(OS_ANDROID) |
43 DeviceMotionHardwareBuffer* motion_buffer_; | 41 DeviceMotionHardwareBuffer* motion_buffer_; |
44 DeviceOrientationHardwareBuffer* orientation_buffer_; | 42 DeviceOrientationHardwareBuffer* orientation_buffer_; |
45 DeviceLightHardwareBuffer* light_buffer_; | 43 DeviceLightHardwareBuffer* light_buffer_; |
46 #endif | 44 #endif |
47 | 45 #if defined(OS_MACOSX) |
48 #if defined(OS_CHROMEOS) | |
49 scoped_ptr<SensorManagerChromeOS> sensor_manager_; | |
50 #elif defined(OS_MACOSX) | |
51 void Fetch(unsigned consumer_bitmask) override; | 46 void Fetch(unsigned consumer_bitmask) override; |
52 FetcherType GetType() const override; | 47 FetcherType GetType() const override; |
53 | 48 |
54 scoped_ptr<AmbientLightSensor> ambient_light_sensor_; | 49 scoped_ptr<AmbientLightSensor> ambient_light_sensor_; |
55 scoped_ptr<SuddenMotionSensor> sudden_motion_sensor_; | 50 scoped_ptr<SuddenMotionSensor> sudden_motion_sensor_; |
56 #elif defined(OS_WIN) | 51 #elif defined(OS_WIN) |
57 class SensorEventSink; | 52 class SensorEventSink; |
58 class SensorEventSinkMotion; | 53 class SensorEventSinkMotion; |
59 class SensorEventSinkOrientation; | 54 class SensorEventSinkOrientation; |
60 | 55 |
61 virtual FetcherType GetType() const override; | 56 virtual FetcherType GetType() const override; |
62 | 57 |
63 bool RegisterForSensor(REFSENSOR_TYPE_ID sensor_type, ISensor** sensor, | 58 bool RegisterForSensor(REFSENSOR_TYPE_ID sensor_type, ISensor** sensor, |
64 scoped_refptr<SensorEventSink> event_sink); | 59 scoped_refptr<SensorEventSink> event_sink); |
65 void DisableSensors(ConsumerType consumer_type); | 60 void DisableSensors(ConsumerType consumer_type); |
66 void SetBufferAvailableState(ConsumerType consumer_type, bool enabled); | 61 void SetBufferAvailableState(ConsumerType consumer_type, bool enabled); |
67 | 62 |
68 base::win::ScopedComPtr<ISensor> sensor_inclinometer_; | 63 base::win::ScopedComPtr<ISensor> sensor_inclinometer_; |
69 base::win::ScopedComPtr<ISensor> sensor_accelerometer_; | 64 base::win::ScopedComPtr<ISensor> sensor_accelerometer_; |
70 base::win::ScopedComPtr<ISensor> sensor_gyrometer_; | 65 base::win::ScopedComPtr<ISensor> sensor_gyrometer_; |
71 #endif | 66 #endif |
72 | 67 |
73 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory); | 68 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory); |
74 }; | 69 }; |
75 | 70 |
76 } // namespace content | 71 } // namespace content |
77 | 72 |
78 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ | 73 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ |
OLD | NEW |