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.
5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_
6 #define CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_
8 #include "content/browser/device_sensors/data_fetcher_shared_memory_base.h"
10 #if !defined(OS_ANDROID)
11 #include "content/common/device_sensors/device_motion_hardware_buffer.h"
12 #include "content/common/device_sensors/device_orientation_hardware_buffer.h"
15 #if defined(OS_MACOSX)
16 class SuddenMotionSensor
;
18 #include <SensorsApi.h>
19 #include "base/win/scoped_comptr.h"
24 class CONTENT_EXPORT DataFetcherSharedMemory
25 : public DataFetcherSharedMemoryBase
{
28 DataFetcherSharedMemory();
29 virtual ~DataFetcherSharedMemory();
32 virtual bool Start(ConsumerType consumer_type
, void* buffer
) OVERRIDE
;
33 virtual bool Stop(ConsumerType consumer_type
) OVERRIDE
;
35 #if !defined(OS_ANDROID)
36 DeviceMotionHardwareBuffer
* motion_buffer_
;
37 DeviceOrientationHardwareBuffer
* orientation_buffer_
;
39 #if defined(OS_MACOSX)
40 virtual void Fetch(unsigned consumer_bitmask
) OVERRIDE
;
41 virtual FetcherType
GetType() const OVERRIDE
;
43 scoped_ptr
<SuddenMotionSensor
> sudden_motion_sensor_
;
45 class SensorEventSink
;
46 class SensorEventSinkMotion
;
47 class SensorEventSinkOrientation
;
49 virtual FetcherType
GetType() const OVERRIDE
;
51 bool RegisterForSensor(REFSENSOR_TYPE_ID sensor_type
, ISensor
** sensor
,
52 scoped_refptr
<SensorEventSink
> event_sink
);
53 void DisableSensors(ConsumerType consumer_type
);
54 void SetBufferAvailableState(ConsumerType consumer_type
, bool enabled
);
56 base::win::ScopedComPtr
<ISensor
> sensor_inclinometer_
;
57 base::win::ScopedComPtr
<ISensor
> sensor_accelerometer_
;
58 base::win::ScopedComPtr
<ISensor
> sensor_gyrometer_
;
61 DISALLOW_COPY_AND_ASSIGN(DataFetcherSharedMemory
);
64 } // namespace content
66 #endif // CONTENT_BROWSER_DEVICE_SENSORS_DATA_FETCHER_SHARED_MEMORY_H_