| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 var last_position = 0; | 5 var last_position = 0; |
| 6 var last_error = 0; | 6 var last_error = 0; |
| 7 var watch_id = 0; | 7 var watch_id = 0; |
| 8 var position_initialized = false; | 8 var position_initialized = false; |
| 9 var position_updated = false; | 9 var position_updated = false; |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 navigator.geolocation.watchPosition( | 45 navigator.geolocation.watchPosition( |
| 46 geoSuccessCallbackWithResponse, geoErrorCallbackWithResponse, | 46 geoSuccessCallbackWithResponse, geoErrorCallbackWithResponse, |
| 47 {maximumAge:600000, timeout:100000, enableHighAccuracy:true}); | 47 {maximumAge:600000, timeout:100000, enableHighAccuracy:true}); |
| 48 } | 48 } |
| 49 function geoStartWithSyncResponse() { | 49 function geoStartWithSyncResponse() { |
| 50 navigator.geolocation.watchPosition( | 50 navigator.geolocation.watchPosition( |
| 51 geoSuccessCallback, geoErrorCallback, | 51 geoSuccessCallback, geoErrorCallback, |
| 52 {maximumAge:600000, timeout:100000, enableHighAccuracy:true}); | 52 {maximumAge:600000, timeout:100000, enableHighAccuracy:true}); |
| 53 sendString('requested'); | 53 sendString('requested'); |
| 54 } | 54 } |
| 55 function checkIfGeopositionUpdated() { | |
| 56 if (position_updated) | |
| 57 sendString('geoposition-updated'); | |
| 58 } | |
| 59 function geoGetLastPositionLatitude() { | 55 function geoGetLastPositionLatitude() { |
| 60 return "" + last_position.coords.latitude; | 56 return "" + last_position.coords.latitude; |
| 61 } | 57 } |
| 62 function geoGetLastPositionLongitude() { | 58 function geoGetLastPositionLongitude() { |
| 63 return "" + last_position.coords.longitude; | 59 return "" + last_position.coords.longitude; |
| 64 } | 60 } |
| 65 function geoGetLastError() { | 61 function geoGetLastError() { |
| 66 return "" + (last_error ? last_error.code : 0); | 62 return "" + (last_error ? last_error.code : 0); |
| 67 } | 63 } |
| 68 function geoAccessNavigatorGeolocation() { | 64 function geoAccessNavigatorGeolocation() { |
| 69 return "" + typeof(navigator.geolocation); | 65 return "" + typeof(navigator.geolocation); |
| 70 } | 66 } |
| OLD | NEW |