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 "chrome/browser/extensions/api/music_manager_private/device_id.h" | 5 #include "chrome/browser/extensions/api/music_manager_private/device_id.h" |
6 | 6 |
7 // Note: The order of header includes is important, as we want both pre-Vista | 7 // Note: The order of header includes is important, as we want both pre-Vista |
8 // and post-Vista data structures to be defined, specifically | 8 // and post-Vista data structures to be defined, specifically |
9 // PIP_ADAPTER_ADDRESSES and PMIB_IF_ROW2. | 9 // PIP_ADAPTER_ADDRESSES and PMIB_IF_ROW2. |
10 #include <winsock2.h> | 10 #include <winsock2.h> |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 private: | 69 private: |
70 void ProcessPhysicalAddress(NET_IFINDEX index, | 70 void ProcessPhysicalAddress(NET_IFINDEX index, |
71 const void* bytes, | 71 const void* bytes, |
72 size_t size) { | 72 size_t size) { |
73 if (index >= found_index_ || size == 0) | 73 if (index >= found_index_ || size == 0) |
74 return; | 74 return; |
75 | 75 |
76 if (!is_valid_mac_address_.Run(bytes, size)) | 76 if (!is_valid_mac_address_.Run(bytes, size)) |
77 return; | 77 return; |
78 | 78 |
79 found_mac_address_ = StringToLowerASCII(base::HexEncode(bytes, size)); | 79 found_mac_address_ = base::StringToLowerASCII(base::HexEncode(bytes, size)); |
80 found_index_ = index; | 80 found_index_ = index; |
81 } | 81 } |
82 | 82 |
83 const IsValidMacAddressCallback& is_valid_mac_address_; | 83 const IsValidMacAddressCallback& is_valid_mac_address_; |
84 std::string found_mac_address_; | 84 std::string found_mac_address_; |
85 NET_IFINDEX found_index_; | 85 NET_IFINDEX found_index_; |
86 }; | 86 }; |
87 | 87 |
88 std::string GetMacAddressFromGetAdaptersAddresses( | 88 std::string GetMacAddressFromGetAdaptersAddresses( |
89 const IsValidMacAddressCallback& is_valid_mac_address) { | 89 const IsValidMacAddressCallback& is_valid_mac_address) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 content::BrowserThread::PostTask( | 215 content::BrowserThread::PostTask( |
216 content::BrowserThread::FILE, | 216 content::BrowserThread::FILE, |
217 FROM_HERE, | 217 FROM_HERE, |
218 base::Bind(GetMacAddress, | 218 base::Bind(GetMacAddress, |
219 base::Bind(DeviceId::IsValidMacAddress), | 219 base::Bind(DeviceId::IsValidMacAddress), |
220 base::Bind(GetMacAddressCallback, callback))); | 220 base::Bind(GetMacAddressCallback, callback))); |
221 } | 221 } |
222 | 222 |
223 } // namespace api | 223 } // namespace api |
224 } // namespace extensions | 224 } // namespace extensions |
OLD | NEW |