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

Side by Side Diff: device/geolocation/android/java/src/org/chromium/device/geolocation/LocationProviderAdapter.java

Issue 2679323004: Android: Restructure geolocation folder structure (Closed)
Patch Set: Update deps Created 3 years, 10 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 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;
11 import org.chromium.base.annotations.CalledByNative; 11 import org.chromium.base.annotations.CalledByNative;
12 import org.chromium.base.annotations.MainDex; 12 import org.chromium.base.annotations.MainDex;
13 13
14 import java.util.concurrent.FutureTask; 14 import java.util.concurrent.FutureTask;
15 15
16 /** 16 /**
17 * Implements the Java side of LocationProviderAndroid. 17 * Implements the Java side of LocationProviderAndroid.
18 * Delegates all real functionality to the implementation 18 * Delegates all real functionality to the implementation
19 * returned from LocationProviderFactory. 19 * returned from LocationProviderFactory.
20 * See detailed documentation on 20 * See detailed documentation on
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
28 // Delegate handling the real work in the main thread. 27 // Delegate handling the real work in the main thread.
29 private LocationProviderFactory.LocationProvider mImpl; 28 private LocationProviderFactory.LocationProvider mImpl;
30 29
31 private LocationProviderAdapter(Context context) { 30 private LocationProviderAdapter(Context context) {
32 mImpl = LocationProviderFactory.get(context); 31 mImpl = LocationProviderFactory.get(context);
33 } 32 }
34 33
35 @CalledByNative 34 @CalledByNative
36 public static LocationProviderAdapter create(Context context) { 35 public static LocationProviderAdapter create(Context context) {
37 return new LocationProviderAdapter(context); 36 return new LocationProviderAdapter(context);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 /** 69 /**
71 * Returns true if we are currently listening for location updates, false if not. 70 * Returns true if we are currently listening for location updates, false if not.
72 * Must be called only in the UI thread. 71 * Must be called only in the UI thread.
73 */ 72 */
74 public boolean isRunning() { 73 public boolean isRunning() {
75 assert ThreadUtils.runningOnUiThread(); 74 assert ThreadUtils.runningOnUiThread();
76 return mImpl.isRunning(); 75 return mImpl.isRunning();
77 } 76 }
78 77
79 public static void newLocationAvailable(double latitude, double longitude, d ouble timestamp, 78 public static void newLocationAvailable(double latitude, double longitude, d ouble timestamp,
80 boolean hasAltitude, double altitude, 79 boolean hasAltitude, double altitude, boolean hasAccuracy, double ac curacy,
81 boolean hasAccuracy, double accuracy, 80 boolean hasHeading, double heading, boolean hasSpeed, double speed) {
82 boolean hasHeading, double heading,
83 boolean hasSpeed, double speed) {
84 nativeNewLocationAvailable(latitude, longitude, timestamp, hasAltitude, altitude, 81 nativeNewLocationAvailable(latitude, longitude, timestamp, hasAltitude, altitude,
85 hasAccuracy, accuracy, hasHeading, heading, hasSpeed, speed); 82 hasAccuracy, accuracy, hasHeading, heading, hasSpeed, speed);
86 } 83 }
87 84
88 public static void newErrorAvailable(String message) { 85 public static void newErrorAvailable(String message) {
89 nativeNewErrorAvailable(message); 86 nativeNewErrorAvailable(message);
90 } 87 }
91 88
92 // Native functions 89 // Native functions
93 private static native void nativeNewLocationAvailable( 90 private static native void nativeNewLocationAvailable(double latitude, doubl e longitude,
94 double latitude, double longitude, double timeStamp, 91 double timeStamp, boolean hasAltitude, double altitude, boolean hasA ccuracy,
95 boolean hasAltitude, double altitude, 92 double accuracy, boolean hasHeading, double heading, boolean hasSpee d, double speed);
96 boolean hasAccuracy, double accuracy,
97 boolean hasHeading, double heading,
98 boolean hasSpeed, double speed);
99 private static native void nativeNewErrorAvailable(String message); 93 private static native void nativeNewErrorAvailable(String message);
100 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698