Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc

Issue 680383007: DeviceOrientation API on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/device_sensors/sensor_manager_chromeos.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" 5 #include "content/browser/device_sensors/data_fetcher_shared_memory.h"
6 6
7 #include "base/logging.h" 7 #include "content/browser/device_sensors/sensor_manager_chromeos.h"
8 #include "content/browser/device_sensors/sensor_manager_android.h"
9 #include "content/common/device_sensors/device_light_hardware_buffer.h"
10 #include "content/common/device_sensors/device_motion_hardware_buffer.h"
11 #include "content/common/device_sensors/device_orientation_hardware_buffer.h"
12 8
13 namespace content { 9 namespace content {
14 10
15 DataFetcherSharedMemory::DataFetcherSharedMemory() { 11 DataFetcherSharedMemory::DataFetcherSharedMemory() {
16 } 12 }
17 13
18 DataFetcherSharedMemory::~DataFetcherSharedMemory() { 14 DataFetcherSharedMemory::~DataFetcherSharedMemory() {
19 } 15 }
20 16
21 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { 17 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
22 DCHECK(buffer); 18 DCHECK(buffer);
23
24 switch (consumer_type) { 19 switch (consumer_type) {
25 case CONSUMER_TYPE_MOTION: 20 case CONSUMER_TYPE_MOTION:
26 return SensorManagerAndroid::GetInstance()-> 21 return false;
27 StartFetchingDeviceMotionData(
28 static_cast<DeviceMotionHardwareBuffer*>(buffer));
29 case CONSUMER_TYPE_ORIENTATION: 22 case CONSUMER_TYPE_ORIENTATION:
30 return SensorManagerAndroid::GetInstance()-> 23 return SensorManagerChromeOS::GetInstance()
31 StartFetchingDeviceOrientationData( 24 ->StartFetchingDeviceOrientationData(
32 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); 25 static_cast<DeviceOrientationHardwareBuffer*>(buffer));
33 case CONSUMER_TYPE_LIGHT: 26 case CONSUMER_TYPE_LIGHT:
34 return SensorManagerAndroid::GetInstance()->StartFetchingDeviceLightData( 27 return false;
35 static_cast<DeviceLightHardwareBuffer*>(buffer));
36 default: 28 default:
37 NOTREACHED(); 29 NOTREACHED();
38 } 30 }
39 return false; 31 return false;
40 } 32 }
41 33
42 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { 34 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
43 switch (consumer_type) { 35 switch (consumer_type) {
44 case CONSUMER_TYPE_MOTION: 36 case CONSUMER_TYPE_MOTION:
45 SensorManagerAndroid::GetInstance()->StopFetchingDeviceMotionData(); 37 return false;
46 return true;
47 case CONSUMER_TYPE_ORIENTATION: 38 case CONSUMER_TYPE_ORIENTATION:
48 SensorManagerAndroid::GetInstance()->StopFetchingDeviceOrientationData(); 39 SensorManagerChromeOS::GetInstance()->StopFetchingDeviceOrientationData();
49 return true; 40 return true;
50 case CONSUMER_TYPE_LIGHT: 41 case CONSUMER_TYPE_LIGHT:
51 SensorManagerAndroid::GetInstance()->StopFetchingDeviceLightData(); 42 return false;
52 return true;
53 default: 43 default:
54 NOTREACHED(); 44 NOTREACHED();
55 } 45 }
56 return false; 46 return false;
57 } 47 }
58 48
59 } // namespace content 49 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/device_sensors/sensor_manager_chromeos.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698