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 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" |
| 6 |
| 7 #include "content/common/device_sensors/device_orientation_messages.h" |
| 8 #include "content/public/browser/sensor_manager.h" |
| 9 |
| 10 namespace content { |
| 11 |
| 12 DataFetcherSharedMemory::DataFetcherSharedMemory() { |
| 13 } |
| 14 |
| 15 DataFetcherSharedMemory::~DataFetcherSharedMemory() { |
| 16 } |
| 17 |
| 18 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { |
| 19 DCHECK(buffer); |
| 20 switch (consumer_type) { |
| 21 case CONSUMER_TYPE_MOTION: |
| 22 return false; |
| 23 case CONSUMER_TYPE_ORIENTATION: |
| 24 SensorManager::GetInstance()->StartFetchingDeviceOrientationData( |
| 25 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); |
| 26 return true; |
| 27 case CONSUMER_TYPE_LIGHT: |
| 28 return false; |
| 29 default: |
| 30 NOTREACHED(); |
| 31 } |
| 32 return false; |
| 33 } |
| 34 |
| 35 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { |
| 36 switch (consumer_type) { |
| 37 case CONSUMER_TYPE_MOTION: |
| 38 return false; |
| 39 case CONSUMER_TYPE_ORIENTATION: |
| 40 SensorManager::GetInstance()->StopFetchingDeviceOrientationData(); |
| 41 return true; |
| 42 case CONSUMER_TYPE_LIGHT: |
| 43 return false; |
| 44 default: |
| 45 NOTREACHED(); |
| 46 } |
| 47 return false; |
| 48 } |
| 49 |
| 50 } // namespace content |
OLD | NEW |