Check USB device path access when prompting users to select a device.
[chromium-blink-merge.git] / chrome / browser / media / midi_permission_context.cc
blob715447d53907ff50c8b9855aa2ca408e9164eb5c
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
3 // found in the LICENSE file.
5 #include "chrome/browser/media/midi_permission_context.h"
7 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
8 #include "components/content_settings/core/common/permission_request_id.h"
9 #include "content/public/browser/child_process_security_policy.h"
10 #include "url/gurl.h"
12 MidiPermissionContext::MidiPermissionContext(Profile* profile)
13 : PermissionContextBase(profile, CONTENT_SETTINGS_TYPE_MIDI_SYSEX) {
16 MidiPermissionContext::~MidiPermissionContext() {
20 void MidiPermissionContext::UpdateTabContext(const PermissionRequestID& id,
21 const GURL& requesting_frame,
22 bool allowed) {
23 TabSpecificContentSettings* content_settings =
24 TabSpecificContentSettings::Get(id.render_process_id(),
25 id.render_view_id());
26 if (!content_settings)
27 return;
29 if (allowed) {
30 content_settings->OnMidiSysExAccessed(requesting_frame);
32 content::ChildProcessSecurityPolicy::GetInstance()->
33 GrantSendMidiSysExMessage(id.render_process_id());
34 } else {
35 content_settings->OnMidiSysExAccessBlocked(requesting_frame);