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 { ...@@ -111,6 +111,11 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest {
example_url, example_url,
CONTENT_SETTINGS_TYPE_MOUSELOCK, CONTENT_SETTINGS_TYPE_MOUSELOCK,
std::string())); 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 // Check content settings for www.google.com
GURL url("http://www.google.com"); GURL url("http://www.google.com");
...@@ -137,6 +142,9 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest { ...@@ -137,6 +142,9 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest {
EXPECT_EQ(CONTENT_SETTING_BLOCK, EXPECT_EQ(CONTENT_SETTING_BLOCK,
map->GetContentSetting( map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); 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() { void CheckContentSettingsDefault() {
...@@ -172,6 +180,9 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest { ...@@ -172,6 +180,9 @@ class ExtensionContentSettingsApiTest : public ExtensionApiTest {
EXPECT_EQ(CONTENT_SETTING_ASK, EXPECT_EQ(CONTENT_SETTING_ASK,
map->GetContentSetting( map->GetContentSetting(
url, url, CONTENT_SETTINGS_TYPE_MOUSELOCK, std::string())); 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: private:
......
...@@ -27,11 +27,14 @@ const char* const kContentSettingsTypeNames[] = { ...@@ -27,11 +27,14 @@ const char* const kContentSettingsTypeNames[] = {
"notifications", "notifications",
"auto-select-certificate", "auto-select-certificate",
"fullscreen", "fullscreen",
"mouselock" "mouselock",
"mixed-script",
"media-stream",
"media-stream-mic"
}; };
// TODO(msramek): Assert that |kContentSettingsTypeNames| is synced with enum // TODO(msramek): Assert that |kContentSettingsTypeNames| is synced with
// |ContentSettingsType| and mapping in |kContentSettingsTypeGroupNames|. // enum |ContentSettingsType|.
static_assert(arraysize(kContentSettingsTypeNames) <= static_assert(arraysize(kContentSettingsTypeNames) <=
CONTENT_SETTINGS_NUM_TYPES, CONTENT_SETTINGS_NUM_TYPES,
"kContentSettingsTypeNames has an unexpected number of elements"); "kContentSettingsTypeNames has an unexpected number of elements");
......
...@@ -236,6 +236,14 @@ ...@@ -236,6 +236,14 @@
"mouselock", "mouselock",
{"type":"string", "enum": ["allow", "block", "ask"]} {"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 = { ...@@ -15,6 +15,7 @@ var default_content_settings = {
"location": "ask", "location": "ask",
"notifications": "ask", "notifications": "ask",
"mouselock": "ask", "mouselock": "ask",
"microphone": "ask",
}; };
var settings = { var settings = {
...@@ -25,7 +26,8 @@ var settings = { ...@@ -25,7 +26,8 @@ var settings = {
"popups": "allow", "popups": "allow",
"location": "block", "location": "block",
"notifications": "block", "notifications": "block",
"mouselock": "block" "mouselock": "block",
"microphone": "block"
}; };
Object.prototype.forEach = function(f) { 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