summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chromium/device/geolocation/network_location_provider.cc8
-rw-r--r--chromium/device/geolocation/network_location_request.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/chromium/device/geolocation/network_location_provider.cc b/chromium/device/geolocation/network_location_provider.cc
index 9f33ee3f741..7d098b34947 100644
--- a/chromium/device/geolocation/network_location_provider.cc
+++ b/chromium/device/geolocation/network_location_provider.cc
@@ -163,6 +163,14 @@ bool NetworkLocationProvider::StartProvider(bool high_accuracy) {
if (IsStarted())
return true;
+ // No point in sending requests without an API key.
+ if (request_->api_key().empty()) {
+ Geoposition pos;
+ pos.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
+ location_provider_update_callback_.Run(this, pos);
+ return false;
+ }
+
// Registers a callback with the data provider. The first call to Register()
// will create a singleton data provider that will be deleted on Unregister().
wifi_data_provider_manager_ =
diff --git a/chromium/device/geolocation/network_location_request.h b/chromium/device/geolocation/network_location_request.h
index be16c77dc4e..b142c9be34f 100644
--- a/chromium/device/geolocation/network_location_request.h
+++ b/chromium/device/geolocation/network_location_request.h
@@ -49,6 +49,7 @@ class NetworkLocationRequest : private net::URLFetcherDelegate {
bool MakeRequest(const WifiData& wifi_data, const base::Time& wifi_timestamp);
bool is_request_pending() const { return url_fetcher_ != NULL; }
+ const std::string api_key() const { return api_key_; }
private:
// net::URLFetcherDelegate