OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
timvolodine
2015/01/26 15:29:07
nit: 2015?
jonross
2015/01/26 16:40:04
Done.
| |
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/browser/device_sensors/sensor_manager_chromeos.h" | |
8 | |
9 namespace content { | |
10 | |
11 DataFetcherSharedMemory::DataFetcherSharedMemory() { | |
12 } | |
13 | |
14 DataFetcherSharedMemory::~DataFetcherSharedMemory() { | |
15 } | |
16 | |
17 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { | |
18 DCHECK(buffer); | |
19 if (!sensor_manager_) | |
20 sensor_manager_.reset(new SensorManagerChromeOS); | |
21 | |
22 switch (consumer_type) { | |
23 case CONSUMER_TYPE_MOTION: | |
24 // TODO(jonross): Implement Device Motion API. (crbug.com/427662) | |
timvolodine
2015/01/26 15:29:07
nit: add NOTIMPLEMENTED()?
| |
25 return false; | |
26 case CONSUMER_TYPE_ORIENTATION: | |
27 return sensor_manager_->StartFetchingDeviceOrientationData( | |
28 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); | |
29 case CONSUMER_TYPE_LIGHT: | |
30 return false; | |
timvolodine
2015/01/26 15:29:07
nit: NOTIMPLEMENTED?
jonross
2015/01/26 16:40:04
Done.
| |
31 default: | |
timvolodine
2015/01/26 15:29:07
nit: I think it's better to not have a default her
jonross
2015/01/26 16:40:04
Done.
| |
32 NOTREACHED(); | |
33 } | |
34 return false; | |
35 } | |
36 | |
37 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { | |
38 bool stopped = false; | |
39 switch (consumer_type) { | |
40 case CONSUMER_TYPE_MOTION: | |
41 break; | |
42 case CONSUMER_TYPE_ORIENTATION: | |
43 stopped = sensor_manager_->StopFetchingDeviceOrientationData(); | |
44 break; | |
45 case CONSUMER_TYPE_LIGHT: | |
46 break; | |
47 default: | |
48 NOTREACHED(); | |
timvolodine
2015/01/26 15:29:07
nit: same here re no default case; also think you
jonross
2015/01/26 16:40:04
Done.
| |
49 } | |
50 return stopped; | |
51 } | |
52 | |
53 } // namespace content | |
OLD | NEW |