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

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: 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 DECLARE_VIRTUAL_TRACE(); 70 DECLARE_VIRTUAL_TRACE();
71 71
72 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); 72 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
73 73
74 // EventTarget 74 // EventTarget
75 virtual const AtomicString& interfaceName() const override { return EventTar getNames::MIDIPort; } 75 virtual const AtomicString& interfaceName() const override { return EventTar getNames::MIDIPort; }
76 virtual ExecutionContext* executionContext() const override final; 76 virtual ExecutionContext* executionContext() const override final;
77 77
78 protected: 78 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 { 79 enum ConnectionState {
83 ConnectionStateOpen, 80 ConnectionStateOpen,
84 ConnectionStateClosed, 81 ConnectionStateClosed,
85 ConnectionStatePending 82 ConnectionStatePending
86 }; 83 };
87 84
85 MIDIPort(MIDIAccess*, const String& id, const String& manufacturer, const St ring& name, TypeCode, const String& version, MIDIAccessor::MIDIPortState);
86 ConnectionState getConnection() const { return m_connection; }
yhirano 2015/04/02 02:15:10 I think this function can be public.
Takashi Toyoshima 2015/04/02 04:03:21 Done.
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