| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 | 54 |
| 55 MIDIInputVector inputs() const { return m_inputs; } | 55 MIDIInputVector inputs() const { return m_inputs; } |
| 56 MIDIOutputVector outputs() const { return m_outputs; } | 56 MIDIOutputVector outputs() const { return m_outputs; } |
| 57 | 57 |
| 58 using RefCounted<MIDIAccess>::ref; | 58 using RefCounted<MIDIAccess>::ref; |
| 59 using RefCounted<MIDIAccess>::deref; | 59 using RefCounted<MIDIAccess>::deref; |
| 60 | 60 |
| 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); | 61 DEFINE_ATTRIBUTE_EVENT_LISTENER(connect); |
| 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); | 62 DEFINE_ATTRIBUTE_EVENT_LISTENER(disconnect); |
| 63 | 63 |
| 64 void enableSysEx(bool enable); | 64 void setSysExEnabled(bool); |
| 65 bool sysExEnabled() const { return m_sysExEnabled; } |
| 65 | 66 |
| 66 // EventTarget | 67 // EventTarget |
| 67 virtual const AtomicString& interfaceName() const OVERRIDE { return eventNam
es().interfaceForMIDIAccess; } | 68 virtual const AtomicString& interfaceName() const OVERRIDE { return eventNam
es().interfaceForMIDIAccess; } |
| 68 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { re
turn ActiveDOMObject::scriptExecutionContext(); } | 69 virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE { re
turn ActiveDOMObject::scriptExecutionContext(); } |
| 69 | 70 |
| 70 // ActiveDOMObject | 71 // ActiveDOMObject |
| 71 virtual bool canSuspend() const OVERRIDE { return true; } | 72 virtual bool canSuspend() const OVERRIDE { return true; } |
| 72 virtual void stop(); | 73 virtual void stop(); |
| 73 | 74 |
| 74 // MIDIAccessorClient | 75 // MIDIAccessorClient |
| 75 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) OVERRIDE; | 76 virtual void didAddInputPort(const String& id, const String& manufacturer, c
onst String& name, const String& version) OVERRIDE; |
| 76 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) OVERRIDE; | 77 virtual void didAddOutputPort(const String& id, const String& manufacturer,
const String& name, const String& version) OVERRIDE; |
| 77 virtual void didStartSession() OVERRIDE; | 78 virtual void didStartSession() OVERRIDE; |
| 78 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; | 79 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) OVERRIDE; |
| 79 | 80 |
| 81 // |timeStampInMilliseconds| is in the same time coordinate system as perfor
mance.now(). |
| 82 void sendMIDIData(unsigned portIndex, const unsigned char* data, size_t leng
th, double timeStampInMilliseconds); |
| 83 |
| 80 private: | 84 private: |
| 81 explicit MIDIAccess(ScriptExecutionContext*, MIDIAccessPromise*); | 85 explicit MIDIAccess(ScriptExecutionContext*, MIDIAccessPromise*); |
| 82 | 86 |
| 83 void startRequest(); | 87 void startRequest(); |
| 84 virtual void permissionDenied(); | 88 virtual void permissionDenied(); |
| 85 | 89 |
| 86 // EventTarget | 90 // EventTarget |
| 87 virtual void refEventTarget() OVERRIDE { ref(); } | 91 virtual void refEventTarget() OVERRIDE { ref(); } |
| 88 virtual void derefEventTarget() OVERRIDE { deref(); } | 92 virtual void derefEventTarget() OVERRIDE { deref(); } |
| 89 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD
ata; } | 93 virtual EventTargetData* eventTargetData() OVERRIDE { return &m_eventTargetD
ata; } |
| 90 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT
argetData; } | 94 virtual EventTargetData* ensureEventTargetData() OVERRIDE { return &m_eventT
argetData; } |
| 91 | 95 |
| 92 MIDIInputVector m_inputs; | 96 MIDIInputVector m_inputs; |
| 93 MIDIOutputVector m_outputs; | 97 MIDIOutputVector m_outputs; |
| 94 EventTargetData m_eventTargetData; | 98 EventTargetData m_eventTargetData; |
| 95 MIDIAccessPromise* m_promise; | 99 MIDIAccessPromise* m_promise; |
| 96 | 100 |
| 97 OwnPtr<MIDIAccessor> m_accessor; | 101 OwnPtr<MIDIAccessor> m_accessor; |
| 98 bool m_hasAccess; | 102 bool m_hasAccess; |
| 99 bool m_enableSysEx; | 103 bool m_sysExEnabled; |
| 100 bool m_requesting; | 104 bool m_requesting; |
| 101 }; | 105 }; |
| 102 | 106 |
| 103 } // namespace WebCore | 107 } // namespace WebCore |
| 104 | 108 |
| 105 #endif // MIDIAccess_h | 109 #endif // MIDIAccess_h |
| OLD | NEW |