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

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

Issue 10755002: Refactors DeviceOrientation to make it more extensible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Moves construction of DeviceData objects out of ProviderImpl 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..9da8612b9a0be5b9eacdf6f06292bb82fe94c120 100644
--- a/content/browser/device_orientation/provider.h
+++ b/content/browser/device_orientation/provider.h
@@ -6,23 +6,25 @@
#define CONTENT_BROWSER_DEVICE_ORIENTATION_PROVIDER_H_
#include "base/memory/ref_counted.h"
+#include "content/browser/device_orientation/device_data.h"
#include "content/common/content_export.h"
namespace device_orientation {
-class Orientation;
-
class CONTENT_EXPORT Provider : public base::RefCountedThreadSafe<Provider> {
public:
class Observer {
public:
- // Called when the orientation changes.
+ // Called when device data changes.
// An Observer must not synchronously call Provider::RemoveObserver
// or Provider::AddObserver when this is called.
- virtual void OnOrientationUpdate(const Orientation& orientation) = 0;
+ virtual void OnDeviceDataUpdate(const DeviceData* device_data) = 0;
+ DeviceData::DeviceDataType device_data_type() { return device_data_type_; }
protected:
virtual ~Observer() {}
+ // Each Observer observes exactly one type of DeviceData
bulach 2012/07/12 10:43:27 nit: members must be private... please, add a cons
aousterh 2012/07/12 17:13:57 Done (regarding the private members).
+ DeviceData::DeviceDataType device_data_type_;
};
// Returns a pointer to the singleton instance of this class.
@@ -39,8 +41,7 @@ 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.
+ // Note: AddObserver may call back synchronously to the observer with data.
virtual void AddObserver(Observer* observer) = 0;
virtual void RemoveObserver(Observer* observer) = 0;

Powered by Google App Engine
This is Rietveld 408576698