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

Unified Diff: device/geolocation/wifi_data_provider_chromeos.cc

Issue 2192683002: Reland 2:Geolocation: move from content/browser to device/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ignore size_t_to_int truncation warning Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « device/geolocation/wifi_data_provider_chromeos.h ('k') | device/geolocation/wifi_data_provider_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698