| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 void MIDIAccessInitializer::didSetOutputPortState(unsigned portIndex, PortState
state) | 95 void MIDIAccessInitializer::didSetOutputPortState(unsigned portIndex, PortState
state) |
| 96 { | 96 { |
| 97 // See comments on didSetInputPortState(). | 97 // See comments on didSetInputPortState(). |
| 98 NOTREACHED(); | 98 NOTREACHED(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void MIDIAccessInitializer::didStartSession(bool success, const String& error, c
onst String& message) | 101 void MIDIAccessInitializer::didStartSession(bool success, const String& error, c
onst String& message) |
| 102 { | 102 { |
| 103 DCHECK(m_accessor); | 103 DCHECK(m_accessor); |
| 104 if (success) { | 104 if (success) { |
| 105 resolve(MIDIAccess::create(m_accessor.release(), m_options.hasSysex() &&
m_options.sysex(), m_portDescriptors, getExecutionContext())); | 105 resolve(MIDIAccess::create(std::move(m_accessor), m_options.hasSysex() &
& m_options.sysex(), m_portDescriptors, getExecutionContext())); |
| 106 } else { | 106 } else { |
| 107 // The spec says the name is one of | 107 // The spec says the name is one of |
| 108 // - SecurityError | 108 // - SecurityError |
| 109 // - AbortError | 109 // - AbortError |
| 110 // - InvalidStateError | 110 // - InvalidStateError |
| 111 // - NotSupportedError | 111 // - NotSupportedError |
| 112 // TODO(toyoshim): Do not rely on |error| string. Instead an enum | 112 // TODO(toyoshim): Do not rely on |error| string. Instead an enum |
| 113 // representing an ExceptionCode should be defined and deliverred. | 113 // representing an ExceptionCode should be defined and deliverred. |
| 114 ExceptionCode ec = InvalidStateError; | 114 ExceptionCode ec = InvalidStateError; |
| 115 if (error == DOMException::getErrorName(SecurityError)) { | 115 if (error == DOMException::getErrorName(SecurityError)) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 138 { | 138 { |
| 139 return getExecutionContext()->getSecurityOrigin(); | 139 return getExecutionContext()->getSecurityOrigin(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 ExecutionContext* MIDIAccessInitializer::getExecutionContext() const | 142 ExecutionContext* MIDIAccessInitializer::getExecutionContext() const |
| 143 { | 143 { |
| 144 return getScriptState()->getExecutionContext(); | 144 return getScriptState()->getExecutionContext(); |
| 145 } | 145 } |
| 146 | 146 |
| 147 } // namespace blink | 147 } // namespace blink |
| OLD | NEW |