Chromium Code Reviews| 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 "config.h" | 5 #include "config.h" |
| 6 #include "modules/webmidi/MIDIAccessInitializer.h" | 6 #include "modules/webmidi/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 "core/dom/DOMError.h" | 10 #include "core/dom/DOMError.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 48 ASSERT(document); | 48 ASSERT(document); |
| 49 MIDIController* controller = MIDIController::from(document->frame()); | 49 MIDIController* controller = MIDIController::from(document->frame()); |
| 50 if (controller) { | 50 if (controller) { |
| 51 controller->requestSysexPermission(this); | 51 controller->requestSysexPermission(this); |
| 52 } else { | 52 } else { |
| 53 reject(DOMError::create("SecurityError")); | 53 reject(DOMError::create("SecurityError")); |
| 54 } | 54 } |
| 55 return promise; | 55 return promise; |
| 56 } | 56 } |
| 57 | 57 |
| 58 void MIDIAccessInitializer::didAddInputPort(const String& id, const String& manu facturer, const String& name, const String& version) | 58 void MIDIAccessInitializer::didAddInputPort(const String& id, const String& manu facturer, const String& name, const String& version, bool active) |
| 59 { | 59 { |
| 60 ASSERT(m_accessor); | 60 ASSERT(m_accessor); |
| 61 m_portDescriptors.append(PortDescriptor(id, manufacturer, name, MIDIPort::MI DIPortTypeInput, version)); | 61 m_portDescriptors.append(PortDescriptor(id, manufacturer, name, MIDIPort::MI DIPortTypeInput, version, active)); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void MIDIAccessInitializer::didAddOutputPort(const String& id, const String& man ufacturer, const String& name, const String& version) | 64 void MIDIAccessInitializer::didAddOutputPort(const String& id, const String& man ufacturer, const String& name, const String& version, bool active) |
| 65 { | 65 { |
| 66 ASSERT(m_accessor); | 66 ASSERT(m_accessor); |
| 67 m_portDescriptors.append(PortDescriptor(id, manufacturer, name, MIDIPort::MI DIPortTypeOutput, version)); | 67 m_portDescriptors.append(PortDescriptor(id, manufacturer, name, MIDIPort::MI DIPortTypeOutput, version, active)); |
| 68 } | |
| 69 | |
| 70 void MIDIAccessInitializer::didSetInputPortState(unsigned portIndex, bool active ) | |
| 71 { | |
| 72 ASSERT_NOT_REACHED(); | |
|
yhirano
2014/10/20 02:14:10
Is this correct? IIUC the browser can fire this no
Takashi Toyoshima
2014/10/20 02:40:25
Embedder (Chromium) sends, didAddInputPort(), didA
Takashi Toyoshima
2014/10/20 05:39:50
I added comments here too.
| |
| 73 } | |
| 74 | |
| 75 void MIDIAccessInitializer::didSetOutputPortState(unsigned portIndex, bool activ e) | |
| 76 { | |
| 77 ASSERT_NOT_REACHED(); | |
|
yhirano
2014/10/20 02:14:10
ditto
Takashi Toyoshima
2014/10/20 05:39:50
ditto
| |
| 68 } | 78 } |
| 69 | 79 |
| 70 void MIDIAccessInitializer::didStartSession(bool success, const String& error, c onst String& message) | 80 void MIDIAccessInitializer::didStartSession(bool success, const String& error, c onst String& message) |
| 71 { | 81 { |
| 72 ASSERT(m_accessor); | 82 ASSERT(m_accessor); |
| 73 if (success) { | 83 if (success) { |
| 74 resolve(MIDIAccess::create(m_accessor.release(), m_requestSysex, m_portD escriptors, executionContext())); | 84 resolve(MIDIAccess::create(m_accessor.release(), m_requestSysex, m_portD escriptors, executionContext())); |
| 75 } else { | 85 } else { |
| 76 reject(DOMError::create(error, message)); | 86 reject(DOMError::create(error, message)); |
| 77 } | 87 } |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 89 { | 99 { |
| 90 return executionContext()->securityOrigin(); | 100 return executionContext()->securityOrigin(); |
| 91 } | 101 } |
| 92 | 102 |
| 93 ExecutionContext* MIDIAccessInitializer::executionContext() const | 103 ExecutionContext* MIDIAccessInitializer::executionContext() const |
| 94 { | 104 { |
| 95 return scriptState()->executionContext(); | 105 return scriptState()->executionContext(); |
| 96 } | 106 } |
| 97 | 107 |
| 98 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |