| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "device/geolocation/network_location_provider.h" | 5 #include "device/geolocation/network_location_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 url_context_getter, url, | 121 url_context_getter, url, |
| 122 base::Bind(&NetworkLocationProvider::OnLocationResponse, | 122 base::Bind(&NetworkLocationProvider::OnLocationResponse, |
| 123 base::Unretained(this)))); | 123 base::Unretained(this)))); |
| 124 } | 124 } |
| 125 | 125 |
| 126 NetworkLocationProvider::~NetworkLocationProvider() { | 126 NetworkLocationProvider::~NetworkLocationProvider() { |
| 127 StopProvider(); | 127 StopProvider(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 // LocationProvider implementation | 130 // LocationProvider implementation |
| 131 void NetworkLocationProvider::GetPosition(Geoposition* position) { | 131 const Geoposition& NetworkLocationProvider::GetPosition() { |
| 132 DCHECK(position); | 132 return position_; |
| 133 *position = position_; | |
| 134 } | 133 } |
| 135 | 134 |
| 136 void NetworkLocationProvider::RequestRefresh() { | 135 void NetworkLocationProvider::RequestRefresh() { |
| 137 // TODO(joth): When called via the public (base class) interface, this should | 136 // TODO(joth): When called via the public (base class) interface, this should |
| 138 // poke each data provider to get them to expedite their next scan. | 137 // poke each data provider to get them to expedite their next scan. |
| 139 // Whilst in the delayed start, only send request if all data is ready. | 138 // Whilst in the delayed start, only send request if all data is ready. |
| 140 // TODO(mcasas): consider not using HasWeakPtrs() https://crbug.com/629158. | 139 // TODO(mcasas): consider not using HasWeakPtrs() https://crbug.com/629158. |
| 141 if (!weak_factory_.HasWeakPtrs() || is_wifi_data_complete_) { | 140 if (!weak_factory_.HasWeakPtrs() || is_wifi_data_complete_) { |
| 142 RequestPosition(); | 141 RequestPosition(); |
| 143 } | 142 } |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 << wifi_data_.access_point_data.size(); | 261 << wifi_data_.access_point_data.size(); |
| 263 } | 262 } |
| 264 request_->MakeRequest(access_token_, wifi_data_, wifi_timestamp_); | 263 request_->MakeRequest(access_token_, wifi_data_, wifi_timestamp_); |
| 265 } | 264 } |
| 266 | 265 |
| 267 bool NetworkLocationProvider::IsStarted() const { | 266 bool NetworkLocationProvider::IsStarted() const { |
| 268 return wifi_data_provider_manager_ != nullptr; | 267 return wifi_data_provider_manager_ != nullptr; |
| 269 } | 268 } |
| 270 | 269 |
| 271 } // namespace device | 270 } // namespace device |
| OLD | NEW |