| 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 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 | 153 |
| 154 if (size != MAC_LENGTH) { | 154 if (size != MAC_LENGTH) { |
| 155 return false; | 155 return false; |
| 156 } | 156 } |
| 157 | 157 |
| 158 if (static_cast<const unsigned char *>(bytes)[0] & 0x02) { | 158 if (static_cast<const unsigned char *>(bytes)[0] & 0x02) { |
| 159 // Locally administered. | 159 // Locally administered. |
| 160 return false; | 160 return false; |
| 161 } | 161 } |
| 162 | 162 |
| 163 // Note: Use ARRAYSIZE_UNSAFE() instead of arraysize() because InvalidMacEntry | 163 for (size_t i = 0; i < arraysize(invalidAddresses); ++i) { |
| 164 // is declared inside this function. | |
| 165 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(invalidAddresses); ++i) { | |
| 166 size_t count = invalidAddresses[i].size; | 164 size_t count = invalidAddresses[i].size; |
| 167 if (memcmp(invalidAddresses[i].address, bytes, count) == 0) { | 165 if (memcmp(invalidAddresses[i].address, bytes, count) == 0) { |
| 168 return false; | 166 return false; |
| 169 } | 167 } |
| 170 } | 168 } |
| 171 return true; | 169 return true; |
| 172 } | 170 } |
| 173 | 171 |
| 174 } // namespace | 172 } // namespace |
| 175 | 173 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 187 GetRawDeviceId(base::Bind(&GetRawDeviceIdCallback, extension_id, callback)); | 185 GetRawDeviceId(base::Bind(&GetRawDeviceIdCallback, extension_id, callback)); |
| 188 } | 186 } |
| 189 | 187 |
| 190 // static | 188 // static |
| 191 bool DeviceId::IsValidMacAddress(const void* bytes, size_t size) { | 189 bool DeviceId::IsValidMacAddress(const void* bytes, size_t size) { |
| 192 return IsValidMacAddressImpl(bytes, size); | 190 return IsValidMacAddressImpl(bytes, size); |
| 193 } | 191 } |
| 194 | 192 |
| 195 } // namespace api | 193 } // namespace api |
| 196 } // namespace extensions | 194 } // namespace extensions |
| OLD | NEW |