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