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" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 WifiDataProviderCommon::WlanApiInterface* | 121 WifiDataProviderCommon::WlanApiInterface* |
122 WifiDataProviderChromeOs::NewWlanApi(chromeos::NetworkLibrary* lib) { | 122 WifiDataProviderChromeOs::NewWlanApi(chromeos::NetworkLibrary* lib) { |
123 return new chromeos::NetworkLibraryWlanApi(lib); | 123 return new chromeos::NetworkLibraryWlanApi(lib); |
124 } | 124 } |
125 | 125 |
126 WifiDataProviderCommon::WlanApiInterface* | 126 WifiDataProviderCommon::WlanApiInterface* |
127 WifiDataProviderChromeOs::NewWlanApi() { | 127 WifiDataProviderChromeOs::NewWlanApi() { |
128 chromeos::CrosLibrary* cros_lib = chromeos::CrosLibrary::Get(); | 128 chromeos::CrosLibrary* cros_lib = chromeos::CrosLibrary::Get(); |
129 DCHECK(cros_lib); | 129 DCHECK(cros_lib); |
130 if (!cros_lib->EnsureLoaded()) | |
131 return NULL; | |
132 return NewWlanApi(cros_lib->GetNetworkLibrary()); | 130 return NewWlanApi(cros_lib->GetNetworkLibrary()); |
133 } | 131 } |
134 | 132 |
135 PollingPolicyInterface* WifiDataProviderChromeOs::NewPollingPolicy() { | 133 PollingPolicyInterface* WifiDataProviderChromeOs::NewPollingPolicy() { |
136 return new GenericPollingPolicy<kDefaultPollingIntervalMilliseconds, | 134 return new GenericPollingPolicy<kDefaultPollingIntervalMilliseconds, |
137 kNoChangePollingIntervalMilliseconds, | 135 kNoChangePollingIntervalMilliseconds, |
138 kTwoNoChangePollingIntervalMilliseconds, | 136 kTwoNoChangePollingIntervalMilliseconds, |
139 kNoWifiPollingIntervalMilliseconds>; | 137 kNoWifiPollingIntervalMilliseconds>; |
140 } | 138 } |
141 | 139 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 DCHECK(CalledOnClientThread()); | 232 DCHECK(CalledOnClientThread()); |
235 DCHECK(!started_); | 233 DCHECK(!started_); |
236 started_ = true; | 234 started_ = true; |
237 // Perform first scan ASAP regardless of the polling policy. If this scan | 235 // Perform first scan ASAP regardless of the polling policy. If this scan |
238 // fails we'll retry at a rate in line with the polling policy. | 236 // fails we'll retry at a rate in line with the polling policy. |
239 BrowserThread::PostTask( | 237 BrowserThread::PostTask( |
240 BrowserThread::UI, | 238 BrowserThread::UI, |
241 FROM_HERE, | 239 FROM_HERE, |
242 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this)); | 240 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this)); |
243 } | 241 } |
OLD | NEW |