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

Unified Diff: content/browser/device_orientation/provider.h

Issue 10698046: Implements part of Device Motion in the Renderer (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Makes changes suggested by review comments Created 8 years, 5 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_orientation/provider.h
diff --git a/content/browser/device_orientation/provider.h b/content/browser/device_orientation/provider.h
index 39ec86007db1ff891627086b72caa1e9fa8a463f..208100da17896ae1e82d956a8962b81110d5da0e 100644
--- a/content/browser/device_orientation/provider.h
+++ b/content/browser/device_orientation/provider.h
@@ -10,11 +10,22 @@
namespace device_orientation {
+class Motion;
class Orientation;
class CONTENT_EXPORT Provider : public base::RefCountedThreadSafe<Provider> {
public:
- class Observer {
+ // TODO(aousterh): refactor this so that there is only one type of observer
+ // that can handle multiple types of data (motion, orientation, etc.)
+ class MotionObserver {
+ public:
+ virtual void OnMotionUpdate(const Motion& motion) = 0;
+
+ protected:
+ virtual ~MotionObserver() {}
+ };
+
+ class OrientationObserver {
Steve Block 2012/07/04 13:58:24 You might want to do the Oberver -> OrientationObs
public:
// Called when the orientation changes.
// An Observer must not synchronously call Provider::RemoveObserver
@@ -22,7 +33,7 @@ class CONTENT_EXPORT Provider : public base::RefCountedThreadSafe<Provider> {
virtual void OnOrientationUpdate(const Orientation& orientation) = 0;
protected:
- virtual ~Observer() {}
+ virtual ~OrientationObserver() {}
};
// Returns a pointer to the singleton instance of this class.
@@ -39,10 +50,13 @@ class CONTENT_EXPORT Provider : public base::RefCountedThreadSafe<Provider> {
// Get the current instance. Used for testing.
static Provider* GetInstanceForTests();
- // Note: AddObserver may call back synchronously to the observer with
- // orientation data.
- virtual void AddObserver(Observer* observer) = 0;
- virtual void RemoveObserver(Observer* observer) = 0;
+ // Note: AddMotionObserver and AddOrientationObserver may call back
+ // synchronously to the observer with data.
+ virtual void AddMotionObserver(MotionObserver* observer) = 0;
+ virtual void AddOrientationObserver(OrientationObserver* observer) = 0;
+
+ virtual void RemoveMotionObserver(MotionObserver* observer) = 0;
+ virtual void RemoveOrientationObserver(OrientationObserver* observer) = 0;
protected:
Provider();

Powered by Google App Engine
This is Rietveld 408576698