Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: content/renderer/media/midi_message_filter.cc

Issue 662233002: Web MIDI: make MidiManagerMac notify device connections (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + cleanup Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/midi_message_filter.cc
diff --git a/content/renderer/media/midi_message_filter.cc b/content/renderer/media/midi_message_filter.cc
index 982281f72d60ef5af1058fb7dccd7fa7377a4e1e..65426a5a7e01eab3bf60d48e4c81a83b76326db8 100644
--- a/content/renderer/media/midi_message_filter.cc
+++ b/content/renderer/media/midi_message_filter.cc
@@ -116,6 +116,8 @@ bool MidiMessageFilter::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(MidiMsg_SessionStarted, OnSessionStarted)
IPC_MESSAGE_HANDLER(MidiMsg_AddInputPort, OnAddInputPort)
IPC_MESSAGE_HANDLER(MidiMsg_AddOutputPort, OnAddOutputPort)
+ IPC_MESSAGE_HANDLER(MidiMsg_SetInputPortState, OnSetInputPortState)
+ IPC_MESSAGE_HANDLER(MidiMsg_SetOutputPortState, OnSetOutputPortState)
IPC_MESSAGE_HANDLER(MidiMsg_DataReceived, OnDataReceived)
IPC_MESSAGE_HANDLER(MidiMsg_AcknowledgeSentData, OnAcknowledgeSentData)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -163,6 +165,22 @@ void MidiMessageFilter::OnAddOutputPort(media::MidiPortInfo info) {
base::Bind(&MidiMessageFilter::HandleAddOutputPort, this, info));
}
+void MidiMessageFilter::OnSetInputPortState(uint32 port, bool connected) {
+ DCHECK(io_message_loop_->BelongsToCurrentThread());
+ main_message_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&MidiMessageFilter::HandleSetInputPortState,
+ this, port, connected));
+}
+
+void MidiMessageFilter::OnSetOutputPortState(uint32 port, bool connected) {
+ DCHECK(io_message_loop_->BelongsToCurrentThread());
+ main_message_loop_->PostTask(
+ FROM_HERE,
+ base::Bind(&MidiMessageFilter::HandleSetOutputPortState,
+ this, port, connected));
+}
+
void MidiMessageFilter::OnDataReceived(uint32 port,
const std::vector<uint8>& data,
double timestamp) {
@@ -265,4 +283,16 @@ void MidiMessageFilter::HandleAckknowledgeSentData(size_t bytes_sent) {
unacknowledged_bytes_sent_ -= bytes_sent;
}
+void MidiMessageFilter::HandleSetInputPortState(uint32 port, bool connected) {
+ DCHECK(main_message_loop_->BelongsToCurrentThread());
+ inputs_[port].connected = connected;
+ // TODO(toyoshim): Notify to all clients.
+}
+
+void MidiMessageFilter::HandleSetOutputPortState(uint32 port, bool connected) {
+ DCHECK(main_message_loop_->BelongsToCurrentThread());
+ outputs_[port].connected = connected;
+ // TODO(toyoshim): Notify to all clients.
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698