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

Unified Diff: content/public/browser/sensor_manager_delegate.h

Issue 680383007: DeviceOrientation API on ChromeOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove implementation details from content/public/browser 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: content/public/browser/sensor_manager_delegate.h
diff --git a/content/public/browser/sensor_manager_delegate.h b/content/public/browser/sensor_manager_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..5c46a696146f29ee986303f28d9976606079fa0b
--- /dev/null
+++ b/content/public/browser/sensor_manager_delegate.h
@@ -0,0 +1,50 @@
+// 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 CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_
+#define CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_
+
+#include "base/callback.h"
+#include "base/macros.h"
+#include "content/common/content_export.h"
+
+template <typename T>
+struct DefaultSingletonTraits;
+
+namespace content {
+
+// For platforms with a push API for accelerometer sensors this delegate can be
+// implemented. Once notified to start fetching data, the callback provided can
+// be used to send the data.
+class CONTENT_EXPORT SensorManagerDelegate {
+ public:
+ SensorManagerDelegate();
+ virtual ~SensorManagerDelegate();
+
+ // Returns the SensorManagerDelegate singleton
+ static SensorManagerDelegate* GetInstance();
+
+ // True if a SensorManagerDelegate has been set.
+ static bool HasInstance();
+
+ // Allows platforms to provide a delegate.
+ static void SetDelegate(SensorManagerDelegate* delegate);
+
+ // Start processing accelerometer events for orientation. The values can be
+ // passed via |callback|
+ virtual void StartFetchingDeviceOrientationData(
+ const base::Callback<void(double, double, double)>& callback) = 0;
flackr 2014/11/13 00:07:34 Can you typedef this callback type? Include x, y,
jonross 2014/11/13 01:34:05 Done.
+
+ // Stop processing accelerometer events for orientation.
+ virtual void StopFetchingDeviceOrientationData() = 0;
+
+ private:
+ static SensorManagerDelegate* delegate_;
+
+ DISALLOW_COPY_AND_ASSIGN(SensorManagerDelegate);
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_DELEGATE_H_

Powered by Google App Engine
This is Rietveld 408576698