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

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

Issue 14729017: Add NetworkHandler to own network handlers in src/chromeos/network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix chromeos_unittests Created 7 years, 7 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 | Annotate | Revision Log
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 // 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 "content/browser/geolocation/wifi_data_provider_chromeos.h" 7 #include "content/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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // fails we'll retry at a rate in line with the polling policy. 135 // fails we'll retry at a rate in line with the polling policy.
136 BrowserThread::PostTask( 136 BrowserThread::PostTask(
137 BrowserThread::UI, 137 BrowserThread::UI,
138 FROM_HERE, 138 FROM_HERE,
139 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this)); 139 base::Bind(&WifiDataProviderChromeOs::DoStartTaskOnUIThread, this));
140 } 140 }
141 141
142 bool WifiDataProviderChromeOs::GetAccessPointData( 142 bool WifiDataProviderChromeOs::GetAccessPointData(
143 WifiData::AccessPointDataSet* result) { 143 WifiData::AccessPointDataSet* result) {
144 chromeos::WifiAccessPointVector access_points; 144 chromeos::WifiAccessPointVector access_points;
145 if (!chromeos::GeolocationHandler::Get()->wifi_enabled()) 145 if (!chromeos::NetworkHandler::Get()->geolocation_handler()->wifi_enabled())
146 return false; 146 return false;
147 int64 age_ms = 0; 147 int64 age_ms = 0;
148 if (!chromeos::GeolocationHandler::Get()->GetWifiAccessPoints( 148 if (!chromeos::NetworkHandler::Get()->geolocation_handler()->
149 &access_points, &age_ms)) { 149 GetWifiAccessPoints(&access_points, &age_ms)) {
150 return false; 150 return false;
151 } 151 }
152 for (chromeos::WifiAccessPointVector::const_iterator i 152 for (chromeos::WifiAccessPointVector::const_iterator i
153 = access_points.begin(); 153 = access_points.begin();
154 i != access_points.end(); ++i) { 154 i != access_points.end(); ++i) {
155 AccessPointData ap_data; 155 AccessPointData ap_data;
156 ap_data.mac_address = ASCIIToUTF16(i->mac_address); 156 ap_data.mac_address = ASCIIToUTF16(i->mac_address);
157 ap_data.radio_signal_strength = i->signal_strength; 157 ap_data.radio_signal_strength = i->signal_strength;
158 ap_data.channel = i->channel; 158 ap_data.channel = i->channel;
159 ap_data.signal_to_noise = i->signal_to_noise; 159 ap_data.signal_to_noise = i->signal_to_noise;
160 ap_data.ssid = UTF8ToUTF16(i->ssid); 160 ap_data.ssid = UTF8ToUTF16(i->ssid);
161 result->insert(ap_data); 161 result->insert(ap_data);
162 } 162 }
163 // If the age is significantly longer than our long polling time, assume the 163 // If the age is significantly longer than our long polling time, assume the
164 // data is stale and return false which will trigger a faster update. 164 // data is stale and return false which will trigger a faster update.
165 if (age_ms > kTwoNoChangePollingIntervalMilliseconds * 2) 165 if (age_ms > kTwoNoChangePollingIntervalMilliseconds * 2)
166 return false; 166 return false;
167 return true; 167 return true;
168 } 168 }
169 169
170 // static 170 // static
171 template<> 171 template<>
172 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() { 172 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() {
173 return new WifiDataProviderChromeOs(); 173 return new WifiDataProviderChromeOs();
174 } 174 }
175 175
176 } // namespace content 176 } // namespace content
OLDNEW
« no previous file with comments | « chromeos/network/network_state_handler.cc ('k') | content/browser/geolocation/wifi_data_provider_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698