Commit 1069b7c1 authored by msramek's avatar msramek Committed by Commit bot

Expose microphone content setting to extensions.

BUG=452828

Review URL: https://codereview.chromium.org/880223002

Cr-Commit-Position: refs/heads/master@{#314306}
parent a550da81
......@@ -111,6 +111,11 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest {
example_url,
CONTENT_SETTINGS_TYPE_MOUSELOCK,
std::string()));
EXPECT_EQ(CONTENT_SETTING_ASK,
map->GetContentSetting(example_url,
example_url,
CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC,
std::string()));
// Check content settings for www.google.com
GURL url("http://www.google.com");
......@@ -137,6 +142,9 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest {
EXPECT_EQ(CONTENT_SETTING_BLOCK,
map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
EXPECT_EQ(CONTENT_SETTING_BLOCK,
map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()));
}
void CheckContentSettingsDefault() {
......@@ -172,6 +180,9 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest {
EXPECT_EQ(CONTENT_SETTING_ASK,
map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string()));
EXPECT_EQ(CONTENT_SETTING_ASK,
map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, std::string()));
}
private:
......
......@@ -27,11 +27,14 @@ const char* const kContentSettingsTypeNames[] = {
"notifications",
"auto-select-certificate",
"fullscreen",
"mouselock"
"mouselock",
"mixed-script",
"media-stream",
"media-stream-mic"
};
// TODO(msramek): Assert that |kContentSettingsTypeNames| is synced with enum
// |ContentSettingsType| and mapping in |kContentSettingsTypeGroupNames|.
// TODO(msramek): Assert that |kContentSettingsTypeNames| is synced with
// enum |ContentSettingsType|.
static_assert(arraysize(kContentSettingsTypeNames) <=
CONTENT_SETTINGS_NUM_TYPES,
"kContentSettingsTypeNames has an unexpected number of elements");
......
......@@ -236,6 +236,14 @@
"mouselock",
{"type":"string", "enum": ["allow", "block", "ask"]}
]
},
"microphone": {
"$ref": "ContentSetting",
"description": "Whether to allow sites to access the microphone. One of <br><var>allow</var>: Allow sites to access the microphone,<br><var>block</var>: Don't allow sites to access the microphone,<br><var>ask</var>: Ask when a site wants to access the microphone. <br>Default is <var>ask</var>.<br>The primary URL is the URL of the document which requested microphone access. The secondary URL is not used.",
"value": [
"media-stream-mic",
{"type":"string", "enum": ["allow", "block", "ask"]}
]
}
}
}
......
......@@ -15,6 +15,7 @@ var default_content_settings = {
"location": "ask",
"notifications": "ask",
"mouselock": "ask",
"microphone": "ask",
};
var settings = {
......@@ -25,7 +26,8 @@ var settings = {
"popups": "allow",
"location": "block",
"notifications": "block",
"mouselock": "block"
"mouselock": "block",
"microphone": "block"
};
Object.prototype.forEach = function(f) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment