| OLD | NEW |
| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "modules/webmidi/MIDIAccessor.h" | 31 #include "modules/webmidi/MIDIAccessor.h" |
| 32 | 32 |
| 33 #include "modules/webmidi/MIDIAccessorClient.h" | 33 #include "modules/webmidi/MIDIAccessorClient.h" |
| 34 #include "public/platform/Platform.h" | 34 #include "public/platform/Platform.h" |
| 35 #include "wtf/PtrUtil.h" | 35 #include "wtf/PtrUtil.h" |
| 36 #include "wtf/text/WTFString.h" | 36 #include "wtf/text/WTFString.h" |
| 37 #include <memory> | 37 #include <memory> |
| 38 | 38 |
| 39 using blink::WebString; | 39 using blink::WebString; |
| 40 using midi::mojom::Result; |
| 40 | 41 |
| 41 namespace blink { | 42 namespace blink { |
| 42 | 43 |
| 43 // Factory method | 44 // Factory method |
| 44 std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) { | 45 std::unique_ptr<MIDIAccessor> MIDIAccessor::create(MIDIAccessorClient* client) { |
| 45 return wrapUnique(new MIDIAccessor(client)); | 46 return wrapUnique(new MIDIAccessor(client)); |
| 46 } | 47 } |
| 47 | 48 |
| 48 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) : m_client(client) { | 49 MIDIAccessor::MIDIAccessor(MIDIAccessorClient* client) : m_client(client) { |
| 49 DCHECK(client); | 50 DCHECK(client); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void MIDIAccessor::didSetInputPortState(unsigned portIndex, | 84 void MIDIAccessor::didSetInputPortState(unsigned portIndex, |
| 84 MIDIPortState state) { | 85 MIDIPortState state) { |
| 85 m_client->didSetInputPortState(portIndex, state); | 86 m_client->didSetInputPortState(portIndex, state); |
| 86 } | 87 } |
| 87 | 88 |
| 88 void MIDIAccessor::didSetOutputPortState(unsigned portIndex, | 89 void MIDIAccessor::didSetOutputPortState(unsigned portIndex, |
| 89 MIDIPortState state) { | 90 MIDIPortState state) { |
| 90 m_client->didSetOutputPortState(portIndex, state); | 91 m_client->didSetOutputPortState(portIndex, state); |
| 91 } | 92 } |
| 92 | 93 |
| 93 void MIDIAccessor::didStartSession(bool success, | 94 void MIDIAccessor::didStartSession(Result result) { |
| 94 const WebString& error, | 95 m_client->didStartSession(result); |
| 95 const WebString& message) { | |
| 96 m_client->didStartSession(success, error, message); | |
| 97 } | 96 } |
| 98 | 97 |
| 99 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, | 98 void MIDIAccessor::didReceiveMIDIData(unsigned portIndex, |
| 100 const unsigned char* data, | 99 const unsigned char* data, |
| 101 size_t length, | 100 size_t length, |
| 102 double timeStamp) { | 101 double timeStamp) { |
| 103 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); | 102 m_client->didReceiveMIDIData(portIndex, data, length, timeStamp); |
| 104 } | 103 } |
| 105 | 104 |
| 106 } // namespace blink | 105 } // namespace blink |
| OLD | NEW |