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

Unified Diff: content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc

Issue 856123002: Device Orientation API on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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..7ab528e8d96e4f57fbba18a2b61dcdeec05f20ed
--- /dev/null
+++ b/content/browser/device_sensors/data_fetcher_shared_memory_chromeos.cc
@@ -0,0 +1,54 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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_.get())
timvolodine 2015/01/21 13:16:57 nit: think you can drop ".get" which results in sh
jonross 2015/01/21 16:02:10 Done.
+ sensor_manager_.reset(new SensorManagerChromeOS);
+
+ switch (consumer_type) {
+ case CONSUMER_TYPE_MOTION:
timvolodine 2015/01/21 13:16:57 is there a todo needed here? any relevant crbug?
jonross 2015/01/21 16:02:10 Added a TODO with relevant CR bug
+ return false;
+ case CONSUMER_TYPE_ORIENTATION:
+ return sensor_manager_->StartFetchingDeviceOrientationData(
+ static_cast<DeviceOrientationHardwareBuffer*>(buffer));
+ case CONSUMER_TYPE_LIGHT:
+ return false;
+ default:
+ 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();
+ }
+ if (!sensor_manager_->IsFetching())
+ sensor_manager_.reset();
+ return stopped;
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698