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

Unified Diff: content/browser/device_orientation/data_fetcher_impl_android.cc

Issue 10755002: Refactors DeviceOrientation to make it more extensible (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Handles null device_data in observer 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/data_fetcher_impl_android.cc
diff --git a/content/browser/device_orientation/data_fetcher_impl_android.cc b/content/browser/device_orientation/data_fetcher_impl_android.cc
index 03546359ae0fe8ff3e2f8638307f33d9f3408165..a5045e735a3b9486780992499f13be928be259c1 100644
--- a/content/browser/device_orientation/data_fetcher_impl_android.cc
+++ b/content/browser/device_orientation/data_fetcher_impl_android.cc
@@ -54,7 +54,17 @@ DataFetcherImplAndroid::~DataFetcherImplAndroid() {
Stop();
}
-bool DataFetcherImplAndroid::GetOrientation(Orientation* orientation) {
+DeviceData* DataFetcherImplAndroid::GetDeviceData(
+ DeviceData::Type* device_data_type) {
hans 2012/07/18 17:21:02 feel free to just call the parameter 'type' here i
aousterh 2012/07/20 11:18:52 Done.
+ switch (device_data_type) {
hans 2012/07/18 17:21:02 i'd just use an if-else.
aousterh 2012/07/20 11:18:52 Done.
+ case DeviceData::kTypeOrientation:
+ return GetOrientation();
+ default:
+ return NULL;
+ }
+}
+
+Orientation* DataFetcherImplAndroid::GetOrientation() {
// Do we have a new orientation value? (It's safe to do this outside the lock
// because we only skip the lock if the value is null. We always enter the
// lock if we're going to make use of the new value.)
@@ -62,9 +72,10 @@ bool DataFetcherImplAndroid::GetOrientation(Orientation* orientation) {
base::AutoLock autolock(next_orientation_lock_);
next_orientation_.swap(current_orientation_);
}
+ scoped_ptr<Orientation> orientation(new Orientation());
if (current_orientation_.get())
*orientation = *current_orientation_;
- return true;
+ return orientation.release();
}
void DataFetcherImplAndroid::GotOrientation(

Powered by Google App Engine
This is Rietveld 408576698