| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef MIDIInput_h | 31 #ifndef MIDIInput_h |
| 32 #define MIDIInput_h | 32 #define MIDIInput_h |
| 33 | 33 |
| 34 #include "media/midi/midi_service.mojom-blink.h" |
| 34 #include "modules/EventTargetModules.h" | 35 #include "modules/EventTargetModules.h" |
| 35 #include "modules/webmidi/MIDIAccessor.h" | 36 #include "modules/webmidi/MIDIAccessor.h" |
| 36 #include "modules/webmidi/MIDIPort.h" | 37 #include "modules/webmidi/MIDIPort.h" |
| 37 | 38 |
| 38 namespace blink { | 39 namespace blink { |
| 39 | 40 |
| 40 class MIDIAccess; | 41 class MIDIAccess; |
| 41 | 42 |
| 42 class MIDIInput final : public MIDIPort { | 43 class MIDIInput final : public MIDIPort { |
| 43 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
| 44 | 45 |
| 45 public: | 46 public: |
| 46 static MIDIInput* create(MIDIAccess*, | 47 static MIDIInput* create(MIDIAccess*, |
| 47 const String& id, | 48 const String& id, |
| 48 const String& manufacturer, | 49 const String& manufacturer, |
| 49 const String& name, | 50 const String& name, |
| 50 const String& version, | 51 const String& version, |
| 51 MIDIAccessor::MIDIPortState); | 52 midi::mojom::PortState); |
| 52 ~MIDIInput() override {} | 53 ~MIDIInput() override {} |
| 53 | 54 |
| 54 EventListener* onmidimessage(); | 55 EventListener* onmidimessage(); |
| 55 void setOnmidimessage(EventListener*); | 56 void setOnmidimessage(EventListener*); |
| 56 | 57 |
| 57 // EventTarget | 58 // EventTarget |
| 58 const AtomicString& interfaceName() const override { | 59 const AtomicString& interfaceName() const override { |
| 59 return EventTargetNames::MIDIInput; | 60 return EventTargetNames::MIDIInput; |
| 60 } | 61 } |
| 61 | 62 |
| 62 // |timeStamp| is a DOMHighResTimeStamp in the time coordinate system of | 63 // |timeStamp| is a DOMHighResTimeStamp in the time coordinate system of |
| 63 // performance.now(). | 64 // performance.now(). |
| 64 void didReceiveMIDIData(unsigned portIndex, | 65 void didReceiveMIDIData(unsigned portIndex, |
| 65 const unsigned char* data, | 66 const unsigned char* data, |
| 66 size_t length, | 67 size_t length, |
| 67 double timeStamp); | 68 double timeStamp); |
| 68 | 69 |
| 69 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
| 70 | 71 |
| 71 protected: | 72 protected: |
| 72 void addedEventListener(const AtomicString& eventType, | 73 void addedEventListener(const AtomicString& eventType, |
| 73 RegisteredEventListener&) override; | 74 RegisteredEventListener&) override; |
| 74 | 75 |
| 75 private: | 76 private: |
| 76 MIDIInput(MIDIAccess*, | 77 MIDIInput(MIDIAccess*, |
| 77 const String& id, | 78 const String& id, |
| 78 const String& manufacturer, | 79 const String& manufacturer, |
| 79 const String& name, | 80 const String& name, |
| 80 const String& version, | 81 const String& version, |
| 81 MIDIAccessor::MIDIPortState); | 82 midi::mojom::PortState); |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 } // namespace blink | 85 } // namespace blink |
| 85 | 86 |
| 86 #endif // MIDIInput_h | 87 #endif // MIDIInput_h |
| OLD | NEW |