Index: chrome/browser/geolocation/core_location_provider_mac.mm |
diff --git a/chrome/browser/geolocation/core_location_provider_mac.mm b/chrome/browser/geolocation/core_location_provider_mac.mm |
index deb92c90d7130c6b50b8170e03123939b06b6823..dcef05d9842a36832fed8c7abd2d9ee971769665 100644 |
--- a/chrome/browser/geolocation/core_location_provider_mac.mm |
+++ b/chrome/browser/geolocation/core_location_provider_mac.mm |
@@ -9,7 +9,8 @@ |
#include "base/command_line.h" |
#include "chrome/common/chrome_switches.h" |
-CoreLocationProviderMac::CoreLocationProviderMac() { |
+CoreLocationProviderMac::CoreLocationProviderMac() |
+ : is_updating_(false) { |
data_provider_ = new CoreLocationDataProviderMac(); |
data_provider_->AddRef(); |
} |
@@ -20,12 +21,18 @@ CoreLocationProviderMac::~CoreLocationProviderMac() { |
} |
bool CoreLocationProviderMac::StartProvider(bool high_accuracy) { |
- data_provider_->StartUpdating(this); |
+ // StartProvider maybe called multiple times (e.g. to update the high_accuracy hint) |
bulach
2011/01/06 12:44:59
>80cols
|
+ // TODO(jknotten): Support high_accuracy hint in underlying data provider. |
+ if (is_updating_) |
+ return true; |
+ |
+ is_updating_ = data_provider_->StartUpdating(this); |
return true; |
} |
void CoreLocationProviderMac::StopProvider() { |
data_provider_->StopUpdating(); |
+ is_updating_ = false; |
} |
void CoreLocationProviderMac::GetPosition(Geoposition* position) { |
@@ -43,7 +50,7 @@ void CoreLocationProviderMac::SetPosition(Geoposition* position) { |
} |
LocationProviderBase* NewSystemLocationProvider() { |
- if(CommandLine::ForCurrentProcess() |
+ if (CommandLine::ForCurrentProcess() |
bulach
2011/01/06 12:44:59
I think a more natural break would be:
if (Command
|
->HasSwitch(switches::kExperimentalLocationFeatures)) { |
return new CoreLocationProviderMac; |
} |