| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MIDIAccessInitializer_h | 5 #ifndef MIDIAccessInitializer_h |
| 6 #define MIDIAccessInitializer_h | 6 #define MIDIAccessInitializer_h |
| 7 | 7 |
| 8 #include "bindings/core/v8/ScriptPromise.h" | 8 #include "bindings/core/v8/ScriptPromise.h" |
| 9 #include "bindings/core/v8/ScriptPromiseResolver.h" | 9 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 10 #include "modules/ModulesExport.h" | 10 #include "modules/ModulesExport.h" |
| 11 #include "modules/webmidi/MIDIAccessor.h" | 11 #include "modules/webmidi/MIDIAccessor.h" |
| 12 #include "modules/webmidi/MIDIAccessorClient.h" | 12 #include "modules/webmidi/MIDIAccessorClient.h" |
| 13 #include "modules/webmidi/MIDIOptions.h" |
| 13 #include "modules/webmidi/MIDIPort.h" | 14 #include "modules/webmidi/MIDIPort.h" |
| 14 #include "wtf/OwnPtr.h" | 15 #include "wtf/OwnPtr.h" |
| 15 #include "wtf/Vector.h" | 16 #include "wtf/Vector.h" |
| 16 | 17 |
| 17 namespace blink { | 18 namespace blink { |
| 18 | 19 |
| 19 class MIDIOptions; | |
| 20 class ScriptState; | 20 class ScriptState; |
| 21 | 21 |
| 22 class MODULES_EXPORT MIDIAccessInitializer : public ScriptPromiseResolver, publi
c MIDIAccessorClient { | 22 class MODULES_EXPORT MIDIAccessInitializer : public ScriptPromiseResolver, publi
c MIDIAccessorClient { |
| 23 public: | 23 public: |
| 24 struct PortDescriptor { | 24 struct PortDescriptor { |
| 25 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); | 25 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 26 String id; | 26 String id; |
| 27 String manufacturer; | 27 String manufacturer; |
| 28 String name; | 28 String name; |
| 29 MIDIPort::TypeCode type; | 29 MIDIPort::TypeCode type; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 54 EAGERLY_FINALIZE(); | 54 EAGERLY_FINALIZE(); |
| 55 | 55 |
| 56 // MIDIAccessorClient | 56 // MIDIAccessorClient |
| 57 void didAddInputPort(const String& id, const String& manufacturer, const Str
ing& name, const String& version, MIDIAccessor::MIDIPortState) override; | 57 void didAddInputPort(const String& id, const String& manufacturer, const Str
ing& name, const String& version, MIDIAccessor::MIDIPortState) override; |
| 58 void didAddOutputPort(const String& id, const String& manufacturer, const St
ring& name, const String& version, MIDIAccessor::MIDIPortState) override; | 58 void didAddOutputPort(const String& id, const String& manufacturer, const St
ring& name, const String& version, MIDIAccessor::MIDIPortState) override; |
| 59 void didSetInputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) o
verride; | 59 void didSetInputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState) o
verride; |
| 60 void didSetOutputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState)
override; | 60 void didSetOutputPortState(unsigned portIndex, MIDIAccessor::MIDIPortState)
override; |
| 61 void didStartSession(bool success, const String& error, const String& messag
e) override; | 61 void didStartSession(bool success, const String& error, const String& messag
e) override; |
| 62 void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_
t length, double timeStamp) override { } | 62 void didReceiveMIDIData(unsigned portIndex, const unsigned char* data, size_
t length, double timeStamp) override { } |
| 63 | 63 |
| 64 void resolveSysexPermission(bool allowed); | 64 void resolvePermission(bool allowed); |
| 65 SecurityOrigin* securityOrigin() const; | 65 SecurityOrigin* securityOrigin() const; |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 MIDIAccessInitializer(ScriptState*, const MIDIOptions&); | 68 MIDIAccessInitializer(ScriptState*, const MIDIOptions&); |
| 69 | 69 |
| 70 ExecutionContext* executionContext() const; | 70 ExecutionContext* executionContext() const; |
| 71 ScriptPromise start(); | 71 ScriptPromise start(); |
| 72 void dispose(); | 72 void dispose(); |
| 73 | 73 |
| 74 void contextDestroyed() override; | 74 void contextDestroyed() override; |
| 75 | 75 |
| 76 OwnPtr<MIDIAccessor> m_accessor; | 76 OwnPtr<MIDIAccessor> m_accessor; |
| 77 Vector<PortDescriptor> m_portDescriptors; | 77 Vector<PortDescriptor> m_portDescriptors; |
| 78 bool m_requestSysex; | 78 MIDIOptions m_options; |
| 79 bool m_hasBeenDisposed; | 79 bool m_hasBeenDisposed; |
| 80 bool m_sysexPermissionResolved; | 80 bool m_permissionResolved; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace blink | 83 } // namespace blink |
| 84 | 84 |
| 85 #endif // MIDIAccessInitializer_h | 85 #endif // MIDIAccessInitializer_h |
| OLD | NEW |