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

Side by Side Diff: content/browser/renderer_host/media/midi_dispatcher_host.cc

Issue 142923005: Allow MessageFilters to restrict listening to specific message classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Working patch Created 6 years, 10 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 unified diff | Download patch
OLDNEW
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 namespace {
17 const uint32 kFilteredMessageClasses[] = {
18 MidiMsgStart
19 };
20 } // namespace
16 21
17 MidiDispatcherHost::MidiDispatcherHost(int render_process_id, 22 MidiDispatcherHost::MidiDispatcherHost(int render_process_id,
18 BrowserContext* browser_context) 23 BrowserContext* browser_context)
19 : render_process_id_(render_process_id), 24 : BrowserMessageFilter(
25 kFilteredMessageClasses, arraysize(kFilteredMessageClasses)),
26 render_process_id_(render_process_id),
20 browser_context_(browser_context) { 27 browser_context_(browser_context) {
21 } 28 }
22 29
23 MidiDispatcherHost::~MidiDispatcherHost() { 30 MidiDispatcherHost::~MidiDispatcherHost() {
24 } 31 }
25 32
26 bool MidiDispatcherHost::OnMessageReceived(const IPC::Message& message, 33 bool MidiDispatcherHost::OnMessageReceived(const IPC::Message& message,
27 bool* message_was_ok) { 34 bool* message_was_ok) {
28 bool handled = true; 35 bool handled = true;
29 IPC_BEGIN_MESSAGE_MAP_EX(MidiDispatcherHost, message, *message_was_ok) 36 IPC_BEGIN_MESSAGE_MAP_EX(MidiDispatcherHost, message, *message_was_ok)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 77 }
71 void MidiDispatcherHost::WasSysExPermissionGranted(int render_view_id, 78 void MidiDispatcherHost::WasSysExPermissionGranted(int render_view_id,
72 int bridge_id, 79 int bridge_id,
73 bool success) { 80 bool success) {
74 ChildProcessSecurityPolicyImpl::GetInstance()->GrantSendMidiSysExMessage( 81 ChildProcessSecurityPolicyImpl::GetInstance()->GrantSendMidiSysExMessage(
75 render_process_id_); 82 render_process_id_);
76 Send(new MidiMsg_SysExPermissionApproved(render_view_id, bridge_id, success)); 83 Send(new MidiMsg_SysExPermissionApproved(render_view_id, bridge_id, success));
77 } 84 }
78 85
79 } // namespace content 86 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698