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

Unified Diff: Source/modules/geolocation/Geolocation.cpp

Issue 745503002: Replace Dictionary with PositionOptions in geolocation/. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: Source/modules/geolocation/Geolocation.cpp
diff --git a/Source/modules/geolocation/Geolocation.cpp b/Source/modules/geolocation/Geolocation.cpp
index 2cb8a1bd0e5e4f4ffeb6abf25fb133386b6f0b06..f666a382664c5872ec0ac3eeb5af61e3aed1c8f4 100644
--- a/Source/modules/geolocation/Geolocation.cpp
+++ b/Source/modules/geolocation/Geolocation.cpp
@@ -154,27 +154,27 @@ void Geolocation::recordOriginTypeAccess() const
UseCounter::count(document, counter);
}
-void Geolocation::getCurrentPosition(PositionCallback* successCallback, PositionErrorCallback* errorCallback, const Dictionary& options)
+void Geolocation::getCurrentPosition(PositionCallback* successCallback, PositionErrorCallback* errorCallback, const PositionOptions& options)
{
if (!frame())
return;
recordOriginTypeAccess();
- GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCallback, PositionOptions::create(options));
+ GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCallback, options);
startRequest(notifier);
m_oneShots.add(notifier);
}
-int Geolocation::watchPosition(PositionCallback* successCallback, PositionErrorCallback* errorCallback, const Dictionary& options)
+int Geolocation::watchPosition(PositionCallback* successCallback, PositionErrorCallback* errorCallback, const PositionOptions& options)
{
if (!frame())
return 0;
recordOriginTypeAccess();
- GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCallback, PositionOptions::create(options));
+ GeoNotifier* notifier = GeoNotifier::create(this, successCallback, errorCallback, options);
startRequest(notifier);
int watchID;
@@ -193,7 +193,7 @@ void Geolocation::startRequest(GeoNotifier *notifier)
notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage));
else if (haveSuitableCachedPosition(notifier->options()))
notifier->setUseCachedPosition();
- else if (!notifier->options()->timeout())
+ else if (!notifier->options().timeout())
notifier->startTimer();
else if (!isAllowed()) {
// if we don't yet have permission, request for permission before calling startUpdating()
@@ -249,7 +249,7 @@ void Geolocation::makeCachedPositionCallbacks()
if (m_oneShots.contains(notifier))
m_oneShots.remove(notifier);
else if (m_watchers.contains(notifier)) {
- if (!notifier->options()->timeout() || startUpdating(notifier))
+ if (!notifier->options().timeout() || startUpdating(notifier))
notifier->startTimer();
else
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage));
@@ -271,15 +271,15 @@ void Geolocation::requestTimedOut(GeoNotifier* notifier)
stopUpdating();
}
-bool Geolocation::haveSuitableCachedPosition(PositionOptions* options)
+bool Geolocation::haveSuitableCachedPosition(const PositionOptions& options)
{
Geoposition* cachedPosition = lastPosition();
if (!cachedPosition)
return false;
- if (!options->maximumAge())
+ if (!options.maximumAge())
return false;
DOMTimeStamp currentTimeMillis = convertSecondsToDOMTimeStamp(currentTime());
- return cachedPosition->timestamp() > currentTimeMillis - options->maximumAge();
+ return cachedPosition->timestamp() > currentTimeMillis - options.maximumAge();
}
void Geolocation::clearWatch(int watchID)
@@ -498,7 +498,7 @@ bool Geolocation::startUpdating(GeoNotifier* notifier)
if (!frame)
return false;
- GeolocationController::from(frame)->addObserver(this, notifier->options()->enableHighAccuracy());
+ GeolocationController::from(frame)->addObserver(this, notifier->options().enableHighAccuracy());
return true;
}

Powered by Google App Engine
This is Rietveld 408576698