| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Win32WifiDataProvider(); | 164 return new Win32WifiDataProvider(); |
| 164 } | 165 } |
| 165 | 166 |
| 166 Win32WifiDataProvider::Win32WifiDataProvider() { | 167 Win32WifiDataProvider::Win32WifiDataProvider() { |
| 167 } | 168 } |
| 168 | 169 |
| 169 Win32WifiDataProvider::~Win32WifiDataProvider() { | 170 Win32WifiDataProvider::~Win32WifiDataProvider() { |
| 170 } | 171 } |
| 171 | 172 |
| 172 WifiDataProviderCommon::WlanApiInterface* Win32WifiDataProvider::NewWlanApi() { | 173 WifiDataProviderCommon::WlanApiInterface* Win32WifiDataProvider::NewWlanApi() { |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |