Index: content/browser/device_orientation/provider_impl.h |
diff --git a/content/browser/device_orientation/provider_impl.h b/content/browser/device_orientation/provider_impl.h |
index c7c12eb4dce6651e6dc315caa3a91e08a239ffd5..2d276187bf8ea2bb9fbe5fd3850dfbde344ba644 100644 |
--- a/content/browser/device_orientation/provider_impl.h |
+++ b/content/browser/device_orientation/provider_impl.h |
@@ -8,11 +8,12 @@ |
#include <set> |
#include <vector> |
+#include "base/id_map.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/weak_ptr.h" |
#include "base/time.h" |
#include "content/browser/device_orientation/data_fetcher.h" |
-#include "content/browser/device_orientation/orientation.h" |
+#include "content/browser/device_orientation/device_data.h" |
#include "content/browser/device_orientation/provider.h" |
#include "content/common/content_export.h" |
@@ -29,7 +30,7 @@ class ProviderImpl : public Provider { |
typedef DataFetcher* (*DataFetcherFactory)(); |
// Create a ProviderImpl that uses the NULL-terminated factories array to find |
- // a DataFetcher that can provide orientation data. |
+ // a DataFetcher that can provide data. |
CONTENT_EXPORT ProviderImpl(const DataFetcherFactory factories[]); |
// From Provider. |
@@ -43,23 +44,28 @@ class ProviderImpl : public Provider { |
void Start(); |
void Stop(); |
+ // Method for adding a type of observer to poll. Runs on the polling_thread_. |
+ void DoAddObserverType(DeviceData::DeviceDataType device_data_type); |
+ void ScheduleDoAddObserverType(DeviceData::DeviceDataType device_data_type); |
+ |
// Method for finding a suitable DataFetcher and starting the polling. |
// Runs on the polling_thread_. |
void DoInitializePollingThread( |
- const std::vector<DataFetcherFactory>& factories); |
- void ScheduleInitializePollingThread(); |
+ const std::vector<DataFetcherFactory>& factories, |
+ DeviceData::DeviceDataType device_data_type); |
+ void ScheduleInitializePollingThread( |
+ DeviceData::DeviceDataType device_data_type); |
// Method for polling a DataFetcher. Runs on the polling_thread_. |
void DoPoll(); |
void ScheduleDoPoll(); |
- // Method for notifying observers of an orientation update. |
+ // Method for notifying observers of a data update. |
// Runs on the creator_thread_. |
- void DoNotify(const Orientation& orientation); |
- void ScheduleDoNotify(const Orientation& orientation); |
- |
- static bool SignificantlyDifferent(const Orientation& orientation1, |
- const Orientation& orientation2); |
+ void DoNotify(const DeviceData* device_data, |
+ DeviceData::DeviceDataType device_data_type); |
+ void ScheduleDoNotify(const DeviceData* device_data, |
+ DeviceData::DeviceDataType device_data_type); |
enum { kDesiredSamplingIntervalMs = 100 }; |
base::TimeDelta SamplingInterval() const; |
@@ -71,13 +77,14 @@ class ProviderImpl : public Provider { |
// Members below are only to be used from the creator_loop_. |
std::vector<DataFetcherFactory> factories_; |
std::set<Observer*> observers_; |
- Orientation last_notification_; |
+ IDMap<DeviceData, IDMapOwnPointer> last_notifications_map_; |
// When polling_thread_ is running, members below are only to be used |
// from that thread. |
scoped_ptr<DataFetcher> data_fetcher_; |
- Orientation last_orientation_; |
+ scoped_ptr<IDMap<DeviceData, IDMapOwnPointer> > last_device_data_map_; |
base::WeakPtrFactory<ProviderImpl> weak_factory_; |
+ std::set<DeviceData::DeviceDataType> observer_types_; |
// Polling is done on this background thread. |
scoped_ptr<base::Thread> polling_thread_; |