| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/geolocation/location_api_adapter_android.h" | 5 #include "content/browser/geolocation/location_api_adapter_android.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "content/browser/geolocation/location_provider_android.h" | 12 #include "content/browser/geolocation/location_provider_android.h" |
| 13 #include "jni/LocationProviderAdapter_jni.h" | 13 #include "jni/LocationProviderAdapter_jni.h" |
| 14 | 14 |
| 15 using base::android::AttachCurrentThread; | 15 using base::android::AttachCurrentThread; |
| 16 using base::android::CheckException; | 16 using base::android::CheckException; |
| 17 using base::android::ClearException; | 17 using base::android::ClearException; |
| 18 using content::AndroidLocationApiAdapter; | 18 using content::AndroidLocationApiAdapter; |
| 19 | 19 |
| 20 static void NewLocationAvailable(JNIEnv* env, jclass, | 20 static void NewLocationAvailable(JNIEnv* env, |
| 21 const JavaParamRef<jclass>&, |
| 21 jdouble latitude, | 22 jdouble latitude, |
| 22 jdouble longitude, | 23 jdouble longitude, |
| 23 jdouble time_stamp, | 24 jdouble time_stamp, |
| 24 jboolean has_altitude, jdouble altitude, | 25 jboolean has_altitude, |
| 25 jboolean has_accuracy, jdouble accuracy, | 26 jdouble altitude, |
| 26 jboolean has_heading, jdouble heading, | 27 jboolean has_accuracy, |
| 27 jboolean has_speed, jdouble speed) { | 28 jdouble accuracy, |
| 29 jboolean has_heading, |
| 30 jdouble heading, |
| 31 jboolean has_speed, |
| 32 jdouble speed) { |
| 28 AndroidLocationApiAdapter::OnNewLocationAvailable(latitude, longitude, | 33 AndroidLocationApiAdapter::OnNewLocationAvailable(latitude, longitude, |
| 29 time_stamp, has_altitude, altitude, has_accuracy, accuracy, | 34 time_stamp, has_altitude, altitude, has_accuracy, accuracy, |
| 30 has_heading, heading, has_speed, speed); | 35 has_heading, heading, has_speed, speed); |
| 31 } | 36 } |
| 32 | 37 |
| 33 static void NewErrorAvailable(JNIEnv* env, jclass, jstring message) { | 38 static void NewErrorAvailable(JNIEnv* env, |
| 39 const JavaParamRef<jclass>&, |
| 40 const JavaParamRef<jstring>& message) { |
| 34 AndroidLocationApiAdapter::OnNewErrorAvailable(env, message); | 41 AndroidLocationApiAdapter::OnNewErrorAvailable(env, message); |
| 35 } | 42 } |
| 36 | 43 |
| 37 namespace content { | 44 namespace content { |
| 38 | 45 |
| 39 AndroidLocationApiAdapter::AndroidLocationApiAdapter() | 46 AndroidLocationApiAdapter::AndroidLocationApiAdapter() |
| 40 : location_provider_(NULL) { | 47 : location_provider_(NULL) { |
| 41 } | 48 } |
| 42 | 49 |
| 43 AndroidLocationApiAdapter::~AndroidLocationApiAdapter() { | 50 AndroidLocationApiAdapter::~AndroidLocationApiAdapter() { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 base::AutoLock lock(lock_); | 162 base::AutoLock lock(lock_); |
| 156 if (!task_runner_.get()) | 163 if (!task_runner_.get()) |
| 157 return; | 164 return; |
| 158 task_runner_->PostTask( | 165 task_runner_->PostTask( |
| 159 FROM_HERE, | 166 FROM_HERE, |
| 160 base::Bind(&AndroidLocationApiAdapter::NotifyProviderNewGeoposition, | 167 base::Bind(&AndroidLocationApiAdapter::NotifyProviderNewGeoposition, |
| 161 geoposition)); | 168 geoposition)); |
| 162 } | 169 } |
| 163 | 170 |
| 164 } // namespace content | 171 } // namespace content |
| OLD | NEW |