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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 ConnectionStateOpen, | 51 ConnectionStateOpen, |
52 ConnectionStateClosed, | 52 ConnectionStateClosed, |
53 ConnectionStatePending | 53 ConnectionStatePending |
54 }; | 54 }; |
55 | 55 |
56 enum TypeCode { | 56 enum TypeCode { |
57 TypeInput, | 57 TypeInput, |
58 TypeOutput | 58 TypeOutput |
59 }; | 59 }; |
60 | 60 |
61 virtual ~MIDIPort() { } | 61 ~MIDIPort() override { } |
62 | 62 |
63 String connection() const; | 63 String connection() const; |
64 String id() const { return m_id; } | 64 String id() const { return m_id; } |
65 String manufacturer() const { return m_manufacturer; } | 65 String manufacturer() const { return m_manufacturer; } |
66 String name() const { return m_name; } | 66 String name() const { return m_name; } |
67 String state() const; | 67 String state() const; |
68 String type() const; | 68 String type() const; |
69 String version() const { return m_version; } | 69 String version() const { return m_version; } |
70 | 70 |
71 ScriptPromise open(ScriptState*); | 71 ScriptPromise open(ScriptState*); |
72 ScriptPromise close(ScriptState*); | 72 ScriptPromise close(ScriptState*); |
73 | 73 |
74 MIDIAccess* midiAccess() const { return m_access; } | 74 MIDIAccess* midiAccess() const { return m_access; } |
75 MIDIAccessor::MIDIPortState getState() const { return m_state; } | 75 MIDIAccessor::MIDIPortState getState() const { return m_state; } |
76 void setState(MIDIAccessor::MIDIPortState); | 76 void setState(MIDIAccessor::MIDIPortState); |
77 ConnectionState getConnection() const { return m_connection; } | 77 ConnectionState getConnection() const { return m_connection; } |
78 | 78 |
79 DECLARE_VIRTUAL_TRACE(); | 79 DECLARE_VIRTUAL_TRACE(); |
80 | 80 |
81 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 81 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
82 | 82 |
83 // EventTarget | 83 // EventTarget |
84 const AtomicString& interfaceName() const override { return EventTargetNames
::MIDIPort; } | 84 const AtomicString& interfaceName() const override { return EventTargetNames
::MIDIPort; } |
85 ExecutionContext* executionContext() const override final; | 85 ExecutionContext* executionContext() const final; |
86 | 86 |
87 // ActiveDOMObject | 87 // ActiveDOMObject |
88 bool hasPendingActivity() const override; | 88 bool hasPendingActivity() const override; |
89 void stop() override; | 89 void stop() override; |
90 | 90 |
91 protected: | 91 protected: |
92 MIDIPort(MIDIAccess*, const String& id, const String& manufacturer, const St
ring& name, TypeCode, const String& version, MIDIAccessor::MIDIPortState); | 92 MIDIPort(MIDIAccess*, const String& id, const String& manufacturer, const St
ring& name, TypeCode, const String& version, MIDIAccessor::MIDIPortState); |
93 | 93 |
94 void open(); | 94 void open(); |
95 | 95 |
96 private: | 96 private: |
97 ScriptPromise accept(ScriptState*); | 97 ScriptPromise accept(ScriptState*); |
98 ScriptPromise reject(ScriptState*, ExceptionCode, const String& message); | 98 ScriptPromise reject(ScriptState*, ExceptionCode, const String& message); |
99 | 99 |
100 void setStates(MIDIAccessor::MIDIPortState, ConnectionState); | 100 void setStates(MIDIAccessor::MIDIPortState, ConnectionState); |
101 | 101 |
102 String m_id; | 102 String m_id; |
103 String m_manufacturer; | 103 String m_manufacturer; |
104 String m_name; | 104 String m_name; |
105 TypeCode m_type; | 105 TypeCode m_type; |
106 String m_version; | 106 String m_version; |
107 Member<MIDIAccess> m_access; | 107 Member<MIDIAccess> m_access; |
108 MIDIAccessor::MIDIPortState m_state; | 108 MIDIAccessor::MIDIPortState m_state; |
109 ConnectionState m_connection; | 109 ConnectionState m_connection; |
110 }; | 110 }; |
111 | 111 |
112 } // namespace blink | 112 } // namespace blink |
113 | 113 |
114 #endif // MIDIPort_h | 114 #endif // MIDIPort_h |
OLD | NEW |