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

Side by Side Diff: content/browser/geolocation/wifi_data_provider_win.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
« no previous file with comments | « content/browser/geolocation/wifi_data_provider_manager.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 // Windows Vista uses the Native Wifi (WLAN) API for accessing WiFi cards. See 5 // Windows Vista uses the Native Wifi (WLAN) API for accessing WiFi cards. See
6 // http://msdn.microsoft.com/en-us/library/ms705945(VS.85).aspx. Windows XP 6 // http://msdn.microsoft.com/en-us/library/ms705945(VS.85).aspx. Windows XP
7 // Service Pack 3 (and Windows XP Service Pack 2, if upgraded with a hot fix) 7 // Service Pack 3 (and Windows XP Service Pack 2, if upgraded with a hot fix)
8 // also support a limited version of the WLAN API. See 8 // also support a limited version of the WLAN API. See
9 // http://msdn.microsoft.com/en-us/library/bb204766.aspx. The WLAN API uses 9 // http://msdn.microsoft.com/en-us/library/bb204766.aspx. The WLAN API uses
10 // wlanapi.h, which is not part of the SDK used by Gears, so is replicated 10 // wlanapi.h, which is not part of the SDK used by Gears, so is replicated
(...skipping 14 matching lines...) Expand all
25 25
26 #include <windows.h> 26 #include <windows.h>
27 #include <winioctl.h> 27 #include <winioctl.h>
28 #include <wlanapi.h> 28 #include <wlanapi.h>
29 29
30 #include "base/metrics/histogram.h" 30 #include "base/metrics/histogram.h"
31 #include "base/strings/utf_string_conversions.h" 31 #include "base/strings/utf_string_conversions.h"
32 #include "base/win/windows_version.h" 32 #include "base/win/windows_version.h"
33 #include "content/browser/geolocation/wifi_data_provider_common.h" 33 #include "content/browser/geolocation/wifi_data_provider_common.h"
34 #include "content/browser/geolocation/wifi_data_provider_common_win.h" 34 #include "content/browser/geolocation/wifi_data_provider_common_win.h"
35 #include "content/browser/geolocation/wifi_data_provider_manager.h"
35 36
36 // Taken from ndis.h for WinCE. 37 // Taken from ndis.h for WinCE.
37 #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L) 38 #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
38 #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L) 39 #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
39 40
40 namespace content { 41 namespace content {
41 namespace { 42 namespace {
42 // The limits on the size of the buffer used for the OID query. 43 // The limits on the size of the buffer used for the OID query.
43 const int kInitialBufferSize = 2 << 12; // Good for about 50 APs. 44 const int kInitialBufferSize = 2 << 12; // Good for about 50 APs.
44 const int kMaximumBufferSize = 2 << 20; // 2MB 45 const int kMaximumBufferSize = 2 << 20; // 2MB
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 BYTE* buffer, 153 BYTE* buffer,
153 DWORD buffer_size, 154 DWORD buffer_size,
154 DWORD* bytes_out); 155 DWORD* bytes_out);
155 bool ResizeBuffer(int requested_size, 156 bool ResizeBuffer(int requested_size,
156 scoped_ptr<BYTE, base::FreeDeleter>* buffer); 157 scoped_ptr<BYTE, base::FreeDeleter>* buffer);
157 // Gets the system directory and appends a trailing slash if not already 158 // Gets the system directory and appends a trailing slash if not already
158 // present. 159 // present.
159 bool GetSystemDirectory(base::string16* path); 160 bool GetSystemDirectory(base::string16* path);
160 } // namespace 161 } // namespace
161 162
162 WifiDataProviderImplBase* WifiDataProvider::DefaultFactoryFunction() { 163 WifiDataProvider* WifiDataProviderManager::DefaultFactoryFunction() {
163 return new WifiDataProviderWin(); 164 return new WifiDataProviderWin();
164 } 165 }
165 166
166 WifiDataProviderWin::WifiDataProviderWin() { 167 WifiDataProviderWin::WifiDataProviderWin() {
167 } 168 }
168 169
169 WifiDataProviderWin::~WifiDataProviderWin() { 170 WifiDataProviderWin::~WifiDataProviderWin() {
170 } 171 }
171 172
172 WifiDataProviderCommon::WlanApiInterface* WifiDataProviderWin::NewWlanApi() { 173 WifiDataProviderCommon::WlanApiInterface* WifiDataProviderWin::NewWlanApi() {
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 633
633 if (*path->rbegin() != L'\\') { 634 if (*path->rbegin() != L'\\') {
634 path->append(L"\\"); 635 path->append(L"\\");
635 } 636 }
636 DCHECK_EQ(L'\\', *path->rbegin()); 637 DCHECK_EQ(L'\\', *path->rbegin());
637 return true; 638 return true;
638 } 639 }
639 } // namespace 640 } // namespace
640 641
641 } // namespace content 642 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/geolocation/wifi_data_provider_manager.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698