Avi Drissman | 8ba1bad | 2022-09-13 19:22:36 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors |
[email protected] | 44ecb83 | 2013-08-02 09:06:45 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Richard Knoll | 93313106 | 2021-04-13 12:49:13 | [diff] [blame] | 5 | #include "components/permissions/contexts/midi_permission_context.h" |
| 6 | |
| 7 | #include "components/content_settings/core/common/content_settings.h" |
| 8 | #include "components/content_settings/core/common/content_settings_types.h" |
Michael Wilson | abf3a60 | 2023-07-14 20:08:30 | [diff] [blame] | 9 | #include "components/permissions/permissions_client.h" |
Sandor «Alex» Major | e9545a7 | 2025-01-31 20:40:46 | [diff] [blame] | 10 | #include "services/network/public/mojom/permissions_policy/permissions_policy_feature.mojom.h" |
Michael Wilson | 44aadf5 | 2024-03-08 19:43:49 | [diff] [blame] | 11 | #include "third_party/blink/public/common/features.h" |
[email protected] | 44ecb83 | 2013-08-02 09:06:45 | [diff] [blame] | 12 | |
Richard Knoll | 93313106 | 2021-04-13 12:49:13 | [diff] [blame] | 13 | namespace permissions { |
| 14 | |
Clark DuVall | a11361ad3 | 2020-02-20 22:14:27 | [diff] [blame] | 15 | MidiPermissionContext::MidiPermissionContext( |
| 16 | content::BrowserContext* browser_context) |
Charlie Hu | 1b9da2c | 2021-03-04 18:51:30 | [diff] [blame] | 17 | : PermissionContextBase( |
| 18 | browser_context, |
| 19 | ContentSettingsType::MIDI, |
Sandor «Alex» Major | e9545a7 | 2025-01-31 20:40:46 | [diff] [blame] | 20 | network::mojom::PermissionsPolicyFeature::kMidiFeature) {} |
[email protected] | 44ecb83 | 2013-08-02 09:06:45 | [diff] [blame] | 21 | |
Michael Wilson | 44aadf5 | 2024-03-08 19:43:49 | [diff] [blame] | 22 | MidiPermissionContext::~MidiPermissionContext() = default; |
[email protected] | 44ecb83 | 2013-08-02 09:06:45 | [diff] [blame] | 23 | |
raymes | c2cf640f | 2017-05-29 01:35:27 | [diff] [blame] | 24 | ContentSetting MidiPermissionContext::GetPermissionStatusInternal( |
| 25 | content::RenderFrameHost* render_frame_host, |
| 26 | const GURL& requesting_origin, |
| 27 | const GURL& embedding_origin) const { |
Michael Wilson | 44aadf5 | 2024-03-08 19:43:49 | [diff] [blame] | 28 | if (base::FeatureList::IsEnabled(blink::features::kBlockMidiByDefault)) { |
| 29 | return PermissionsClient::Get() |
| 30 | ->GetSettingsMap(browser_context()) |
| 31 | ->GetContentSetting(requesting_origin, embedding_origin, |
| 32 | ContentSettingsType::MIDI_SYSEX); |
Sina Firoozabadi | 95383c4 | 2023-06-23 22:41:51 | [diff] [blame] | 33 | } |
raymes | c2cf640f | 2017-05-29 01:35:27 | [diff] [blame] | 34 | return CONTENT_SETTING_ALLOW; |
[email protected] | 00880a0 | 2013-10-30 03:18:30 | [diff] [blame] | 35 | } |
mlamouri | a31c6ff1 | 2015-06-01 15:40:52 | [diff] [blame] | 36 | |
Richard Knoll | 93313106 | 2021-04-13 12:49:13 | [diff] [blame] | 37 | } // namespace permissions |