OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 package org.chromium.device.geolocation; | 5 package org.chromium.device.geolocation; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 | 8 |
9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
(...skipping 10 matching lines...) Expand all Loading... |
21 * content/browser/geolocation/location_api_adapter_android.h. | 21 * content/browser/geolocation/location_api_adapter_android.h. |
22 * Based on android.webkit.GeolocationService.java | 22 * Based on android.webkit.GeolocationService.java |
23 */ | 23 */ |
24 @MainDex | 24 @MainDex |
25 @VisibleForTesting | 25 @VisibleForTesting |
26 public class LocationProviderAdapter { | 26 public class LocationProviderAdapter { |
27 // Delegate handling the real work in the main thread. | 27 // Delegate handling the real work in the main thread. |
28 private LocationProviderFactory.LocationProvider mImpl; | 28 private LocationProviderFactory.LocationProvider mImpl; |
29 | 29 |
30 private LocationProviderAdapter(Context context) { | 30 private LocationProviderAdapter(Context context) { |
31 mImpl = LocationProviderFactory.get(context); | 31 mImpl = LocationProviderFactory.create(context); |
32 } | 32 } |
33 | 33 |
34 @CalledByNative | 34 @CalledByNative |
35 public static LocationProviderAdapter create(Context context) { | 35 public static LocationProviderAdapter create(Context context) { |
36 return new LocationProviderAdapter(context); | 36 return new LocationProviderAdapter(context); |
37 } | 37 } |
38 | 38 |
39 /** | 39 /** |
40 * Start listening for location updates until we're told to quit. May be cal
led in any thread. | 40 * Start listening for location updates until we're told to quit. May be cal
led in any thread. |
41 * @param enableHighAccuracy Whether or not to enable high accuracy location
providers. | 41 * @param enableHighAccuracy Whether or not to enable high accuracy location
providers. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 public static void newErrorAvailable(String message) { | 85 public static void newErrorAvailable(String message) { |
86 nativeNewErrorAvailable(message); | 86 nativeNewErrorAvailable(message); |
87 } | 87 } |
88 | 88 |
89 // Native functions | 89 // Native functions |
90 private static native void nativeNewLocationAvailable(double latitude, doubl
e longitude, | 90 private static native void nativeNewLocationAvailable(double latitude, doubl
e longitude, |
91 double timeStamp, boolean hasAltitude, double altitude, boolean hasA
ccuracy, | 91 double timeStamp, boolean hasAltitude, double altitude, boolean hasA
ccuracy, |
92 double accuracy, boolean hasHeading, double heading, boolean hasSpee
d, double speed); | 92 double accuracy, boolean hasHeading, double heading, boolean hasSpee
d, double speed); |
93 private static native void nativeNewErrorAvailable(String message); | 93 private static native void nativeNewErrorAvailable(String message); |
94 } | 94 } |
OLD | NEW |