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

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

Issue 474433003: Cleaner organization of WifiDataProvider code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rabase and rename arguments to manager Created 6 years, 4 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // For OSX 10.5 we use the system API function WirelessScanSplit. This function 5 // For OSX 10.5 we use the system API function WirelessScanSplit. This function
6 // is not documented or included in the SDK, so we use a reverse-engineered 6 // is not documented or included in the SDK, so we use a reverse-engineered
7 // header, osx_wifi_.h. This file is taken from the iStumbler project 7 // header, osx_wifi_.h. This file is taken from the iStumbler project
8 // (http://www.istumbler.net). 8 // (http://www.istumbler.net).
9 9
10 #include "content/browser/geolocation/wifi_data_provider_mac.h" 10 #include "content/browser/geolocation/wifi_data_provider_mac.h"
11 11
12 #include <dlfcn.h> 12 #include <dlfcn.h>
13 #include <stdio.h> 13 #include <stdio.h>
14 14
15 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
16 #include "content/browser/geolocation/osx_wifi.h" 16 #include "content/browser/geolocation/osx_wifi.h"
17 #include "content/browser/geolocation/wifi_data_provider_common.h" 17 #include "content/browser/geolocation/wifi_data_provider_common.h"
18 #include "content/browser/geolocation/wifi_data_provider_manager.h"
18 19
19 namespace content { 20 namespace content {
20 namespace { 21 namespace {
21 // The time periods, in milliseconds, between successive polls of the wifi data. 22 // The time periods, in milliseconds, between successive polls of the wifi data.
22 const int kDefaultPollingInterval = 120000; // 2 mins 23 const int kDefaultPollingInterval = 120000; // 2 mins
23 const int kNoChangePollingInterval = 300000; // 5 mins 24 const int kNoChangePollingInterval = 300000; // 5 mins
24 const int kTwoNoChangePollingInterval = 600000; // 10 mins 25 const int kTwoNoChangePollingInterval = 600000; // 10 mins
25 const int kNoWifiPollingIntervalMilliseconds = 20 * 1000; // 20s 26 const int kNoWifiPollingIntervalMilliseconds = 20 * 1000; // 20s
26 27
27 // Provides the wifi API binding for use when running on OSX 10.5 machines using 28 // Provides the wifi API binding for use when running on OSX 10.5 machines using
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 if (managed_access_points) 153 if (managed_access_points)
153 CFRelease(managed_access_points); 154 CFRelease(managed_access_points);
154 if (adhoc_access_points) 155 if (adhoc_access_points)
155 CFRelease(adhoc_access_points); 156 CFRelease(adhoc_access_points);
156 157
157 return true; 158 return true;
158 } 159 }
159 } // namespace 160 } // namespace
160 161
161 // static 162 // static
162 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() { 163 WifiDataProvider* WifiDataProviderManager::DefaultFactoryFunction() {
163 return new WifiDataProviderMac(); 164 return new WifiDataProviderMac();
164 } 165 }
165 166
166 WifiDataProviderMac::WifiDataProviderMac() { 167 WifiDataProviderMac::WifiDataProviderMac() {
167 } 168 }
168 169
169 WifiDataProviderMac::~WifiDataProviderMac() { 170 WifiDataProviderMac::~WifiDataProviderMac() {
170 } 171 }
171 172
172 WifiDataProviderMac::WlanApiInterface* WifiDataProviderMac::NewWlanApi() { 173 WifiDataProviderMac::WlanApiInterface* WifiDataProviderMac::NewWlanApi() {
(...skipping 13 matching lines...) Expand all
186 } 187 }
187 188
188 WifiPollingPolicy* WifiDataProviderMac::NewPollingPolicy() { 189 WifiPollingPolicy* WifiDataProviderMac::NewPollingPolicy() {
189 return new GenericWifiPollingPolicy<kDefaultPollingInterval, 190 return new GenericWifiPollingPolicy<kDefaultPollingInterval,
190 kNoChangePollingInterval, 191 kNoChangePollingInterval,
191 kTwoNoChangePollingInterval, 192 kTwoNoChangePollingInterval,
192 kNoWifiPollingIntervalMilliseconds>; 193 kNoWifiPollingIntervalMilliseconds>;
193 } 194 }
194 195
195 } // namespace content 196 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/wifi_data_provider_linux.cc ('k') | content/browser/geolocation/wifi_data_provider_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698