Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: content/browser/geolocation/network_location_provider.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/location.h"
9 #include "base/single_thread_task_runner.h"
10 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
11 #include "base/thread_task_runner_handle.h"
12 #include "base/time/time.h" 9 #include "base/time/time.h"
13 #include "content/public/browser/access_token_store.h" 10 #include "content/public/browser/access_token_store.h"
14 11
15 namespace content { 12 namespace content {
16 namespace { 13 namespace {
17 // The maximum period of time we'll wait for a complete set of wifi data 14 // The maximum period of time we'll wait for a complete set of wifi data
18 // before sending the request. 15 // before sending the request.
19 const int kDataCompleteWaitSeconds = 2; 16 const int kDataCompleteWaitSeconds = 2;
20 } // namespace 17 } // namespace
21 18
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 << request_->url().possibly_invalid_spec(); 192 << request_->url().possibly_invalid_spec();
196 return false; 193 return false;
197 } 194 }
198 195
199 // Registers a callback with the data provider. The first call to Register 196 // Registers a callback with the data provider. The first call to Register
200 // will create a singleton data provider and it will be deleted when the last 197 // will create a singleton data provider and it will be deleted when the last
201 // callback is removed with Unregister. 198 // callback is removed with Unregister.
202 wifi_data_provider_manager_ = 199 wifi_data_provider_manager_ =
203 WifiDataProviderManager::Register(&wifi_data_update_callback_); 200 WifiDataProviderManager::Register(&wifi_data_update_callback_);
204 201
205 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 202 base::MessageLoop::current()->PostDelayedTask(
206 FROM_HERE, base::Bind(&NetworkLocationProvider::RequestPosition, 203 FROM_HERE,
207 weak_factory_.GetWeakPtr()), 204 base::Bind(&NetworkLocationProvider::RequestPosition,
205 weak_factory_.GetWeakPtr()),
208 base::TimeDelta::FromSeconds(kDataCompleteWaitSeconds)); 206 base::TimeDelta::FromSeconds(kDataCompleteWaitSeconds));
209 // Get the wifi data. 207 // Get the wifi data.
210 is_wifi_data_complete_ = wifi_data_provider_manager_->GetData(&wifi_data_); 208 is_wifi_data_complete_ = wifi_data_provider_manager_->GetData(&wifi_data_);
211 if (is_wifi_data_complete_) 209 if (is_wifi_data_complete_)
212 OnWifiDataUpdated(); 210 OnWifiDataUpdated();
213 return true; 211 return true;
214 } 212 }
215 213
216 void NetworkLocationProvider::OnWifiDataUpdated() { 214 void NetworkLocationProvider::OnWifiDataUpdated() {
217 DCHECK(CalledOnValidThread()); 215 DCHECK(CalledOnValidThread());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 267 }
270 request_->MakeRequest(access_token_, wifi_data_, 268 request_->MakeRequest(access_token_, wifi_data_,
271 wifi_data_updated_timestamp_); 269 wifi_data_updated_timestamp_);
272 } 270 }
273 271
274 bool NetworkLocationProvider::IsStarted() const { 272 bool NetworkLocationProvider::IsStarted() const {
275 return wifi_data_provider_manager_ != NULL; 273 return wifi_data_provider_manager_ != NULL;
276 } 274 }
277 275
278 } // namespace content 276 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/mock_location_provider.cc ('k') | content/browser/geolocation/wifi_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698