OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/wifi/wifi_service.h" | 5 #include "components/wifi/wifi_service.h" |
6 | 6 |
7 #include <iphlpapi.h> | 7 #include <iphlpapi.h> |
8 #include <objbase.h> | 8 #include <objbase.h> |
9 #include <wlanapi.h> | 9 #include <wlanapi.h> |
10 | 10 |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 | 1145 |
1146 ULONG buffer_length = 0; | 1146 ULONG buffer_length = 0; |
1147 DWORD error = ::GetInterfaceInfo(NULL, &buffer_length); | 1147 DWORD error = ::GetInterfaceInfo(NULL, &buffer_length); |
1148 if (error == ERROR_INSUFFICIENT_BUFFER) { | 1148 if (error == ERROR_INSUFFICIENT_BUFFER) { |
1149 scoped_ptr<unsigned char[]> buffer(new unsigned char[buffer_length]); | 1149 scoped_ptr<unsigned char[]> buffer(new unsigned char[buffer_length]); |
1150 IP_INTERFACE_INFO* interface_info = | 1150 IP_INTERFACE_INFO* interface_info = |
1151 reinterpret_cast<IP_INTERFACE_INFO*>(buffer.get()); | 1151 reinterpret_cast<IP_INTERFACE_INFO*>(buffer.get()); |
1152 error = GetInterfaceInfo(interface_info, &buffer_length); | 1152 error = GetInterfaceInfo(interface_info, &buffer_length); |
1153 if (error == ERROR_SUCCESS) { | 1153 if (error == ERROR_SUCCESS) { |
1154 for (int adapter = 0; adapter < interface_info->NumAdapters; ++adapter) { | 1154 for (int adapter = 0; adapter < interface_info->NumAdapters; ++adapter) { |
1155 if (EndsWith( | 1155 if (base::EndsWith( |
1156 interface_info->Adapter[adapter].Name, guid_string, false)) { | 1156 interface_info->Adapter[adapter].Name, guid_string, false)) { |
1157 *adapter_index_map = interface_info->Adapter[adapter]; | 1157 *adapter_index_map = interface_info->Adapter[adapter]; |
1158 break; | 1158 break; |
1159 } | 1159 } |
1160 } | 1160 } |
1161 } | 1161 } |
1162 } | 1162 } |
1163 return error; | 1163 return error; |
1164 } | 1164 } |
1165 | 1165 |
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1887 DVLOG(1) << "NotifyNetworkChanged: " << network_guid; | 1887 DVLOG(1) << "NotifyNetworkChanged: " << network_guid; |
1888 NetworkGuidList changed_networks(1, network_guid); | 1888 NetworkGuidList changed_networks(1, network_guid); |
1889 event_task_runner_->PostTask( | 1889 event_task_runner_->PostTask( |
1890 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); | 1890 FROM_HERE, base::Bind(networks_changed_observer_, changed_networks)); |
1891 } | 1891 } |
1892 } | 1892 } |
1893 | 1893 |
1894 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } | 1894 WiFiService* WiFiService::Create() { return new WiFiServiceImpl(); } |
1895 | 1895 |
1896 } // namespace wifi | 1896 } // namespace wifi |
OLD | NEW |