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

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

Issue 1051903002: Web MIDI: implement implicit open() on send() and setOnmidimessage() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: setonmidi..., public Created 5 years, 8 months 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 String state() const; 59 String state() const;
60 String type() const; 60 String type() const;
61 String version() const { return m_version; } 61 String version() const { return m_version; }
62 62
63 ScriptPromise open(ScriptState*); 63 ScriptPromise open(ScriptState*);
64 ScriptPromise close(ScriptState*); 64 ScriptPromise close(ScriptState*);
65 65
66 MIDIAccess* midiAccess() const { return m_access; } 66 MIDIAccess* midiAccess() const { return m_access; }
67 MIDIAccessor::MIDIPortState getState() const { return m_state; } 67 MIDIAccessor::MIDIPortState getState() const { return m_state; }
68 void setState(MIDIAccessor::MIDIPortState); 68 void setState(MIDIAccessor::MIDIPortState);
69 ConnectionState getConnection() const { return m_connection; }
69 70
70 DECLARE_VIRTUAL_TRACE(); 71 DECLARE_VIRTUAL_TRACE();
71 72
72 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 73 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
73 74
74 // EventTarget 75 // EventTarget
75 virtual const AtomicString& interfaceName() const override { return EventTar getNames::MIDIPort; } 76 virtual const AtomicString& interfaceName() const override { return EventTar getNames::MIDIPort; }
76 virtual ExecutionContext* executionContext() const override final; 77 virtual ExecutionContext* executionContext() const override final;
77 78
78 protected: 79 protected:
79 MIDIPort(MIDIAccess*, const String& id, const String& manufacturer, const St ring& name, TypeCode, const String& version, MIDIAccessor::MIDIPortState);
80
81 private:
82 enum ConnectionState { 80 enum ConnectionState {
83 ConnectionStateOpen, 81 ConnectionStateOpen,
84 ConnectionStateClosed, 82 ConnectionStateClosed,
85 ConnectionStatePending 83 ConnectionStatePending
86 }; 84 };
87 85
86 MIDIPort(MIDIAccess*, const String& id, const String& manufacturer, const St ring& name, TypeCode, const String& version, MIDIAccessor::MIDIPortState);
87
88 void open();
89
90 private:
88 ScriptPromise accept(ScriptState*); 91 ScriptPromise accept(ScriptState*);
89 ScriptPromise reject(ScriptState*, ExceptionCode, const String& message); 92 ScriptPromise reject(ScriptState*, ExceptionCode, const String& message);
90 93
91 void setStates(MIDIAccessor::MIDIPortState, ConnectionState); 94 void setStates(MIDIAccessor::MIDIPortState, ConnectionState);
92 95
93 String m_id; 96 String m_id;
94 String m_manufacturer; 97 String m_manufacturer;
95 String m_name; 98 String m_name;
96 TypeCode m_type; 99 TypeCode m_type;
97 String m_version; 100 String m_version;
98 Member<MIDIAccess> m_access; 101 Member<MIDIAccess> m_access;
99 MIDIAccessor::MIDIPortState m_state; 102 MIDIAccessor::MIDIPortState m_state;
100 ConnectionState m_connection; 103 ConnectionState m_connection;
101 }; 104 };
102 105
103 } // namespace blink 106 } // namespace blink
104 107
105 #endif // MIDIPort_h 108 #endif // MIDIPort_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698