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

Side by Side Diff: third_party/WebKit/Source/modules/webmidi/MIDIPort.h

Issue 2422163002: Web MIDI: use midi_service.mojom for media::midi::PortState (Closed)
Patch Set: gn --check fix Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
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 17 matching lines...) Expand all
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 MIDIPort_h 31 #ifndef MIDIPort_h
32 #define MIDIPort_h 32 #define MIDIPort_h
33 33
34 #include "bindings/core/v8/ActiveScriptWrappable.h" 34 #include "bindings/core/v8/ActiveScriptWrappable.h"
35 #include "bindings/core/v8/ScriptPromise.h" 35 #include "bindings/core/v8/ScriptPromise.h"
36 #include "core/dom/ActiveDOMObject.h" 36 #include "core/dom/ActiveDOMObject.h"
37 #include "core/dom/ExceptionCode.h" 37 #include "core/dom/ExceptionCode.h"
38 #include "media/midi/midi_service.mojom-blink.h"
38 #include "modules/EventTargetModules.h" 39 #include "modules/EventTargetModules.h"
39 #include "modules/webmidi/MIDIAccessor.h" 40 #include "modules/webmidi/MIDIAccessor.h"
40 #include "platform/heap/Handle.h" 41 #include "platform/heap/Handle.h"
41 42
42 namespace blink { 43 namespace blink {
43 44
44 class MIDIAccess; 45 class MIDIAccess;
45 46
46 class MIDIPort : public EventTargetWithInlineData, 47 class MIDIPort : public EventTargetWithInlineData,
47 public ActiveScriptWrappable, 48 public ActiveScriptWrappable,
(...skipping 17 matching lines...) Expand all
65 String manufacturer() const { return m_manufacturer; } 66 String manufacturer() const { return m_manufacturer; }
66 String name() const { return m_name; } 67 String name() const { return m_name; }
67 String state() const; 68 String state() const;
68 String type() const; 69 String type() const;
69 String version() const { return m_version; } 70 String version() const { return m_version; }
70 71
71 ScriptPromise open(ScriptState*); 72 ScriptPromise open(ScriptState*);
72 ScriptPromise close(ScriptState*); 73 ScriptPromise close(ScriptState*);
73 74
74 MIDIAccess* midiAccess() const { return m_access; } 75 MIDIAccess* midiAccess() const { return m_access; }
75 MIDIAccessor::MIDIPortState getState() const { return m_state; } 76 midi::mojom::PortState getState() const { return m_state; }
76 void setState(MIDIAccessor::MIDIPortState); 77 void setState(midi::mojom::PortState);
77 ConnectionState getConnection() const { return m_connection; } 78 ConnectionState getConnection() const { return m_connection; }
78 79
79 DECLARE_VIRTUAL_TRACE(); 80 DECLARE_VIRTUAL_TRACE();
80 81
81 DECLARE_VIRTUAL_TRACE_WRAPPERS(); 82 DECLARE_VIRTUAL_TRACE_WRAPPERS();
82 83
83 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
84 85
85 // EventTarget 86 // EventTarget
86 const AtomicString& interfaceName() const override { 87 const AtomicString& interfaceName() const override {
87 return EventTargetNames::MIDIPort; 88 return EventTargetNames::MIDIPort;
88 } 89 }
89 ExecutionContext* getExecutionContext() const final; 90 ExecutionContext* getExecutionContext() const final;
90 91
91 // ScriptWrappable 92 // ScriptWrappable
92 bool hasPendingActivity() const final; 93 bool hasPendingActivity() const final;
93 94
94 // ActiveDOMObject 95 // ActiveDOMObject
95 void contextDestroyed() override; 96 void contextDestroyed() override;
96 97
97 protected: 98 protected:
98 MIDIPort(MIDIAccess*, 99 MIDIPort(MIDIAccess*,
99 const String& id, 100 const String& id,
100 const String& manufacturer, 101 const String& manufacturer,
101 const String& name, 102 const String& name,
102 TypeCode, 103 TypeCode,
103 const String& version, 104 const String& version,
104 MIDIAccessor::MIDIPortState); 105 midi::mojom::PortState);
105 106
106 void open(); 107 void open();
107 108
108 private: 109 private:
109 ScriptPromise accept(ScriptState*); 110 ScriptPromise accept(ScriptState*);
110 ScriptPromise reject(ScriptState*, ExceptionCode, const String& message); 111 ScriptPromise reject(ScriptState*, ExceptionCode, const String& message);
111 112
112 void setStates(MIDIAccessor::MIDIPortState, ConnectionState); 113 void setStates(midi::mojom::PortState, ConnectionState);
113 114
114 String m_id; 115 String m_id;
115 String m_manufacturer; 116 String m_manufacturer;
116 String m_name; 117 String m_name;
117 TypeCode m_type; 118 TypeCode m_type;
118 String m_version; 119 String m_version;
119 Member<MIDIAccess> m_access; 120 Member<MIDIAccess> m_access;
120 MIDIAccessor::MIDIPortState m_state; 121 midi::mojom::PortState m_state;
121 ConnectionState m_connection; 122 ConnectionState m_connection;
122 }; 123 };
123 124
124 } // namespace blink 125 } // namespace blink
125 126
126 #endif // MIDIPort_h 127 #endif // MIDIPort_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webmidi/MIDIOutput.cpp ('k') | third_party/WebKit/Source/modules/webmidi/MIDIPort.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698