diff options
-rw-r--r-- | chrome/browser/content_settings/host_content_settings_map_unittest.cc | 16 | ||||
-rw-r--r-- | components/content_settings/core/browser/host_content_settings_map.cc | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/chrome/browser/content_settings/host_content_settings_map_unittest.cc b/chrome/browser/content_settings/host_content_settings_map_unittest.cc index dc14204..6247af2 100644 --- a/chrome/browser/content_settings/host_content_settings_map_unittest.cc +++ b/chrome/browser/content_settings/host_content_settings_map_unittest.cc @@ -965,6 +965,7 @@ TEST_F(HostContentSettingsMapTest, IsSettingAllowedForType) { prefs, CONTENT_SETTING_ASK, CONTENT_SETTINGS_TYPE_FULLSCREEN)); + // The mediastream setting is deprecated. EXPECT_FALSE(HostContentSettingsMap::IsSettingAllowedForType( prefs, CONTENT_SETTING_ALLOW, CONTENT_SETTINGS_TYPE_MEDIASTREAM)); @@ -975,6 +976,21 @@ TEST_F(HostContentSettingsMapTest, IsSettingAllowedForType) { prefs, CONTENT_SETTING_BLOCK, CONTENT_SETTINGS_TYPE_MEDIASTREAM)); + // We support the ALLOW value for media permission exceptions, + // but not as the default setting. + EXPECT_TRUE(HostContentSettingsMap::IsSettingAllowedForType( + prefs, CONTENT_SETTING_ALLOW, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); + EXPECT_TRUE(HostContentSettingsMap::IsSettingAllowedForType( + prefs, CONTENT_SETTING_ALLOW, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); + EXPECT_FALSE(HostContentSettingsMap::IsDefaultSettingAllowedForType( + prefs, CONTENT_SETTING_ALLOW, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC)); + EXPECT_FALSE(HostContentSettingsMap::IsDefaultSettingAllowedForType( + prefs, CONTENT_SETTING_ALLOW, + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA)); + // TODO(msramek): Add more checks for setting type - setting pairs where // it is not obvious whether or not they are allowed. } diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc index 74076c5..39f70ee 100644 --- a/components/content_settings/core/browser/host_content_settings_map.cc +++ b/components/content_settings/core/browser/host_content_settings_map.cc @@ -493,6 +493,14 @@ bool HostContentSettingsMap::IsDefaultSettingAllowedForType( return false; } #endif + + // Don't support ALLOW for the default media settings. + if ((content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA || + content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) && + setting == CONTENT_SETTING_ALLOW) { + return false; + } + return IsSettingAllowedForType(prefs, setting, content_type); } |