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

Unified Diff: media/midi/usb_midi_device.h

Issue 107163008: [WebMIDI] Introduce MidiManagerUsb (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@usb-midi-stream
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/midi/usb_midi_descriptor_parser_unittest.cc ('k') | media/midi/usb_midi_input_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/midi/usb_midi_device.h
diff --git a/media/midi/usb_midi_device.h b/media/midi/usb_midi_device.h
index 3f29d64f985c626fe7b195df71a609de0b35a8bb..59f129d1ffaa93bd4fa31f50bf70e4c4284f0630 100644
--- a/media/midi/usb_midi_device.h
+++ b/media/midi/usb_midi_device.h
@@ -8,15 +8,53 @@
#include <vector>
#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/memory/scoped_vector.h"
#include "media/base/media_export.h"
namespace media {
+class UsbMidiDevice;
+
+// Delegate class for UsbMidiDevice.
+// Each method is called when an corresponding event arrives at the device.
+class MEDIA_EXPORT UsbMidiDeviceDelegate {
+ public:
+ virtual ~UsbMidiDeviceDelegate() {}
+
+ // Called when USB-MIDI data arrives at |device|.
+ virtual void ReceiveUsbMidiData(UsbMidiDevice* device,
+ int endpoint_number,
+ const uint8* data,
+ size_t size,
+ double timestamp) = 0;
+};
+
// UsbMidiDevice represents a USB-MIDI device.
// This is an interface class and each platform-dependent implementation class
// will be a derived class.
class MEDIA_EXPORT UsbMidiDevice {
public:
+ typedef ScopedVector<UsbMidiDevice> Devices;
+
+ // Factory class for USB-MIDI devices.
+ // Each concrete implementation will find and create devices
+ // in platform-dependent way.
+ class Factory {
+ public:
+ typedef base::Callback<void(bool result, Devices* devices)> Callback;
+ virtual ~Factory() {}
+ // Enumerates devices.
+ // Devices that have no USB-MIDI interfaces can be omitted.
+ // When the operation succeeds, |callback| will be called with |true| and
+ // devices.
+ // Otherwise |callback| will be called with |false| and empty devices.
+ // When this factory is destroyed during the operation, the operation
+ // will be canceled silently (i.e. |callback| will not be called).
+ virtual void EnumerateDevices(UsbMidiDeviceDelegate* delegate,
+ Callback callback) = 0;
+ };
+
virtual ~UsbMidiDevice() {}
// Returns the descriptor of this device.
« no previous file with comments | « media/midi/usb_midi_descriptor_parser_unittest.cc ('k') | media/midi/usb_midi_input_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698