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 "content/browser/geolocation/network_location_provider.h" | 5 #include "content/browser/geolocation/network_location_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/public/browser/access_token_store.h" | 10 #include "content/public/browser/access_token_store.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 if (!request_->url().is_valid()) { | 187 if (!request_->url().is_valid()) { |
188 LOG(WARNING) << "StartProvider() : Failed, Bad URL: " | 188 LOG(WARNING) << "StartProvider() : Failed, Bad URL: " |
189 << request_->url().possibly_invalid_spec(); | 189 << request_->url().possibly_invalid_spec(); |
190 return false; | 190 return false; |
191 } | 191 } |
192 | 192 |
193 // Get the device data providers. The first call to Register will create the | 193 // Get the device data providers. The first call to Register will create the |
194 // provider and it will be deleted by ref counting. | 194 // provider and it will be deleted by ref counting. |
195 wifi_data_provider_ = WifiDataProvider::Register(this); | 195 wifi_data_provider_ = WifiDataProvider::Register(this); |
196 | 196 |
197 MessageLoop::current()->PostDelayedTask( | 197 base::MessageLoop::current()->PostDelayedTask( |
198 FROM_HERE, | 198 FROM_HERE, |
199 base::Bind(&NetworkLocationProvider::RequestPosition, | 199 base::Bind(&NetworkLocationProvider::RequestPosition, |
200 weak_factory_.GetWeakPtr()), | 200 weak_factory_.GetWeakPtr()), |
201 base::TimeDelta::FromSeconds(kDataCompleteWaitSeconds)); | 201 base::TimeDelta::FromSeconds(kDataCompleteWaitSeconds)); |
202 // Get the device data. | 202 // Get the device data. |
203 is_wifi_data_complete_ = wifi_data_provider_->GetData(&wifi_data_); | 203 is_wifi_data_complete_ = wifi_data_provider_->GetData(&wifi_data_); |
204 if (is_wifi_data_complete_) | 204 if (is_wifi_data_complete_) |
205 OnDeviceDataUpdated(); | 205 OnDeviceDataUpdated(); |
206 return true; | 206 return true; |
207 } | 207 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 is_new_data_available_ = is_wifi_data_complete_; | 263 is_new_data_available_ = is_wifi_data_complete_; |
264 UpdatePosition(); | 264 UpdatePosition(); |
265 } | 265 } |
266 | 266 |
267 bool NetworkLocationProvider::IsStarted() const { | 267 bool NetworkLocationProvider::IsStarted() const { |
268 return wifi_data_provider_ != NULL; | 268 return wifi_data_provider_ != NULL; |
269 } | 269 } |
270 | 270 |
271 } // namespace content | 271 } // namespace content |
OLD | NEW |