OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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 "content/renderer/media/renderer_webmidiaccessor_impl.h" | 5 #include "content/renderer/media/renderer_webmidiaccessor_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/renderer/media/midi_message_filter.h" | 8 #include "content/renderer/media/midi_message_filter.h" |
9 #include "content/renderer/render_thread_impl.h" | 9 #include "content/renderer/render_thread_impl.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 | 12 |
13 RendererWebMIDIAccessorImpl::RendererWebMIDIAccessorImpl( | 13 RendererWebMIDIAccessorImpl::RendererWebMIDIAccessorImpl( |
14 WebKit::WebMIDIAccessorClient* client) | 14 WebKit::WebMIDIAccessorClient* client) |
15 : client_(client) { | 15 : client_(client) { |
16 DCHECK(client_); | 16 DCHECK(client_); |
17 } | 17 } |
18 | 18 |
19 RendererWebMIDIAccessorImpl::~RendererWebMIDIAccessorImpl() { | 19 RendererWebMIDIAccessorImpl::~RendererWebMIDIAccessorImpl() { |
20 midi_message_filter()->RemoveClient(client_); | 20 midi_message_filter()->RemoveClient(client_); |
21 } | 21 } |
22 | 22 |
23 void RendererWebMIDIAccessorImpl::requestAccess(bool access) { | |
24 midi_message_filter()->RequestAccess(std::string(), client_, access ? 1 : 0); | |
25 } | |
26 | |
27 void RendererWebMIDIAccessorImpl::requestAccess(const WebKit::WebString& origin, | 23 void RendererWebMIDIAccessorImpl::requestAccess(const WebKit::WebString& origin, |
28 bool access) { | 24 bool access) { |
29 midi_message_filter()->RequestAccess(origin.utf8(), client_, access ? 1 : 0); | 25 midi_message_filter()->RequestAccess(origin.utf8(), client_, access ? 1 : 0); |
30 } | 26 } |
31 | 27 |
32 void RendererWebMIDIAccessorImpl::sendMIDIData( | 28 void RendererWebMIDIAccessorImpl::sendMIDIData( |
33 unsigned port_index, | 29 unsigned port_index, |
34 const unsigned char* data, | 30 const unsigned char* data, |
35 size_t length, | 31 size_t length, |
36 double timestamp) { | 32 double timestamp) { |
37 midi_message_filter()->SendMIDIData( | 33 midi_message_filter()->SendMIDIData( |
38 port_index, | 34 port_index, |
39 data, | 35 data, |
40 length, | 36 length, |
41 timestamp); | 37 timestamp); |
42 } | 38 } |
43 | 39 |
44 MIDIMessageFilter* RendererWebMIDIAccessorImpl::midi_message_filter() { | 40 MIDIMessageFilter* RendererWebMIDIAccessorImpl::midi_message_filter() { |
45 return RenderThreadImpl::current()->midi_message_filter(); | 41 return RenderThreadImpl::current()->midi_message_filter(); |
46 } | 42 } |
47 | 43 |
48 } // namespace content | 44 } // namespace content |
OLD | NEW |