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

Side by Side Diff: content/browser/geolocation/location_api_adapter_android.cc

Issue 2192683003: Revert of Reland: Geolocation: move from content/browser to device/ (patchset #2 id:20001 of https:… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2810
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
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 "device/geolocation/location_api_adapter_android.h" 5 #include "content/browser/geolocation/location_api_adapter_android.h"
6 6
7 #include "base/android/context_utils.h" 7 #include "base/android/context_utils.h"
8 #include "base/android/jni_android.h" 8 #include "base/android/jni_android.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/location.h" 11 #include "base/location.h"
12 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
13 #include "device/geolocation/location_provider_android.h" 13 #include "content/browser/geolocation/location_provider_android.h"
14 #include "jni/LocationProviderAdapter_jni.h" 14 #include "jni/LocationProviderAdapter_jni.h"
15 15
16 using base::android::AttachCurrentThread; 16 using base::android::AttachCurrentThread;
17 using base::android::CheckException; 17 using base::android::CheckException;
18 using base::android::ClearException; 18 using base::android::ClearException;
19 using device::AndroidLocationApiAdapter; 19 using content::AndroidLocationApiAdapter;
20 20
21 static void NewLocationAvailable(JNIEnv* env, 21 static void NewLocationAvailable(JNIEnv* env,
22 const JavaParamRef<jclass>&, 22 const JavaParamRef<jclass>&,
23 jdouble latitude, 23 jdouble latitude,
24 jdouble longitude, 24 jdouble longitude,
25 jdouble time_stamp, 25 jdouble time_stamp,
26 jboolean has_altitude, 26 jboolean has_altitude,
27 jdouble altitude, 27 jdouble altitude,
28 jboolean has_accuracy, 28 jboolean has_accuracy,
29 jdouble accuracy, 29 jdouble accuracy,
30 jboolean has_heading, 30 jboolean has_heading,
31 jdouble heading, 31 jdouble heading,
32 jboolean has_speed, 32 jboolean has_speed,
33 jdouble speed) { 33 jdouble speed) {
34 AndroidLocationApiAdapter::OnNewLocationAvailable(latitude, longitude, 34 AndroidLocationApiAdapter::OnNewLocationAvailable(latitude, longitude,
35 time_stamp, has_altitude, altitude, has_accuracy, accuracy, 35 time_stamp, has_altitude, altitude, has_accuracy, accuracy,
36 has_heading, heading, has_speed, speed); 36 has_heading, heading, has_speed, speed);
37 } 37 }
38 38
39 static void NewErrorAvailable(JNIEnv* env, 39 static void NewErrorAvailable(JNIEnv* env,
40 const JavaParamRef<jclass>&, 40 const JavaParamRef<jclass>&,
41 const JavaParamRef<jstring>& message) { 41 const JavaParamRef<jstring>& message) {
42 AndroidLocationApiAdapter::OnNewErrorAvailable(env, message); 42 AndroidLocationApiAdapter::OnNewErrorAvailable(env, message);
43 } 43 }
44 44
45 namespace device { 45 namespace content {
46 46
47 AndroidLocationApiAdapter::AndroidLocationApiAdapter() 47 AndroidLocationApiAdapter::AndroidLocationApiAdapter()
48 : location_provider_(NULL) { 48 : location_provider_(NULL) {
49 } 49 }
50 50
51 AndroidLocationApiAdapter::~AndroidLocationApiAdapter() { 51 AndroidLocationApiAdapter::~AndroidLocationApiAdapter() {
52 CHECK(!location_provider_); 52 CHECK(!location_provider_);
53 CHECK(!task_runner_.get()); 53 CHECK(!task_runner_.get());
54 CHECK(java_location_provider_android_object_.is_null()); 54 CHECK(java_location_provider_android_object_.is_null());
55 } 55 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 const Geoposition& geoposition) { 162 const Geoposition& geoposition) {
163 base::AutoLock lock(lock_); 163 base::AutoLock lock(lock_);
164 if (!task_runner_.get()) 164 if (!task_runner_.get())
165 return; 165 return;
166 task_runner_->PostTask( 166 task_runner_->PostTask(
167 FROM_HERE, 167 FROM_HERE,
168 base::Bind(&AndroidLocationApiAdapter::NotifyProviderNewGeoposition, 168 base::Bind(&AndroidLocationApiAdapter::NotifyProviderNewGeoposition,
169 geoposition)); 169 geoposition));
170 } 170 }
171 171
172 } // namespace device 172 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/location_api_adapter_android.h ('k') | content/browser/geolocation/location_arbitrator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698