| 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 <ifaddrs.h> | 7 #include <ifaddrs.h> |
| 8 #include <net/if.h> | 8 #include <net/if.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <string.h> | 10 #include <string.h> |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 base::ThreadRestrictions::AssertIOAllowed(); | 175 base::ThreadRestrictions::AssertIOAllowed(); |
| 176 | 176 |
| 177 std::string disk_id = GetDiskUuid(); | 177 std::string disk_id = GetDiskUuid(); |
| 178 std::string mac_address = GetMacAddress(is_valid_mac_address); | 178 std::string mac_address = GetMacAddress(is_valid_mac_address); |
| 179 | 179 |
| 180 std::string raw_device_id; | 180 std::string raw_device_id; |
| 181 if (!mac_address.empty() && !disk_id.empty()) { | 181 if (!mac_address.empty() && !disk_id.empty()) { |
| 182 raw_device_id = mac_address + disk_id; | 182 raw_device_id = mac_address + disk_id; |
| 183 } | 183 } |
| 184 | 184 |
| 185 content::BrowserThread::PostTask( | 185 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 186 content::BrowserThread::UI, | 186 base::BindOnce(callback, raw_device_id)); |
| 187 FROM_HERE, | |
| 188 base::Bind(callback, raw_device_id)); | |
| 189 } | 187 } |
| 190 | 188 |
| 191 } // namespace | 189 } // namespace |
| 192 | 190 |
| 193 namespace extensions { | 191 namespace extensions { |
| 194 namespace api { | 192 namespace api { |
| 195 | 193 |
| 196 // static | 194 // static |
| 197 void DeviceId::GetRawDeviceId(const IdCallback& callback) { | 195 void DeviceId::GetRawDeviceId(const IdCallback& callback) { |
| 198 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 196 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 199 | 197 |
| 200 content::BrowserThread::PostTask( | 198 content::BrowserThread::PostTask( |
| 201 content::BrowserThread::FILE, | 199 content::BrowserThread::FILE, FROM_HERE, |
| 202 FROM_HERE, | 200 base::BindOnce(GetRawDeviceIdImpl, |
| 203 base::Bind(GetRawDeviceIdImpl, | 201 base::Bind(DeviceId::IsValidMacAddress), callback)); |
| 204 base::Bind(DeviceId::IsValidMacAddress), | |
| 205 callback)); | |
| 206 } | 202 } |
| 207 | 203 |
| 208 } // namespace api | 204 } // namespace api |
| 209 } // namespace extensions | 205 } // namespace extensions |
| OLD | NEW |