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 #include "content/browser/geolocation/gateway_data_provider_win.h" | 5 #include "content/browser/geolocation/gateway_data_provider_win.h" |
6 | 6 |
7 #include <iphlpapi.h> | 7 #include <iphlpapi.h> |
8 #include <winsock2.h> | 8 #include <winsock2.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/common/chrome_switches.h" | |
15 #include "content/browser/geolocation/empty_device_data_provider.h" | 14 #include "content/browser/geolocation/empty_device_data_provider.h" |
| 15 #include "content/common/content_switches.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 string16 MacAsString16(const uint8 mac_as_int[6]) { | 19 string16 MacAsString16(const uint8 mac_as_int[6]) { |
20 // mac_as_int is big-endian. Write in byte chunks. | 20 // mac_as_int is big-endian. Write in byte chunks. |
21 // Format is XX-XX-XX-XX-XX-XX. | 21 // Format is XX-XX-XX-XX-XX-XX. |
22 static const wchar_t* const kMacFormatString = | 22 static const wchar_t* const kMacFormatString = |
23 L"%02x-%02x-%02x-%02x-%02x-%02x"; | 23 L"%02x-%02x-%02x-%02x-%02x-%02x"; |
24 return WideToUTF16(StringPrintf(kMacFormatString, | 24 return WideToUTF16(StringPrintf(kMacFormatString, |
25 mac_as_int[0], mac_as_int[1], | 25 mac_as_int[0], mac_as_int[1], |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 WinGatewayDataProvider::~WinGatewayDataProvider() { | 107 WinGatewayDataProvider::~WinGatewayDataProvider() { |
108 } | 108 } |
109 | 109 |
110 template<> | 110 template<> |
111 GatewayDataProviderImplBase* GatewayDataProvider::DefaultFactoryFunction() { | 111 GatewayDataProviderImplBase* GatewayDataProvider::DefaultFactoryFunction() { |
112 if (!CommandLine::ForCurrentProcess() | 112 if (!CommandLine::ForCurrentProcess() |
113 ->HasSwitch(switches::kExperimentalLocationFeatures)) | 113 ->HasSwitch(switches::kExperimentalLocationFeatures)) |
114 return new EmptyDeviceDataProvider<GatewayData>(); | 114 return new EmptyDeviceDataProvider<GatewayData>(); |
115 return new WinGatewayDataProvider(); | 115 return new WinGatewayDataProvider(); |
116 } | 116 } |
OLD | NEW |