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 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.location.Criteria; | 8 import android.location.Criteria; |
9 import android.location.Location; | 9 import android.location.Location; |
10 import android.location.LocationListener; | 10 import android.location.LocationListener; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 /** | 66 /** |
67 * Start listening for location updates. | 67 * Start listening for location updates. |
68 * @param gpsEnabled Whether or not we're interested in high accuracy GP
S. | 68 * @param gpsEnabled Whether or not we're interested in high accuracy GP
S. |
69 */ | 69 */ |
70 private void start(boolean gpsEnabled) { | 70 private void start(boolean gpsEnabled) { |
71 if (!mIsRunning && !mShouldRunAfterActivityResume) { | 71 if (!mIsRunning && !mShouldRunAfterActivityResume) { |
72 // Currently idle so start listening to activity status changes. | 72 // Currently idle so start listening to activity status changes. |
73 ActivityStatus.registerStateListener(this); | 73 ActivityStatus.registerStateListener(this); |
74 } | 74 } |
75 mIsGpsEnabled = gpsEnabled; | 75 mIsGpsEnabled = gpsEnabled; |
76 if (ActivityStatus.isPaused()) { | 76 if (!ActivityStatus.isActive()) { |
77 mShouldRunAfterActivityResume = true; | 77 mShouldRunAfterActivityResume = true; |
78 } else { | 78 } else { |
79 unregisterFromLocationUpdates(); | 79 unregisterFromLocationUpdates(); |
80 registerForLocationUpdates(); | 80 registerForLocationUpdates(); |
81 } | 81 } |
82 } | 82 } |
83 | 83 |
84 /** | 84 /** |
85 * Stop listening for location updates. | 85 * Stop listening for location updates. |
86 */ | 86 */ |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 // Native functions | 261 // Native functions |
262 public static native void nativeNewLocationAvailable( | 262 public static native void nativeNewLocationAvailable( |
263 double latitude, double longitude, double timeStamp, | 263 double latitude, double longitude, double timeStamp, |
264 boolean hasAltitude, double altitude, | 264 boolean hasAltitude, double altitude, |
265 boolean hasAccuracy, double accuracy, | 265 boolean hasAccuracy, double accuracy, |
266 boolean hasHeading, double heading, | 266 boolean hasHeading, double heading, |
267 boolean hasSpeed, double speed); | 267 boolean hasSpeed, double speed); |
268 public static native void nativeNewErrorAvailable(String message); | 268 public static native void nativeNewErrorAvailable(String message); |
269 } | 269 } |
OLD | NEW |