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

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: Small changes to appease try bots Created 8 years, 4 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..b3106f2549d905b15dff18c0c63591eb3902f994 100644
--- a/content/browser/device_orientation/provider.h
+++ b/content/browser/device_orientation/provider.h
@@ -6,23 +6,31 @@
#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,
+ DeviceData::Type device_data_type) = 0;
+ DeviceData::Type device_data_type() { return device_data_type_; }
protected:
+ Observer(DeviceData::Type device_data_type)
+ : device_data_type_(device_data_type) {
+ }
virtual ~Observer() {}
+
+ private:
+ // Each Observer observes exactly one type of DeviceData.
+ DeviceData::Type device_data_type_;
};
// Returns a pointer to the singleton instance of this class.
@@ -39,8 +47,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;
« no previous file with comments | « content/browser/device_orientation/orientation_message_filter.cc ('k') | content/browser/device_orientation/provider_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698