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

Unified Diff: content/browser/renderer_host/media/midi_host.cc

Issue 23983004: Web MIDI: implement right sysex handling for received messages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
index e03b3dfba12027f01ba30c98c16d8e4021028f43..0467404bda31a6c2946ed25bdaeefbaadb2d143f 100644
--- a/content/browser/renderer_host/media/midi_host.cc
+++ b/content/browser/renderer_host/media/midi_host.cc
@@ -136,13 +136,16 @@ void MIDIHost::ReceiveMIDIData(
double timestamp) {
TRACE_EVENT0("midi", "MIDIHost::ReceiveMIDIData");
- // For now disallow all System Exclusive messages even if we
- // have permission.
- // TODO(toyoshim): allow System Exclusive if browser has granted
- // this client access. We'll likely need to pass a GURL
- // here to compare against our permissions.
- if (length > 0 && data[0] >= kSysExMessage)
+ // Check a process security policy to receive a system exclusive message.
+ if (length > 0 && data[0] >= kSysExMessage) {
+ if (!ChildProcessSecurityPolicyImpl::GetInstance()->CanSendMIDISysExMessage(
+ renderer_process_id_)) {
+ // MIDI devices may send a system exclusive messages even if the renderer
+ // doesn't have a permission to receive it. Don't kill the renderer as
+ // OnSendData() does.
return;
+ }
+ }
// Send to the renderer.
std::vector<uint8> v(data, data + length);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698