Index: content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc |
diff --git a/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc b/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e40809a9287e720695b79d00db311c4f4ed0d7d1 |
--- /dev/null |
+++ b/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc |
@@ -0,0 +1,53 @@ |
+// 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.
|
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/device_sensors/data_fetcher_shared_memory.h" |
+ |
+#include "content/browser/device_sensors/sensor_manager_chromeos.h" |
+ |
+namespace content { |
+ |
+DataFetcherSharedMemory::DataFetcherSharedMemory() { |
+} |
+ |
+DataFetcherSharedMemory::~DataFetcherSharedMemory() { |
+} |
+ |
+bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { |
+ DCHECK(buffer); |
+ if (!sensor_manager_) |
+ sensor_manager_.reset(new SensorManagerChromeOS); |
+ |
+ switch (consumer_type) { |
+ case CONSUMER_TYPE_MOTION: |
+ // TODO(jonross): Implement Device Motion API. (crbug.com/427662) |
timvolodine
2015/01/26 15:29:07
nit: add NOTIMPLEMENTED()?
|
+ return false; |
+ case CONSUMER_TYPE_ORIENTATION: |
+ return sensor_manager_->StartFetchingDeviceOrientationData( |
+ static_cast<DeviceOrientationHardwareBuffer*>(buffer)); |
+ case CONSUMER_TYPE_LIGHT: |
+ return false; |
timvolodine
2015/01/26 15:29:07
nit: NOTIMPLEMENTED?
jonross
2015/01/26 16:40:04
Done.
|
+ 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.
|
+ NOTREACHED(); |
+ } |
+ return false; |
+} |
+ |
+bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { |
+ bool stopped = false; |
+ switch (consumer_type) { |
+ case CONSUMER_TYPE_MOTION: |
+ break; |
+ case CONSUMER_TYPE_ORIENTATION: |
+ stopped = sensor_manager_->StopFetchingDeviceOrientationData(); |
+ break; |
+ case CONSUMER_TYPE_LIGHT: |
+ break; |
+ default: |
+ 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.
|
+ } |
+ return stopped; |
+} |
+ |
+} // namespace content |