Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: media/midi/midi_manager_win.cc

Issue 1061893002: Web MIDI: use GetVendorName() result only if it is available (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: name ? name : "" Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698