| Index: content/browser/geolocation/network_location_provider.cc
|
| diff --git a/content/browser/geolocation/network_location_provider.cc b/content/browser/geolocation/network_location_provider.cc
|
| index 2e37ede60ee85d840d5097dbc15a99a9c7cfcbb4..d6cf85b54e6f606559336564f81d21baa6e15650 100644
|
| --- a/content/browser/geolocation/network_location_provider.cc
|
| +++ b/content/browser/geolocation/network_location_provider.cc
|
| @@ -76,7 +76,6 @@ bool NetworkLocationProvider::PositionCache::MakeKey(
|
| string16* key) {
|
| // Currently we use only the WiFi data, and base the key only on
|
| // the MAC addresses.
|
| - // TODO(joth): Make use of radio_data.
|
| DCHECK(key);
|
| key->clear();
|
| const size_t kCharsPerMacAddress = 6 * 3 + 1; // e.g. "11:22:33:44:55:66|"
|
| @@ -112,9 +111,7 @@ NetworkLocationProvider::NetworkLocationProvider(
|
| const GURL& url,
|
| const string16& access_token)
|
| : access_token_store_(access_token_store),
|
| - radio_data_provider_(NULL),
|
| wifi_data_provider_(NULL),
|
| - is_radio_data_complete_(false),
|
| is_wifi_data_complete_(false),
|
| access_token_(access_token),
|
| is_permission_granted_(false),
|
| @@ -140,8 +137,7 @@ void NetworkLocationProvider::UpdatePosition() {
|
| // TODO(joth): When called via the public (base class) interface, this should
|
| // poke each data provider to get them to expedite their next scan.
|
| // Whilst in the delayed start, only send request if all data is ready.
|
| - if (!weak_factory_.HasWeakPtrs() ||
|
| - (is_radio_data_complete_ && is_wifi_data_complete_)) {
|
| + if (!weak_factory_.HasWeakPtrs() || is_wifi_data_complete_) {
|
| RequestPosition();
|
| }
|
| }
|
| @@ -156,13 +152,6 @@ void NetworkLocationProvider::OnPermissionGranted() {
|
|
|
| // DeviceDataProviderInterface::ListenerInterface implementation.
|
| void NetworkLocationProvider::DeviceDataUpdateAvailable(
|
| - RadioDataProvider* provider) {
|
| - DCHECK(provider == radio_data_provider_);
|
| - is_radio_data_complete_ = radio_data_provider_->GetData(&radio_data_);
|
| - OnDeviceDataUpdated();
|
| -}
|
| -
|
| -void NetworkLocationProvider::DeviceDataUpdateAvailable(
|
| WifiDataProvider* provider) {
|
| DCHECK(provider == wifi_data_provider_);
|
| is_wifi_data_complete_ = wifi_data_provider_->GetData(&wifi_data_);
|
| @@ -174,7 +163,6 @@ void NetworkLocationProvider::LocationResponseAvailable(
|
| const Geoposition& position,
|
| bool server_error,
|
| const string16& access_token,
|
| - const RadioData& radio_data,
|
| const WifiData& wifi_data) {
|
| DCHECK(CalledOnValidThread());
|
| // Record the position and update our cache.
|
| @@ -206,7 +194,6 @@ bool NetworkLocationProvider::StartProvider(bool high_accuracy) {
|
|
|
| // Get the device data providers. The first call to Register will create the
|
| // provider and it will be deleted by ref counting.
|
| - radio_data_provider_ = RadioDataProvider::Register(this);
|
| wifi_data_provider_ = WifiDataProvider::Register(this);
|
|
|
| MessageLoop::current()->PostDelayedTask(
|
| @@ -215,9 +202,8 @@ bool NetworkLocationProvider::StartProvider(bool high_accuracy) {
|
| weak_factory_.GetWeakPtr()),
|
| base::TimeDelta::FromSeconds(kDataCompleteWaitSeconds));
|
| // Get the device data.
|
| - is_radio_data_complete_ = radio_data_provider_->GetData(&radio_data_);
|
| is_wifi_data_complete_ = wifi_data_provider_->GetData(&wifi_data_);
|
| - if (is_radio_data_complete_ || is_wifi_data_complete_)
|
| + if (is_wifi_data_complete_)
|
| OnDeviceDataUpdated();
|
| return true;
|
| }
|
| @@ -225,10 +211,8 @@ bool NetworkLocationProvider::StartProvider(bool high_accuracy) {
|
| void NetworkLocationProvider::StopProvider() {
|
| DCHECK(CalledOnValidThread());
|
| if (IsStarted()) {
|
| - radio_data_provider_->Unregister(this);
|
| wifi_data_provider_->Unregister(this);
|
| }
|
| - radio_data_provider_ = NULL;
|
| wifi_data_provider_ = NULL;
|
| weak_factory_.InvalidateWeakPtrs();
|
| }
|
| @@ -270,8 +254,7 @@ void NetworkLocationProvider::RequestPosition() {
|
| "with new data. Wifi APs: "
|
| << wifi_data_.access_point_data.size();
|
| }
|
| - request_->MakeRequest(access_token_,
|
| - radio_data_, wifi_data_,
|
| + request_->MakeRequest(access_token_, wifi_data_,
|
| device_data_updated_timestamp_);
|
| }
|
|
|
| @@ -279,11 +262,10 @@ void NetworkLocationProvider::OnDeviceDataUpdated() {
|
| DCHECK(CalledOnValidThread());
|
| device_data_updated_timestamp_ = base::Time::Now();
|
|
|
| - is_new_data_available_ = is_radio_data_complete_ || is_wifi_data_complete_;
|
| + is_new_data_available_ = is_wifi_data_complete_;
|
| UpdatePosition();
|
| }
|
|
|
| bool NetworkLocationProvider::IsStarted() const {
|
| - DCHECK_EQ(!!radio_data_provider_, !!wifi_data_provider_);
|
| return wifi_data_provider_ != NULL;
|
| }
|
|
|