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

Unified Diff: content/browser/geolocation/geolocation_provider.cc

Issue 11312210: Do not send stale position in GeolocationProvider::AddObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add a test. Created 8 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: content/browser/geolocation/geolocation_provider.cc
diff --git a/content/browser/geolocation/geolocation_provider.cc b/content/browser/geolocation/geolocation_provider.cc
index 30218af9dc1d9437fceaa01d44a404af65842756..80420b9cca360660b16d5aaec76d92630b3fad7f 100644
--- a/content/browser/geolocation/geolocation_provider.cc
+++ b/content/browser/geolocation/geolocation_provider.cc
@@ -103,6 +103,9 @@ void GeolocationProvider::OnClientsChanged() {
base::Closure task;
if (observers_.empty() && callbacks_.empty()) {
DCHECK(IsRunning());
+ // We have no more observers, so we clear the cached geoposition so that
+ // when the next observer is added we will not provide a stale position.
+ position_ = Geoposition();
task = base::Bind(&GeolocationProvider::StopProviders,
base::Unretained(this));
} else {

Powered by Google App Engine
This is Rietveld 408576698