| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_MIDI_USB_MIDI_DEVICE_H_ | 5 #ifndef MEDIA_MIDI_USB_MIDI_DEVICE_H_ |
| 6 #define MEDIA_MIDI_USB_MIDI_DEVICE_H_ | 6 #define MEDIA_MIDI_USB_MIDI_DEVICE_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <memory> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 #include "base/callback.h" | 14 #include "base/callback.h" |
| 14 #include "base/memory/scoped_ptr.h" | |
| 15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 17 #include "media/midi/usb_midi_export.h" | 17 #include "media/midi/usb_midi_export.h" |
| 18 | 18 |
| 19 namespace media { | 19 namespace media { |
| 20 namespace midi { | 20 namespace midi { |
| 21 | 21 |
| 22 class MidiManagerUsb; | 22 class MidiManagerUsb; |
| 23 class UsbMidiDevice; | 23 class UsbMidiDevice; |
| 24 | 24 |
| 25 // Delegate class for UsbMidiDevice. | 25 // Delegate class for UsbMidiDevice. |
| 26 // Each method is called when an corresponding event arrives at the device. | 26 // Each method is called when an corresponding event arrives at the device. |
| 27 class USB_MIDI_EXPORT UsbMidiDeviceDelegate { | 27 class USB_MIDI_EXPORT UsbMidiDeviceDelegate { |
| 28 public: | 28 public: |
| 29 virtual ~UsbMidiDeviceDelegate() {} | 29 virtual ~UsbMidiDeviceDelegate() {} |
| 30 | 30 |
| 31 // Called when USB-MIDI data arrives at |device|. | 31 // Called when USB-MIDI data arrives at |device|. |
| 32 virtual void ReceiveUsbMidiData(UsbMidiDevice* device, | 32 virtual void ReceiveUsbMidiData(UsbMidiDevice* device, |
| 33 int endpoint_number, | 33 int endpoint_number, |
| 34 const uint8_t* data, | 34 const uint8_t* data, |
| 35 size_t size, | 35 size_t size, |
| 36 base::TimeTicks time) = 0; | 36 base::TimeTicks time) = 0; |
| 37 | 37 |
| 38 // Called when a USB-MIDI device is attached. | 38 // Called when a USB-MIDI device is attached. |
| 39 virtual void OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) = 0; | 39 virtual void OnDeviceAttached(std::unique_ptr<UsbMidiDevice> device) = 0; |
| 40 // Called when a USB-MIDI device is detached. | 40 // Called when a USB-MIDI device is detached. |
| 41 virtual void OnDeviceDetached(size_t index) = 0; | 41 virtual void OnDeviceDetached(size_t index) = 0; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // UsbMidiDevice represents a USB-MIDI device. | 44 // UsbMidiDevice represents a USB-MIDI device. |
| 45 // This is an interface class and each platform-dependent implementation class | 45 // This is an interface class and each platform-dependent implementation class |
| 46 // will be a derived class. | 46 // will be a derived class. |
| 47 class USB_MIDI_EXPORT UsbMidiDevice { | 47 class USB_MIDI_EXPORT UsbMidiDevice { |
| 48 public: | 48 public: |
| 49 typedef ScopedVector<UsbMidiDevice> Devices; | 49 typedef ScopedVector<UsbMidiDevice> Devices; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 virtual std::string GetDeviceVersion() = 0; | 83 virtual std::string GetDeviceVersion() = 0; |
| 84 | 84 |
| 85 // Sends |data| to the given USB endpoint of this device. | 85 // Sends |data| to the given USB endpoint of this device. |
| 86 virtual void Send(int endpoint_number, const std::vector<uint8_t>& data) = 0; | 86 virtual void Send(int endpoint_number, const std::vector<uint8_t>& data) = 0; |
| 87 }; | 87 }; |
| 88 | 88 |
| 89 } // namespace midi | 89 } // namespace midi |
| 90 } // namespace media | 90 } // namespace media |
| 91 | 91 |
| 92 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_H_ | 92 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_H_ |
| OLD | NEW |