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 #include "modules/webmidi/MIDIAccessInitializer.h" | 5 #include "modules/webmidi/MIDIAccessInitializer.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/Document.h" | 10 #include "core/dom/Document.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 return promise; | 51 return promise; |
52 } | 52 } |
53 | 53 |
54 void MIDIAccessInitializer::didAddInputPort(const String& id, | 54 void MIDIAccessInitializer::didAddInputPort(const String& id, |
55 const String& manufacturer, | 55 const String& manufacturer, |
56 const String& name, | 56 const String& name, |
57 const String& version, | 57 const String& version, |
58 PortState state) { | 58 PortState state) { |
59 DCHECK(m_accessor); | 59 DCHECK(m_accessor); |
60 m_portDescriptors.append(PortDescriptor(id, manufacturer, name, | 60 m_portDescriptors.push_back(PortDescriptor( |
61 MIDIPort::TypeInput, version, state)); | 61 id, manufacturer, name, MIDIPort::TypeInput, version, state)); |
62 } | 62 } |
63 | 63 |
64 void MIDIAccessInitializer::didAddOutputPort(const String& id, | 64 void MIDIAccessInitializer::didAddOutputPort(const String& id, |
65 const String& manufacturer, | 65 const String& manufacturer, |
66 const String& name, | 66 const String& name, |
67 const String& version, | 67 const String& version, |
68 PortState state) { | 68 PortState state) { |
69 DCHECK(m_accessor); | 69 DCHECK(m_accessor); |
70 m_portDescriptors.append(PortDescriptor( | 70 m_portDescriptors.push_back(PortDescriptor( |
71 id, manufacturer, name, MIDIPort::TypeOutput, version, state)); | 71 id, manufacturer, name, MIDIPort::TypeOutput, version, state)); |
72 } | 72 } |
73 | 73 |
74 void MIDIAccessInitializer::didSetInputPortState(unsigned portIndex, | 74 void MIDIAccessInitializer::didSetInputPortState(unsigned portIndex, |
75 PortState state) { | 75 PortState state) { |
76 // didSetInputPortState() is not allowed to call before didStartSession() | 76 // didSetInputPortState() is not allowed to call before didStartSession() |
77 // is called. Once didStartSession() is called, MIDIAccessorClient methods | 77 // is called. Once didStartSession() is called, MIDIAccessorClient methods |
78 // are delegated to MIDIAccess. See constructor of MIDIAccess. | 78 // are delegated to MIDIAccess. See constructor of MIDIAccess. |
79 NOTREACHED(); | 79 NOTREACHED(); |
80 } | 80 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 121 |
122 void MIDIAccessInitializer::onPermissionUpdated(PermissionStatus status) { | 122 void MIDIAccessInitializer::onPermissionUpdated(PermissionStatus status) { |
123 m_permissionService.reset(); | 123 m_permissionService.reset(); |
124 if (status == PermissionStatus::GRANTED) | 124 if (status == PermissionStatus::GRANTED) |
125 m_accessor->startSession(); | 125 m_accessor->startSession(); |
126 else | 126 else |
127 reject(DOMException::create(SecurityError)); | 127 reject(DOMException::create(SecurityError)); |
128 } | 128 } |
129 | 129 |
130 } // namespace blink | 130 } // namespace blink |
OLD | NEW |