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

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

Issue 10316007: Make the Geoposition helper class public (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix forward-declaration of struct as class. Created 8 years, 8 months 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 b491826177bfe12d08e5b14498fbcb16d47ae421..d61c7c7d064244162350a2d4e0b73b35095e05b0 100644
--- a/content/browser/geolocation/geolocation_provider.cc
+++ b/content/browser/geolocation/geolocation_provider.cc
@@ -33,7 +33,8 @@ void GeolocationProvider::AddObserver(GeolocationObserver* observer,
DCHECK(OnClientThread());
observers_[observer] = update_options;
OnObserversChanged();
- if (position_.IsInitialized())
+ if (position_.Validate() ||
+ position_.error_code != content::Geoposition::ERROR_CODE_NONE)
observer->OnLocationUpdate(position_);
}
@@ -67,9 +68,11 @@ void GeolocationProvider::OnObserversChanged() {
message_loop()->PostTask(FROM_HERE, task);
}
-void GeolocationProvider::NotifyObservers(const Geoposition& position) {
+void GeolocationProvider::NotifyObservers(
+ const content::Geoposition& position) {
DCHECK(OnClientThread());
- DCHECK(position.IsInitialized());
+ DCHECK(position.Validate() ||
+ position.error_code != content::Geoposition::ERROR_CODE_NONE);
position_ = position;
ObserverMap::const_iterator it = observers_.begin();
while (it != observers_.end()) {
@@ -126,7 +129,8 @@ void GeolocationProvider::CleanUp() {
arbitrator_ = NULL;
}
-void GeolocationProvider::OnLocationUpdate(const Geoposition& position) {
+void GeolocationProvider::OnLocationUpdate(
+ const content::Geoposition& position) {
DCHECK(OnGeolocationThread());
// Will be true only in testing.
if (ignore_location_updates_)
@@ -138,7 +142,7 @@ void GeolocationProvider::OnLocationUpdate(const Geoposition& position) {
}
void GeolocationProvider::OverrideLocationForTesting(
- const Geoposition& position) {
+ const content::Geoposition& position) {
DCHECK(OnClientThread());
position_ = position;
ignore_location_updates_ = true;
« no previous file with comments | « content/browser/geolocation/geolocation_provider.h ('k') | content/browser/geolocation/geolocation_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698