1 // Copyright (c) 2013 Intel Corporation. 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 XWALK_TIZEN_MOBILE_SENSOR_TIZEN_DATA_FETCHER_SHARED_MEMORY_H_
6 #define XWALK_TIZEN_MOBILE_SENSOR_TIZEN_DATA_FETCHER_SHARED_MEMORY_H_
8 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
9 #include "xwalk/tizen/mobile/sensor/sensor_provider.h"
13 // This class receives sensor data from SensorProvider, and put them into
14 // a block of memory which is shared between xwalk and renderer processes.
15 class TizenDataFetcherSharedMemory : public content::DataFetcherSharedMemory,
16 public SensorProvider::Observer {
18 TizenDataFetcherSharedMemory();
19 virtual ~TizenDataFetcherSharedMemory();
22 // From content::DataFetcherSharedMemory
23 bool Start(content::ConsumerType type, void* buffer) override;
24 bool Stop(content::ConsumerType type) override;
26 // From SensorProvider::Observer
27 void OnOrientationChanged(float alpha,
30 void OnAccelerationChanged(float raw_x, float raw_y, float raw_z,
31 float x, float y, float z) override;
32 void OnRotationRateChanged(float alpha,
36 content::DeviceMotionHardwareBuffer* motion_buffer_;
37 content::DeviceOrientationHardwareBuffer* orientation_buffer_;
39 DISALLOW_COPY_AND_ASSIGN(TizenDataFetcherSharedMemory);
44 #endif // XWALK_TIZEN_MOBILE_SENSOR_TIZEN_DATA_FETCHER_SHARED_MEMORY_H_