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 287b63a1db9c36a59db6164419d3faaa4567c9e7..df597b2a4401734b239edd96c8b826246843c23c 100644 |
--- a/content/browser/device_orientation/data_fetcher_impl_android.cc |
+++ b/content/browser/device_orientation/data_fetcher_impl_android.cc |
@@ -7,7 +7,7 @@ |
#include "base/android/jni_android.h" |
#include "base/logging.h" |
#include "content/browser/device_orientation/orientation.h" |
-#include "jni/DeviceOrientation_jni.h" |
+#include "jni/DeviceMotionAndOrientation_jni.h" |
using base::android::AttachCurrentThread; |
@@ -23,7 +23,7 @@ const int kPeriodInMilliseconds = 100; |
DataFetcherImplAndroid::DataFetcherImplAndroid() { |
device_orientation_.Reset( |
- Java_DeviceOrientation_getInstance(AttachCurrentThread())); |
+ Java_DeviceMotionAndOrientation_getInstance(AttachCurrentThread())); |
} |
void DataFetcherImplAndroid::Init(JNIEnv* env) { |
@@ -31,9 +31,11 @@ void DataFetcherImplAndroid::Init(JNIEnv* env) { |
DCHECK(result); |
} |
+// TODO(timvolodine): figure out how to modify this method in case of |
Peter Beverloo
2013/03/12 17:11:22
What does this mean? Figuring something out does
timvolodine
2013/03/13 12:32:24
Done.
|
+// multiple event types. |
DataFetcher* DataFetcherImplAndroid::Create() { |
Miguel Garcia
2013/03/12 17:00:26
don't you want to at least change the interface no
timvolodine
2013/03/13 12:32:24
This probably goes out of scope of this CL, becaus
|
scoped_ptr<DataFetcherImplAndroid> fetcher(new DataFetcherImplAndroid); |
- if (fetcher->Start(kPeriodInMilliseconds)) |
+ if (fetcher->Start(DeviceData::kTypeOrientation, kPeriodInMilliseconds)) |
return fetcher.release(); |
LOG(ERROR) << "DataFetcherImplAndroid::Start failed!"; |
@@ -41,7 +43,9 @@ DataFetcher* DataFetcherImplAndroid::Create() { |
} |
DataFetcherImplAndroid::~DataFetcherImplAndroid() { |
- Stop(); |
+ // TODO(timvolodine): stop all active event types, not only |
Peter Beverloo
2013/03/12 17:11:22
This TODO should read "Support device motion as we
timvolodine
2013/03/13 12:32:24
Done.
|
+ // device orientation, when implemented. |
+ Stop(DeviceData::kTypeOrientation); |
} |
const DeviceData* DataFetcherImplAndroid::GetDeviceData( |
@@ -76,17 +80,36 @@ void DataFetcherImplAndroid::GotOrientation( |
next_orientation_ = orientation; |
} |
-bool DataFetcherImplAndroid::Start(int rate_in_milliseconds) { |
+void DataFetcherImplAndroid::GotAcceleration( |
+ JNIEnv*, jobject, double x, double y, double z) { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void DataFetcherImplAndroid::GotAccelerationIncludingGravity( |
+ JNIEnv*, jobject, double x, double y, double z) { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+void DataFetcherImplAndroid::GotRotationRate( |
+ JNIEnv*, jobject, double alpha, double beta, double gamma) { |
+ NOTIMPLEMENTED(); |
+} |
+ |
+bool DataFetcherImplAndroid::Start(DeviceData::Type event_type, |
+ int rate_in_milliseconds) { |
DCHECK(!device_orientation_.is_null()); |
- return Java_DeviceOrientation_start(AttachCurrentThread(), |
+ return Java_DeviceMotionAndOrientation_start(AttachCurrentThread(), |
device_orientation_.obj(), |
reinterpret_cast<jint>(this), |
+ event_type, |
Miguel Garcia
2013/03/12 17:00:26
what happened to the cast suggestion from Peter?
Peter Beverloo
2013/03/12 17:11:22
Try-jobs are running, let's see what they say. No
timvolodine
2013/03/13 12:32:24
Done.
timvolodine
2013/03/13 12:32:24
ok, added static_cast<jint>
On 2013/03/12 17:11:2
|
rate_in_milliseconds); |
} |
-void DataFetcherImplAndroid::Stop() { |
+void DataFetcherImplAndroid::Stop(DeviceData::Type event_type) { |
DCHECK(!device_orientation_.is_null()); |
- Java_DeviceOrientation_stop(AttachCurrentThread(), device_orientation_.obj()); |
+ Java_DeviceMotionAndOrientation_stop(AttachCurrentThread(), |
+ device_orientation_.obj(), |
+ event_type); |
Peter Beverloo
2013/03/12 17:11:22
Dito to my reply to Miguel's comment on line 104.
timvolodine
2013/03/13 12:32:24
Done.
|
} |
} // namespace content |