From af505db9082a1300e349ac1621ee1ca6929cf221 Mon Sep 17 00:00:00 2001 From: Takashi Toyoshima Date: Sat, 5 Sep 2015 14:50:47 +0900 Subject: [PATCH] Grant ChildProcessSecurityPolicy for MIDI from PermissionManager PermissionManager should set ChildProcessSecurityPolicy for MIDI SysEx permission. Otherwise, the browser kills unauthorized renderers that are going to send MIDI SysEx messages. Fixes #138. --- brightray/browser/permission_manager.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/brightray/browser/permission_manager.cc b/brightray/browser/permission_manager.cc index 1290739c3609..24795ac279ee 100644 --- a/brightray/browser/permission_manager.cc +++ b/brightray/browser/permission_manager.cc @@ -5,7 +5,10 @@ #include "browser/permission_manager.h" #include "base/callback.h" +#include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/permission_type.h" +#include "content/public/browser/render_frame_host.h" +#include "content/public/browser/render_process_host.h" namespace brightray { @@ -22,6 +25,10 @@ void PermissionManager::RequestPermission( const GURL& requesting_origin, bool user_gesture, const base::Callback& callback) { + if (permission == content::PermissionType::MIDI_SYSEX) { + content::ChildProcessSecurityPolicy::GetInstance()-> + GrantSendMidiSysExMessage(render_frame_host->GetProcess()->GetID()); + } callback.Run(content::PERMISSION_STATUS_GRANTED); }