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

Unified Diff: ash/content/accelerometer/sensor_manager_delegate_chromeos.h

Issue 680383007: DeviceOrientation API on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reduce Singleton Usage Created 6 years, 1 month 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: ash/content/accelerometer/sensor_manager_delegate_chromeos.h
diff --git a/ash/content/accelerometer/sensor_manager_delegate_chromeos.h b/ash/content/accelerometer/sensor_manager_delegate_chromeos.h
new file mode 100644
index 0000000000000000000000000000000000000000..77d8602ddc7767467ba0dd3eec30d0d5504ca054
--- /dev/null
+++ b/ash/content/accelerometer/sensor_manager_delegate_chromeos.h
@@ -0,0 +1,42 @@
+// 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.
+
+#ifndef ASH_CONTENT_ACCELEROMETER_SENSOR_MANAGER_DELEGATE_CHROMEOS_H_
+#define ASH_CONTENT_ACCELEROMETER_SENSOR_MANAGER_DELEGATE_CHROMEOS_H_
+
+#include "content/public/browser/sensor_manager_delegate_chromeos.h"
+
+#include "ash/accelerometer/accelerometer_observer.h"
+#include "base/callback.h"
+#include "base/macros.h"
+
+namespace ash {
+
+// Chrome OS implementation of the Device Orientation API. Responsible for
+// observing accelerometer events, and notifying content::SensorManagerChromeOS.
+class SensorManagerDelegateChromeOS
+ : public AccelerometerObserver,
+ public content::SensorManagerDelegateChromeOS {
+ public:
+ SensorManagerDelegateChromeOS();
+ ~SensorManagerDelegateChromeOS() override;
+
+ // AccelerometerObserver:
+ void OnAccelerometerUpdated(const ui::AccelerometerUpdate& update) override;
+
+ // content::SensorManagerDelegateChromeOS:
+ void StartFetchingDeviceOrientationData(
+ const content::OrientationDataCallback& callback) override;
+ void StopFetchingDeviceOrientationData() override;
+
+ private:
+ // Callback to direct accelerometer events to.
+ content::OrientationDataCallback orientation_callback_;
+
+ DISALLOW_COPY_AND_ASSIGN(SensorManagerDelegateChromeOS);
+};
+
+} // namespace ash
+
+#endif // ASH_CONTENT_ACCELEROMETER_SENSOR_MANAGER_DELEGATE_CHROMEOS_H_

Powered by Google App Engine
This is Rietveld 408576698