Index: content/browser/renderer_host/media/midi_host.cc |
diff --git a/content/browser/renderer_host/media/midi_host.cc b/content/browser/renderer_host/media/midi_host.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5ba8a29849c19187e9d372a59e653c3a1cc72911 |
--- /dev/null |
+++ b/content/browser/renderer_host/media/midi_host.cc |
@@ -0,0 +1,66 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "content/browser/renderer_host/media/midi_host.h" |
+ |
+#include "base/bind.h" |
+#include "base/bind_helpers.h" |
+#include "base/debug/trace_event.h" |
+#include "base/process.h" |
+#include "content/browser/browser_main_loop.h" |
+#include "content/browser/media/media_internals.h" |
+#include "content/common/media/midi_messages.h" |
+#include "content/public/browser/content_browser_client.h" |
+#include "content/public/browser/media_observer.h" |
+ |
+namespace content { |
+ |
+MIDIHost::MIDIHost(media::MIDIManager* midi_manager) |
+ : midi_manager_(midi_manager) { |
+ midi_manager_->AddClient(this); |
+} |
+ |
+MIDIHost::~MIDIHost() { |
+ midi_manager_->RemoveClient(this); |
+} |
+ |
+void MIDIHost::OnChannelClosing() { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ |
+ BrowserMessageFilter::OnChannelClosing(); |
+} |
+ |
+void MIDIHost::OnDestruct() const { |
+ BrowserThread::DeleteOnIOThread::Destruct(this); |
+} |
+ |
+/////////////////////////////////////////////////////////////////////////////// |
+// IPC Messages handler |
+bool MIDIHost::OnMessageReceived(const IPC::Message& message, |
+ bool* message_was_ok) { |
+ bool handled = true; |
+ IPC_BEGIN_MESSAGE_MAP_EX(MIDIHost, message, *message_was_ok) |
+ IPC_MESSAGE_HANDLER(MIDIHostMsg_RequestAccess, OnRequestAccess) |
+ IPC_MESSAGE_UNHANDLED(handled = false) |
+ IPC_END_MESSAGE_MAP_EX() |
+ |
+ return handled; |
+} |
+ |
+void MIDIHost::OnRequestAccess() { |
+ printf("MIDIHost::OnRequestAccess()\n"); |
scherkus (not reviewing)
2013/06/03 22:44:59
I'm assuming this will have to prompt UI at some p
|
+} |
+ |
+void MIDIHost::ReceiveMIDIData( |
+ int port_index, |
+ const UInt8* data, |
+ size_t length, |
+ double time_stamp) { |
+ TRACE_EVENT0("midi", "MIDIHost::ReceiveMIDIData"); |
+ // Send to the renderer |
+ std::vector<uint8> v(data, data + length); |
+ Send(new MIDIMsg_DataReceived(port_index, v, time_stamp)); |
+} |
+ |
+} // namespace content |