OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser/renderer_host/media/midi_dispatcher_host.h" | 5 #include "content/browser/renderer_host/media/midi_dispatcher_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "content/browser/child_process_security_policy_impl.h" | 8 #include "content/browser/child_process_security_policy_impl.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/common/media/midi_messages.h" | 10 #include "content/common/media/midi_messages.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "url/gurl.h" | 13 #include "url/gurl.h" |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 MidiDispatcherHost::MidiDispatcherHost(int render_process_id, | 17 MidiDispatcherHost::MidiDispatcherHost(int render_process_id, |
18 BrowserContext* browser_context) | 18 BrowserContext* browser_context) |
19 : BrowserMessageFilter(MidiMsgStart), | 19 : BrowserMessageFilter(MidiMsgStart), |
20 render_process_id_(render_process_id), | 20 render_process_id_(render_process_id), |
21 browser_context_(browser_context) { | 21 browser_context_(browser_context) { |
22 } | 22 } |
23 | 23 |
24 MidiDispatcherHost::~MidiDispatcherHost() { | 24 MidiDispatcherHost::~MidiDispatcherHost() { |
25 } | 25 } |
26 | 26 |
27 bool MidiDispatcherHost::OnMessageReceived(const IPC::Message& message, | 27 bool MidiDispatcherHost::OnMessageReceived(const IPC::Message& message) { |
28 bool* message_was_ok) { | |
29 bool handled = true; | 28 bool handled = true; |
30 IPC_BEGIN_MESSAGE_MAP_EX(MidiDispatcherHost, message, *message_was_ok) | 29 IPC_BEGIN_MESSAGE_MAP(MidiDispatcherHost, message) |
31 IPC_MESSAGE_HANDLER(MidiHostMsg_RequestSysExPermission, | 30 IPC_MESSAGE_HANDLER(MidiHostMsg_RequestSysExPermission, |
32 OnRequestSysExPermission) | 31 OnRequestSysExPermission) |
33 IPC_MESSAGE_HANDLER(MidiHostMsg_CancelSysExPermissionRequest, | 32 IPC_MESSAGE_HANDLER(MidiHostMsg_CancelSysExPermissionRequest, |
34 OnCancelSysExPermissionRequest) | 33 OnCancelSysExPermissionRequest) |
35 IPC_MESSAGE_UNHANDLED(handled = false) | 34 IPC_MESSAGE_UNHANDLED(handled = false) |
36 IPC_END_MESSAGE_MAP_EX() | 35 IPC_END_MESSAGE_MAP() |
37 return handled; | 36 return handled; |
38 } | 37 } |
39 | 38 |
40 void MidiDispatcherHost::OverrideThreadForMessage( | 39 void MidiDispatcherHost::OverrideThreadForMessage( |
41 const IPC::Message& message, BrowserThread::ID* thread) { | 40 const IPC::Message& message, BrowserThread::ID* thread) { |
42 if (IPC_MESSAGE_CLASS(message) == MidiMsgStart) | 41 if (IPC_MESSAGE_CLASS(message) == MidiMsgStart) |
43 *thread = BrowserThread::UI; | 42 *thread = BrowserThread::UI; |
44 } | 43 } |
45 | 44 |
46 void MidiDispatcherHost::OnRequestSysExPermission(int render_view_id, | 45 void MidiDispatcherHost::OnRequestSysExPermission(int render_view_id, |
(...skipping 26 matching lines...) Expand all Loading... |
73 } | 72 } |
74 void MidiDispatcherHost::WasSysExPermissionGranted(int render_view_id, | 73 void MidiDispatcherHost::WasSysExPermissionGranted(int render_view_id, |
75 int bridge_id, | 74 int bridge_id, |
76 bool success) { | 75 bool success) { |
77 ChildProcessSecurityPolicyImpl::GetInstance()->GrantSendMidiSysExMessage( | 76 ChildProcessSecurityPolicyImpl::GetInstance()->GrantSendMidiSysExMessage( |
78 render_process_id_); | 77 render_process_id_); |
79 Send(new MidiMsg_SysExPermissionApproved(render_view_id, bridge_id, success)); | 78 Send(new MidiMsg_SysExPermissionApproved(render_view_id, bridge_id, success)); |
80 } | 79 } |
81 | 80 |
82 } // namespace content | 81 } // namespace content |
OLD | NEW |