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 "media/midi/midi_manager_win.h" | 5 #include "media/midi/midi_manager_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <dbt.h> | 8 #include <dbt.h> |
9 #include <ks.h> | 9 #include <ks.h> |
10 #include <ksmedia.h> | 10 #include <ksmedia.h> |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 return EXTRACT_USBAUDIO_PID(&caps.ProductGuid); | 284 return EXTRACT_USBAUDIO_PID(&caps.ProductGuid); |
285 } | 285 } |
286 static uint16 ExtractUsbProductIdIfExists(const MIDIOUTCAPS2W& caps) { | 286 static uint16 ExtractUsbProductIdIfExists(const MIDIOUTCAPS2W& caps) { |
287 if (!IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid)) | 287 if (!IS_COMPATIBLE_USBAUDIO_PID(&caps.ProductGuid)) |
288 return 0; | 288 return 0; |
289 return EXTRACT_USBAUDIO_PID(&caps.ProductGuid); | 289 return EXTRACT_USBAUDIO_PID(&caps.ProductGuid); |
290 } | 290 } |
291 }; | 291 }; |
292 | 292 |
293 std::string GetManufacturerName(const MidiDeviceInfo& info) { | 293 std::string GetManufacturerName(const MidiDeviceInfo& info) { |
294 if (info.is_usb_device) | 294 if (info.is_usb_device) { |
295 return device::UsbIds::GetVendorName(info.usb_vendor_id); | 295 const char* name = device::UsbIds::GetVendorName(info.usb_vendor_id); |
| 296 return std::string(name ? name : ""); |
| 297 } |
296 | 298 |
297 switch (info.manufacturer_id) { | 299 switch (info.manufacturer_id) { |
298 case MM_MICROSOFT: | 300 case MM_MICROSOFT: |
299 return "Microsoft Corporation"; | 301 return "Microsoft Corporation"; |
300 default: | 302 default: |
301 // TODO(toyoshim): Support other manufacture IDs. crbug.com/472341. | 303 // TODO(toyoshim): Support other manufacture IDs. crbug.com/472341. |
302 return ""; | 304 return ""; |
303 } | 305 } |
304 } | 306 } |
305 | 307 |
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 // TOOD(toyoshim): This calculation should be done when the date is actually | 1188 // TOOD(toyoshim): This calculation should be done when the date is actually |
1187 // sent. | 1189 // sent. |
1188 client->AccumulateMidiBytesSent(data.size()); | 1190 client->AccumulateMidiBytesSent(data.size()); |
1189 } | 1191 } |
1190 | 1192 |
1191 MidiManager* MidiManager::Create() { | 1193 MidiManager* MidiManager::Create() { |
1192 return new MidiManagerWin(); | 1194 return new MidiManagerWin(); |
1193 } | 1195 } |
1194 | 1196 |
1195 } // namespace media | 1197 } // namespace media |
OLD | NEW |