| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // Provides wifi scan API binding for chromeos, using proprietary APIs. | 5 // Provides wifi scan API binding for chromeos, using proprietary APIs. |
| 6 | 6 |
| 7 #include "chrome/browser/geolocation/wifi_data_provider_chromeos.h" | 7 #include "chrome/browser/geolocation/wifi_data_provider_chromeos.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/chromeos/cros/cros_library.h" | 11 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 12 #include "chrome/browser/chromeos/cros/network_library.h" | 12 #include "chrome/browser/chromeos/cros/network_library.h" |
| 13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
| 14 | 14 |
| 15 using content::BrowserThread; |
| 16 |
| 15 namespace { | 17 namespace { |
| 16 // The time periods between successive polls of the wifi data. | 18 // The time periods between successive polls of the wifi data. |
| 17 const int kDefaultPollingIntervalMilliseconds = 10 * 1000; // 10s | 19 const int kDefaultPollingIntervalMilliseconds = 10 * 1000; // 10s |
| 18 const int kNoChangePollingIntervalMilliseconds = 2 * 60 * 1000; // 2 mins | 20 const int kNoChangePollingIntervalMilliseconds = 2 * 60 * 1000; // 2 mins |
| 19 const int kTwoNoChangePollingIntervalMilliseconds = 10 * 60 * 1000; // 10 mins | 21 const int kTwoNoChangePollingIntervalMilliseconds = 10 * 60 * 1000; // 10 mins |
| 20 const int kNoWifiPollingIntervalMilliseconds = 20 * 1000; // 20s | 22 const int kNoWifiPollingIntervalMilliseconds = 20 * 1000; // 20s |
| 21 | 23 |
| 22 WifiDataProviderImplBase* ChromeOSFactoryFunction() { | 24 WifiDataProviderImplBase* ChromeOSFactoryFunction() { |
| 23 return new WifiDataProviderChromeOs(); | 25 return new WifiDataProviderChromeOs(); |
| 24 } | 26 } |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 DCHECK(CalledOnClientThread()); | 234 DCHECK(CalledOnClientThread()); |
| 233 DCHECK(!started_); | 235 DCHECK(!started_); |
| 234 started_ = true; | 236 started_ = true; |
| 235 // Perform first scan ASAP regardless of the polling policy. If this scan | 237 // Perform first scan ASAP regardless of the polling policy. If this scan |
| 236 // fails we'll retry at a rate in line with the polling policy. | 238 // fails we'll retry at a rate in line with the polling policy. |
| 237 BrowserThread::PostTask( | 239 BrowserThread::PostTask( |
| 238 BrowserThread::UI, | 240 BrowserThread::UI, |
| 239 FROM_HERE, | 241 FROM_HERE, |
| 240 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this)); | 242 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this)); |
| 241 } | 243 } |
| OLD | NEW |