1 // Copyright 2015 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 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
7 #include "content/browser/device_sensors/sensor_manager_chromeos.h"
11 DataFetcherSharedMemory::DataFetcherSharedMemory() {
14 DataFetcherSharedMemory::~DataFetcherSharedMemory() {
17 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type
, void* buffer
) {
20 sensor_manager_
.reset(new SensorManagerChromeOS
);
22 switch (consumer_type
) {
23 case CONSUMER_TYPE_MOTION
:
24 sensor_manager_
->StartFetchingDeviceMotionData(
25 static_cast<DeviceMotionHardwareBuffer
*>(buffer
));
27 case CONSUMER_TYPE_ORIENTATION
:
28 sensor_manager_
->StartFetchingDeviceOrientationData(
29 static_cast<DeviceOrientationHardwareBuffer
*>(buffer
));
31 case CONSUMER_TYPE_LIGHT
:
39 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type
) {
40 switch (consumer_type
) {
41 case CONSUMER_TYPE_MOTION
:
42 return sensor_manager_
->StopFetchingDeviceMotionData();
43 case CONSUMER_TYPE_ORIENTATION
:
44 return sensor_manager_
->StopFetchingDeviceOrientationData();
45 case CONSUMER_TYPE_LIGHT
:
53 } // namespace content