Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / xwalk / tizen / mobile / sensor / tizen_data_fetcher_shared_memory.h
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.
4
5 #ifndef XWALK_TIZEN_MOBILE_SENSOR_TIZEN_DATA_FETCHER_SHARED_MEMORY_H_
6 #define XWALK_TIZEN_MOBILE_SENSOR_TIZEN_DATA_FETCHER_SHARED_MEMORY_H_
7
8 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
9 #include "xwalk/tizen/mobile/sensor/sensor_provider.h"
10
11 namespace xwalk {
12
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 {
17  public:
18   TizenDataFetcherSharedMemory();
19   virtual ~TizenDataFetcherSharedMemory();
20
21  private:
22   // From content::DataFetcherSharedMemory
23   bool Start(content::ConsumerType type, void* buffer) override;
24   bool Stop(content::ConsumerType type) override;
25
26   // From SensorProvider::Observer
27   void OnOrientationChanged(float alpha,
28                             float beta,
29                             float roll) override;
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,
33                              float beta,
34                              float roll) override;
35
36   content::DeviceMotionHardwareBuffer* motion_buffer_;
37   content::DeviceOrientationHardwareBuffer* orientation_buffer_;
38
39   DISALLOW_COPY_AND_ASSIGN(TizenDataFetcherSharedMemory);
40 };
41
42 }  // namespace xwalk
43
44 #endif  // XWALK_TIZEN_MOBILE_SENSOR_TIZEN_DATA_FETCHER_SHARED_MEMORY_H_