Index: ash/accelerometer/sensor_manager_delegate_chromeos.h |
diff --git a/ash/accelerometer/sensor_manager_delegate_chromeos.h b/ash/accelerometer/sensor_manager_delegate_chromeos.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8fe4af578adf84e966ec17575eb4382f1694be4d |
--- /dev/null |
+++ b/ash/accelerometer/sensor_manager_delegate_chromeos.h |
@@ -0,0 +1,44 @@ |
+// 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_ACCELEROMETER_SENSOR_MANAGER_DELEGATE_CHROMEOS_H_ |
+#define ASH_ACCELEROMETER_SENSOR_MANAGER_DELEGATE_CHROMEOS_H_ |
+ |
+#include "content/public/browser/sensor_manager_delegate.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::SensorManagerDelegate { |
+ public: |
+ SensorManagerDelegateChromeOS(); |
+ ~SensorManagerDelegateChromeOS() override; |
+ |
+ // AccelerometerObserver: |
+ void OnAccelerometerUpdated(const ui::AccelerometerUpdate& update) override; |
+ |
+ // content::SensorManagerDelegate: |
+ void StartFetchingDeviceOrientationData( |
+ const base::Callback<void(double, double, double)>& callback) override; |
+ void StopFetchingDeviceOrientationData() override; |
+ |
+ private: |
+ // Callback to direct accelerometer events to. |
+ base::Callback<void(double, double, double)> orientation_callback_; |
+ |
+ // True if actively observing events. |
+ bool observing_accelerometer_; |
flackr
2014/11/13 00:07:34
This should be the same as orientation_callback_.i
jonross
2014/11/13 01:34:05
Done.
|
+ |
+ DISALLOW_COPY_AND_ASSIGN(SensorManagerDelegateChromeOS); |
+}; |
+ |
+} // namespace ash |
+ |
+#endif // ASH_ACCELEROMETER_SENSOR_MANAGER_DELEGATE_CHROMEOS_H_ |