OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/browser/renderer_host/media/midi_host.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "base/bind_helpers.h" | |
9 #include "base/debug/trace_event.h" | |
10 #include "base/process.h" | |
11 #include "content/browser/browser_main_loop.h" | |
12 #include "content/browser/media/media_internals.h" | |
13 #include "content/common/media/midi_messages.h" | |
14 #include "content/public/browser/content_browser_client.h" | |
15 #include "content/public/browser/media_observer.h" | |
16 | |
17 namespace content { | |
18 | |
19 MIDIHost::MIDIHost(media::MIDIManager* midi_manager) | |
20 : midi_manager_(midi_manager) { | |
21 midi_manager_->AddClient(this); | |
22 } | |
23 | |
24 MIDIHost::~MIDIHost() { | |
25 midi_manager_->RemoveClient(this); | |
26 } | |
27 | |
28 void MIDIHost::OnChannelClosing() { | |
29 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
30 | |
31 BrowserMessageFilter::OnChannelClosing(); | |
32 } | |
33 | |
34 void MIDIHost::OnDestruct() const { | |
35 BrowserThread::DeleteOnIOThread::Destruct(this); | |
36 } | |
37 | |
38 /////////////////////////////////////////////////////////////////////////////// | |
39 // IPC Messages handler | |
40 bool MIDIHost::OnMessageReceived(const IPC::Message& message, | |
41 bool* message_was_ok) { | |
42 bool handled = true; | |
43 IPC_BEGIN_MESSAGE_MAP_EX(MIDIHost, message, *message_was_ok) | |
44 IPC_MESSAGE_HANDLER(MIDIHostMsg_RequestAccess, OnRequestAccess) | |
45 IPC_MESSAGE_UNHANDLED(handled = false) | |
46 IPC_END_MESSAGE_MAP_EX() | |
47 | |
48 return handled; | |
49 } | |
50 | |
51 void MIDIHost::OnRequestAccess() { | |
52 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
| |
53 } | |
54 | |
55 void MIDIHost::ReceiveMIDIData( | |
56 int port_index, | |
57 const UInt8* data, | |
58 size_t length, | |
59 double time_stamp) { | |
60 TRACE_EVENT0("midi", "MIDIHost::ReceiveMIDIData"); | |
61 // Send to the renderer | |
62 std::vector<uint8> v(data, data + length); | |
63 Send(new MIDIMsg_DataReceived(port_index, v, time_stamp)); | |
64 } | |
65 | |
66 } // namespace content | |
OLD | NEW |