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

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: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/geolocation/geolocation_provider.cc
diff --git a/content/browser/geolocation/geolocation_provider.cc b/content/browser/geolocation/geolocation_provider.cc
index 2b626d8db0c1ae01e953ae5c1ad6eefaa6523c89..c9789b44e44219ef869e312a993c9775a3ee77af 100644
--- a/content/browser/geolocation/geolocation_provider.cc
+++ b/content/browser/geolocation/geolocation_provider.cc
@@ -21,9 +21,13 @@ void GeolocationProvider::AddObserver(GeolocationObserver* observer,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
observers_[observer] = update_options;
OnClientsChanged();
- if (position_.Validate() ||
- position_.error_code != Geoposition::ERROR_CODE_NONE)
- observer->OnLocationUpdate(position_);
+ if (ignore_location_updates_) {
+ // Position has been overridden for testing. Tests expect the observers to
+ // be called synchronously in this case.
+ if (position_.Validate() ||
+ position_.error_code != Geoposition::ERROR_CODE_NONE)
+ observer->OnLocationUpdate(position_);
John Knottenbelt 2012/11/18 16:03:07 We don't want to send this if we're the first obse
+ }
}
bool GeolocationProvider::RemoveObserver(GeolocationObserver* observer) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698