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

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

Issue 6591034: Move core pieces of geolocation from chrome to content.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix Linux build Created 9 years, 9 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 // 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
11 // locally using data from the MSDN. 11 // locally using data from the MSDN.
12 // 12 //
13 // Windows XP from Service Pack 2 onwards supports the Wireless Zero 13 // Windows XP from Service Pack 2 onwards supports the Wireless Zero
14 // Configuration (WZC) programming interface. See 14 // Configuration (WZC) programming interface. See
15 // http://msdn.microsoft.com/en-us/library/ms706587(VS.85).aspx. 15 // http://msdn.microsoft.com/en-us/library/ms706587(VS.85).aspx.
16 // 16 //
17 // The MSDN recommends that one use the WLAN API where available, and WZC 17 // The MSDN recommends that one use the WLAN API where available, and WZC
18 // otherwise. 18 // otherwise.
19 // 19 //
20 // However, it seems that WZC fails for some wireless cards. Also, WLAN seems 20 // However, it seems that WZC fails for some wireless cards. Also, WLAN seems
21 // not to work on XP SP3. So we use WLAN on Vista, and use NDIS directly 21 // not to work on XP SP3. So we use WLAN on Vista, and use NDIS directly
22 // otherwise. 22 // otherwise.
23 23
24 #include "chrome/browser/geolocation/wifi_data_provider_win.h" 24 #include "content/browser/geolocation/wifi_data_provider_win.h"
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/utf_string_conversions.h" 30 #include "base/utf_string_conversions.h"
31 #include "base/win/windows_version.h" 31 #include "base/win/windows_version.h"
32 #include "chrome/browser/geolocation/wifi_data_provider_common.h" 32 #include "content/browser/geolocation/wifi_data_provider_common.h"
33 #include "chrome/browser/geolocation/wifi_data_provider_common_win.h" 33 #include "content/browser/geolocation/wifi_data_provider_common_win.h"
34 34
35 // Taken from ndis.h for WinCE. 35 // Taken from ndis.h for WinCE.
36 #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L) 36 #define NDIS_STATUS_INVALID_LENGTH ((NDIS_STATUS)0xC0010014L)
37 #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L) 37 #define NDIS_STATUS_BUFFER_TOO_SHORT ((NDIS_STATUS)0xC0010016L)
38 38
39 namespace { 39 namespace {
40 // The limits on the size of the buffer used for the OID query. 40 // The limits on the size of the buffer used for the OID query.
41 const int kInitialBufferSize = 2 << 12; // Good for about 50 APs. 41 const int kInitialBufferSize = 2 << 12; // Good for about 50 APs.
42 const int kMaximumBufferSize = 2 << 20; // 2MB 42 const int kMaximumBufferSize = 2 << 20; // 2MB
43 43
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 598
599 path->assign(buffer.get(), characters_written); 599 path->assign(buffer.get(), characters_written);
600 600
601 if (*path->rbegin() != L'\\') { 601 if (*path->rbegin() != L'\\') {
602 path->append(L"\\"); 602 path->append(L"\\");
603 } 603 }
604 DCHECK_EQ(L'\\', *path->rbegin()); 604 DCHECK_EQ(L'\\', *path->rbegin());
605 return true; 605 return true;
606 } 606 }
607 } // namespace 607 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698