| Index: device/geolocation/wifi_data_provider_chromeos.cc
|
| diff --git a/content/browser/geolocation/wifi_data_provider_chromeos.cc b/device/geolocation/wifi_data_provider_chromeos.cc
|
| similarity index 90%
|
| rename from content/browser/geolocation/wifi_data_provider_chromeos.cc
|
| rename to device/geolocation/wifi_data_provider_chromeos.cc
|
| index 4f148667f6357abfb87d4cdc5d978e3236d91e36..9f25def765ea1fadbc1c6cb7b6493760a42ffeb3 100644
|
| --- a/content/browser/geolocation/wifi_data_provider_chromeos.cc
|
| +++ b/device/geolocation/wifi_data_provider_chromeos.cc
|
| @@ -4,17 +4,18 @@
|
|
|
| // Provides wifi scan API binding for chromeos, using proprietary APIs.
|
|
|
| -#include "content/browser/geolocation/wifi_data_provider_chromeos.h"
|
| +#include "device/geolocation/wifi_data_provider_chromeos.h"
|
|
|
| #include <stdint.h>
|
|
|
| #include "base/bind.h"
|
| +#include "base/single_thread_task_runner.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| +#include "base/threading/thread_task_runner_handle.h"
|
| #include "chromeos/network/geolocation_handler.h"
|
| -#include "content/browser/geolocation/wifi_data_provider_manager.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| +#include "device/geolocation/wifi_data_provider_manager.h"
|
|
|
| -namespace content {
|
| +namespace device {
|
|
|
| namespace {
|
|
|
| @@ -27,8 +28,9 @@ const int kNoWifiPollingIntervalMilliseconds = 20 * 1000; // 20s
|
| } // namespace
|
|
|
| WifiDataProviderChromeOs::WifiDataProviderChromeOs()
|
| - : started_(false), is_first_scan_complete_(false) {
|
| -}
|
| + : started_(false),
|
| + is_first_scan_complete_(false),
|
| + main_task_runner_(base::ThreadTaskRunnerHandle::Get()) {}
|
|
|
| WifiDataProviderChromeOs::~WifiDataProviderChromeOs() {
|
| }
|
| @@ -61,12 +63,12 @@ bool WifiDataProviderChromeOs::GetData(WifiData* data) {
|
| }
|
|
|
| void WifiDataProviderChromeOs::DoStartTaskOnUIThread() {
|
| - CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + CHECK(main_task_runner_->BelongsToCurrentThread());
|
| DoWifiScanTaskOnUIThread();
|
| }
|
|
|
| void WifiDataProviderChromeOs::DoWifiScanTaskOnUIThread() {
|
| - CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + CHECK(main_task_runner_->BelongsToCurrentThread());
|
|
|
| // This method could be scheduled after a ScheduleStop.
|
| if (!started_)
|
| @@ -113,8 +115,7 @@ void WifiDataProviderChromeOs::DidWifiScanTask(const WifiData& new_data) {
|
| void WifiDataProviderChromeOs::ScheduleNextScan(int interval) {
|
| DCHECK(CalledOnClientThread());
|
| DCHECK(started_);
|
| - BrowserThread::PostDelayedTask(
|
| - BrowserThread::UI,
|
| + main_task_runner_->PostDelayedTask(
|
| FROM_HERE,
|
| base::Bind(&WifiDataProviderChromeOs::DoWifiScanTaskOnUIThread, this),
|
| base::TimeDelta::FromMilliseconds(interval));
|
| @@ -132,8 +133,7 @@ void WifiDataProviderChromeOs::ScheduleStart() {
|
| started_ = true;
|
| // Perform first scan ASAP regardless of the polling policy. If this scan
|
| // fails we'll retry at a rate in line with the polling policy.
|
| - BrowserThread::PostTask(
|
| - BrowserThread::UI,
|
| + main_task_runner_->PostTask(
|
| FROM_HERE,
|
| base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this));
|
| }
|
| @@ -172,4 +172,4 @@ WifiDataProvider* WifiDataProviderManager::DefaultFactoryFunction() {
|
| return new WifiDataProviderChromeOs();
|
| }
|
|
|
| -} // namespace content
|
| +} // namespace device
|
|
|