Chromium Code Reviews| Index: third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js |
| diff --git a/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js b/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js |
| index 208ecdc2c6eda8924cd87acd225926875505b4f2..73e6d2970f282f0a9ccd3e73e1a954c06a9345ef 100644 |
| --- a/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js |
| +++ b/third_party/WebKit/Source/devtools/front_end/emulation/Geolocation.js |
| @@ -27,11 +27,10 @@ WebInspector.Geolocation.prototype = { |
| apply: function() |
| { |
| for (var target of WebInspector.targetManager.targets(WebInspector.Target.Type.Page)) { |
| - if (this.error) |
| - target.emulationAgent().setGeolocationOverride(); |
| + if (this.error === WebInspector.Geolocation.Error.None) |
| + target.emulationAgent().setGeolocationOverride(this.latitude, this.longitude, WebInspector.Geolocation.DefaultMockAccuracy); |
| else |
| - target.emulationAgent().setGeolocationOverride(this.latitude, this.longitude, 150); |
| - |
| + target.emulationAgent().setGeolocationOverride(); |
| } |
| }, |
| @@ -55,7 +54,7 @@ WebInspector.Geolocation.parseSetting = function(value) |
| return new WebInspector.Geolocation(parseFloat(splitPosition[0]), parseFloat(splitPosition[1]), splitError[1]); |
| } |
| } |
| - return new WebInspector.Geolocation(0, 0, ""); |
| + return new WebInspector.Geolocation(0, 0, WebInspector.Geolocation.Error.None); |
| } |
| /** |
| @@ -74,8 +73,8 @@ WebInspector.Geolocation.parseUserInput = function(latitudeString, longitudeStri |
| var latitude = isLatitudeValid ? parseFloat(latitudeString) : -1; |
| var longitude = isLongitudeValid ? parseFloat(longitudeString) : -1; |
| - |
| - return new WebInspector.Geolocation(latitude, longitude, errorStatus ? "PositionUnavailable" : ""); |
| + var error = errorStatus ? WebInspector.Geolocation.Error.PositionUnavailable : WebInspector.Geolocation.Error.None; |
| + return new WebInspector.Geolocation(latitude, longitude, error); |
| } |
| /** |
| @@ -95,3 +94,11 @@ WebInspector.Geolocation.longitudeValidator = function(value) |
| { |
| return !value || (/^([+-]?[\d]+(\.\d+)?|[+-]?\.\d+)$/.test(value) && value >= -180 && value <= 180); |
| } |
| + |
| +/** @enum {string} */ |
| +WebInspector.Geolocation.Error = { |
|
lushnikov
2016/04/25 23:33:04
i think having the enum is a bit of overkill here.
luoe
2016/04/26 02:16:23
Done.
|
| + None: "None", |
| + PositionUnavailable: "PositionUnavailable" |
| +} |
| + |
| +WebInspector.Geolocation.DefaultMockAccuracy = 150; |