| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ | |
| 6 #define CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "build/build_config.h" | |
| 10 #include "content/browser/device_sensors/data_fetcher_shared_memory_base.h" | |
| 11 | |
| 12 #if !defined(OS_ANDROID) | |
| 13 #include "device/sensors/public/cpp/device_light_hardware_buffer.h" | |
| 14 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" | |
| 15 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" | |
| 16 #endif | |
| 17 | |
| 18 #if defined(OS_MACOSX) | |
| 19 class SuddenMotionSensor; | |
| 20 #elif defined(OS_WIN) | |
| 21 #include <SensorsApi.h> | |
| 22 #include "base/win/scoped_comptr.h" | |
| 23 #endif | |
| 24 | |
| 25 namespace content { | |
| 26 | |
| 27 #if defined(OS_CHROMEOS) | |
| 28 class SensorManagerChromeOS; | |
| 29 #elif defined(OS_MACOSX) | |
| 30 class AmbientLightSensor; | |
| 31 #endif | |
| 32 | |
| 33 class CONTENT_EXPORT DataFetcherSharedMemory | |
| 34 : public DataFetcherSharedMemoryBase { | |
| 35 | |
| 36 public: | |
| 37 DataFetcherSharedMemory(); | |
| 38 ~DataFetcherSharedMemory() override; | |
| 39 | |
| 40 #if defined(OS_ANDROID) | |
| 41 void Shutdown() override; | |
| 42 #endif | |
| 43 | |
| 44 private: | |
| 45 bool Start(ConsumerType consumer_type, void* buffer) override; | |
| 46 bool Stop(ConsumerType consumer_type) override; | |
| 47 | |
| 48 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) | |
| 49 #if !defined(OS_CHROMEOS) | |
| 50 DeviceMotionHardwareBuffer* motion_buffer_ = nullptr; | |
| 51 DeviceOrientationHardwareBuffer* orientation_buffer_ = nullptr; | |
| 52 DeviceLightHardwareBuffer* light_buffer_ = nullptr; | |
| 53 #endif | |
| 54 DeviceOrientationHardwareBuffer* orientation_absolute_buffer_ = nullptr; | |
| 55 #endif | |
| 56 | |
| 57 #if defined(OS_CHROMEOS) | |
| 58 std::unique_ptr<SensorManagerChromeOS> sensor_manager_; | |
| 59 #elif defined(OS_MACOSX) | |
| 60 void Fetch(unsigned consumer_bitmask) override; | |
| 61 FetcherType GetType() const override; | |
| 62 | |
| 63 std::unique_ptr<AmbientLightSensor> ambient_light_sensor_; | |
| 64 std::unique_ptr<SuddenMotionSensor> sudden_motion_sensor_; | |
| 65 #elif defined(OS_WIN) | |
| 66 class SensorEventSink; | |
| 67 class SensorEventSinkMotion; | |
| 68 class SensorEventSinkOrientation; | |
| 69 class SensorEventSinkLight; | |
| 70 | |
| 71 FetcherType GetType() const override; | |
| 72 | |
| 73 bool RegisterForSensor(REFSENSOR_TYPE_ID sensor_type, ISensor** sensor, | |
| 74 scoped_refptr<SensorEventSink> event_sink); | |
| 75 void DisableSensors(ConsumerType consumer_type); | |
| 76 void SetBufferAvailableState(ConsumerType consumer_type, bool enabled); | |
| 77 | |
| 78 base::win::ScopedComPtr<ISensor> sensor_inclinometer_; | |
| 79 base::win::ScopedComPtr<ISensor> sensor_inclinometer_absolute_; | |
| 80 base::win::ScopedComPtr<ISensor> sensor_accelerometer_; | |
| 81 base::win::ScopedComPtr<ISensor> sensor_gyrometer_; | |
| 82 base::win::ScopedComPtr<ISensor> sensor_light_; | |
| 83 #endif | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory); | |
| 86 }; | |
| 87 | |
| 88 } // namespace content | |
| 89 | |
| 90 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_ | |
| OLD | NEW |