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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 if (!rlz_lib::GetMachineId(&machine_id)) | 186 if (!rlz_lib::GetMachineId(&machine_id)) |
187 return ""; | 187 return ""; |
188 return machine_id; | 188 return machine_id; |
189 #else | 189 #else |
190 return ""; | 190 return ""; |
191 #endif | 191 #endif |
192 } | 192 } |
193 | 193 |
194 void GetMacAddressCallback(const DeviceId::IdCallback& callback, | 194 void GetMacAddressCallback(const DeviceId::IdCallback& callback, |
195 const std::string& mac_address) { | 195 const std::string& mac_address) { |
196 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 196 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
197 | 197 |
198 std::string machine_id = GetRlzMachineId(); | 198 std::string machine_id = GetRlzMachineId(); |
199 if (mac_address.empty() || machine_id.empty()) { | 199 if (mac_address.empty() || machine_id.empty()) { |
200 callback.Run(""); | 200 callback.Run(""); |
201 return; | 201 return; |
202 } | 202 } |
203 callback.Run(mac_address + machine_id); | 203 callback.Run(mac_address + machine_id); |
204 } | 204 } |
205 | 205 |
206 } // namespace | 206 } // namespace |
207 | 207 |
208 namespace extensions { | 208 namespace extensions { |
209 namespace api { | 209 namespace api { |
210 | 210 |
211 // static | 211 // static |
212 void DeviceId::GetRawDeviceId(const IdCallback& callback) { | 212 void DeviceId::GetRawDeviceId(const IdCallback& callback) { |
213 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 213 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
214 | 214 |
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 |