Commit 6138d9ca authored by Owen Min's avatar Owen Min Committed by Commit Bot

Rename AutoplayWhitelist policy

Rename the policy to AutoplayAllowlist. The old policy is kept for
backward compatibility.

Bug: 1095632
Change-Id: Ia5ad0c36860eac82e67668e0b4d94dbe5ce317dc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2303792Reviewed-by: default avatarPavol Marko <pmarko@chromium.org>
Reviewed-by: default avatarOwen Min <zmin@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790237}
parent 80b0ec4d
...@@ -109,7 +109,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayWhitelist_Allowed) { ...@@ -109,7 +109,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayWhitelist_Allowed) {
// Update policy to allow autoplay for our test origin. // Update policy to allow autoplay for our test origin.
PolicyMap policies; PolicyMap policies;
SetPolicy(&policies, key::kAutoplayWhitelist, base::Value(whitelist)); SetPolicy(&policies, key::kAutoplayAllowlist, base::Value(whitelist));
UpdateProviderPolicy(policies); UpdateProviderPolicy(policies);
// Check that autoplay was allowed by policy. // Check that autoplay was allowed by policy.
...@@ -131,7 +131,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayWhitelist_PatternAllowed) { ...@@ -131,7 +131,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayWhitelist_PatternAllowed) {
// Update policy to allow autoplay for our test origin. // Update policy to allow autoplay for our test origin.
PolicyMap policies; PolicyMap policies;
SetPolicy(&policies, key::kAutoplayWhitelist, base::Value(whitelist)); SetPolicy(&policies, key::kAutoplayAllowlist, base::Value(whitelist));
UpdateProviderPolicy(policies); UpdateProviderPolicy(policies);
// Check that autoplay was allowed by policy. // Check that autoplay was allowed by policy.
...@@ -153,7 +153,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayWhitelist_Missing) { ...@@ -153,7 +153,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayWhitelist_Missing) {
// Update policy to allow autoplay for a random origin. // Update policy to allow autoplay for a random origin.
PolicyMap policies; PolicyMap policies;
SetPolicy(&policies, key::kAutoplayWhitelist, base::Value(whitelist)); SetPolicy(&policies, key::kAutoplayAllowlist, base::Value(whitelist));
UpdateProviderPolicy(policies); UpdateProviderPolicy(policies);
// Check that autoplay was not allowed. // Check that autoplay was not allowed.
...@@ -184,7 +184,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayDeniedByPolicy) { ...@@ -184,7 +184,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayDeniedByPolicy) {
whitelist.push_back(base::Value("https://www.example.com")); whitelist.push_back(base::Value("https://www.example.com"));
// Update policy to allow autoplay for a random origin. // Update policy to allow autoplay for a random origin.
SetPolicy(&policies, key::kAutoplayWhitelist, base::Value(whitelist)); SetPolicy(&policies, key::kAutoplayAllowlist, base::Value(whitelist));
UpdateProviderPolicy(policies); UpdateProviderPolicy(policies);
// Check that autoplay was not allowed. // Check that autoplay was not allowed.
...@@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayDeniedAllowedWithURL) { ...@@ -215,7 +215,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayDeniedAllowedWithURL) {
whitelist.push_back(base::Value(embedded_test_server()->GetURL("/").spec())); whitelist.push_back(base::Value(embedded_test_server()->GetURL("/").spec()));
// Update policy to allow autoplay for our test origin. // Update policy to allow autoplay for our test origin.
SetPolicy(&policies, key::kAutoplayWhitelist, base::Value(whitelist)); SetPolicy(&policies, key::kAutoplayAllowlist, base::Value(whitelist));
UpdateProviderPolicy(policies); UpdateProviderPolicy(policies);
// Check that autoplay was allowed by policy. // Check that autoplay was allowed by policy.
...@@ -246,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayAllowedGlobalAndURL) { ...@@ -246,7 +246,7 @@ IN_PROC_BROWSER_TEST_F(AutoplayPolicyTest, AutoplayAllowedGlobalAndURL) {
whitelist.push_back(base::Value(embedded_test_server()->GetURL("/").spec())); whitelist.push_back(base::Value(embedded_test_server()->GetURL("/").spec()));
// Update policy to allow autoplay for our test origin. // Update policy to allow autoplay for our test origin.
SetPolicy(&policies, key::kAutoplayWhitelist, base::Value(whitelist)); SetPolicy(&policies, key::kAutoplayAllowlist, base::Value(whitelist));
UpdateProviderPolicy(policies); UpdateProviderPolicy(policies);
// Check that autoplay was allowed by policy. // Check that autoplay was allowed by policy.
......
...@@ -646,9 +646,6 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = { ...@@ -646,9 +646,6 @@ const PolicyToPreferenceMapEntry kSimplePolicyMap[] = {
{ key::kAutoplayAllowed, { key::kAutoplayAllowed,
prefs::kAutoplayAllowed, prefs::kAutoplayAllowed,
base::Value::Type::BOOLEAN }, base::Value::Type::BOOLEAN },
{ key::kAutoplayWhitelist,
prefs::kAutoplayWhitelist,
base::Value::Type::LIST },
{ key::kBrowserGuestModeEnforced, { key::kBrowserGuestModeEnforced,
prefs::kBrowserGuestModeEnforced, prefs::kBrowserGuestModeEnforced,
base::Value::Type::BOOLEAN }, base::Value::Type::BOOLEAN },
...@@ -1494,6 +1491,14 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildHandlerList( ...@@ -1494,6 +1491,14 @@ std::unique_ptr<ConfigurationPolicyHandlerList> BuildHandlerList(
SimpleSchemaValidatingPolicyHandler::RECOMMENDED_ALLOWED, SimpleSchemaValidatingPolicyHandler::RECOMMENDED_ALLOWED,
SimpleSchemaValidatingPolicyHandler::MANDATORY_ALLOWED)); SimpleSchemaValidatingPolicyHandler::MANDATORY_ALLOWED));
handlers->AddHandler(std::make_unique<SimpleDeprecatingPolicyHandler>(
std::make_unique<SimplePolicyHandler>(key::kAutoplayWhitelist,
prefs::kAutoplayWhitelist,
base::Value::Type::LIST),
std::make_unique<SimplePolicyHandler>(key::kAutoplayAllowlist,
prefs::kAutoplayWhitelist,
base::Value::Type::LIST)));
// Handlers for policies with embedded JSON strings. These handlers are very // Handlers for policies with embedded JSON strings. These handlers are very
// lenient - as long as the root value is of the right type, they only display // lenient - as long as the root value is of the right type, they only display
// warnings and never reject the policy value. // warnings and never reject the policy value.
......
...@@ -6074,8 +6074,35 @@ ...@@ -6074,8 +6074,35 @@
"https://mydomain.com", "https://mydomain.com",
"https://test.mydomain.com" "https://test.mydomain.com"
] ]
}, }, "prefs": {
"prefs": { "media.autoplay_whitelist": {} } "media.autoplay_whitelist": {
"value": [
"https://mydomain.com",
"https://test.mydomain.com"
]
}
}
}
]
},
"AutoplayAllowlist": {
"os": ["win", "linux", "mac", "chromeos"],
"policy_pref_mapping_test": [
{
"policies": {
"AutoplayAllowlist": [
"https://mydomain.com",
"https://test.mydomain.com"
]
}, "prefs": {
"media.autoplay_whitelist": {
"value": [
"https://mydomain.com",
"https://test.mydomain.com"
]
}
}
} }
] ]
}, },
......
...@@ -16726,7 +16726,7 @@ ...@@ -16726,7 +16726,7 @@
'tags': [], 'tags': [],
'desc': '''Setting the policy to True lets <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> autoplay media. Setting the policy to False stops <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> from autoplaying media. 'desc': '''Setting the policy to True lets <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> autoplay media. Setting the policy to False stops <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> from autoplaying media.
By default, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> doesn't autoplay media. But, for certain URL patterns, you can use the <ph name="AUTOPLAY_WHITELIST_POLICY_NAME">AutoplayWhitelist</ph> policy to change this setting. By default, <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> doesn't autoplay media. But, for certain URL patterns, you can use the <ph name="AUTOPLAY_ALLOWLIST_POLICY_NAME">AutoplayAllowlist</ph> policy to change this setting.
If this policy changes while <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is running, it only applies to newly opened tabs.''', If this policy changes while <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is running, it only applies to newly opened tabs.''',
}, },
...@@ -16743,10 +16743,34 @@ ...@@ -16743,10 +16743,34 @@
'dynamic_refresh': True, 'dynamic_refresh': True,
'per_profile': True, 'per_profile': True,
}, },
'deprecated': True,
'example_value': ['https://www.example.com', '[*.]example.edu'], 'example_value': ['https://www.example.com', '[*.]example.edu'],
'id': 431, 'id': 431,
'caption': '''Allow media autoplay on a whitelist of URL patterns''', 'caption': '''Allow media autoplay on a whitelist of URL patterns''',
'tags': [], 'tags': [],
'desc': '''This policy is deprecated, please use the '<ph name="AUTOPLAY_ALLOWLIST_POLICY_NAME">AutoplayAllowlist</ph>' policy instead.
Setting the policy lets videos play automatically (without user consent) with audio content in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. If <ph name="AUTOPLAY_ALLOWED_POLICY_NAME">AutoplayAllowed</ph> policy is set to True, then this policy has no effect. If <ph name="AUTOPLAY_ALLOWED_POLICY_NAME">AutoplayAllowed</ph> is set to False, then any URL patterns set in this policy can still play. If this policy changes while <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is running, it only applies to newly opened tabs.
For detailed information on valid url patterns, please see https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns.''',
},
{
'name': 'AutoplayAllowlist',
'owners': ['fbeaufort@chromium.org', 'beccahughes@chromium.org'],
'type': 'list',
'schema': {
'type': 'array',
'items': { 'type': 'string' },
},
'supported_on': ['chrome.*:86-', 'chrome_os:86-'],
'features': {
'dynamic_refresh': True,
'per_profile': True,
},
'example_value': ['https://www.example.com', '[*.]example.edu'],
'id': 742,
'caption': '''Allow media autoplay on a whitelist of URL patterns''',
'tags': [],
'desc': '''Setting the policy lets videos play automatically (without user consent) with audio content in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. If <ph name="AUTOPLAY_ALLOWED_POLICY_NAME">AutoplayAllowed</ph> policy is set to True, then this policy has no effect. If <ph name="AUTOPLAY_ALLOWED_POLICY_NAME">AutoplayAllowed</ph> is set to False, then any URL patterns set in this policy can still play. If this policy changes while <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is running, it only applies to newly opened tabs. 'desc': '''Setting the policy lets videos play automatically (without user consent) with audio content in <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph>. If <ph name="AUTOPLAY_ALLOWED_POLICY_NAME">AutoplayAllowed</ph> policy is set to True, then this policy has no effect. If <ph name="AUTOPLAY_ALLOWED_POLICY_NAME">AutoplayAllowed</ph> is set to False, then any URL patterns set in this policy can still play. If this policy changes while <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> is running, it only applies to newly opened tabs.
For detailed information on valid url patterns, please see https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns.''', For detailed information on valid url patterns, please see https://cloud.google.com/docs/chrome-enterprise/policies/url-patterns.''',
...@@ -22931,6 +22955,6 @@ The recommended way to configure policy on Windows is via GPO, although provisio ...@@ -22931,6 +22955,6 @@ The recommended way to configure policy on Windows is via GPO, although provisio
], ],
'placeholders': [], 'placeholders': [],
'deleted_policy_ids': [412, 476, 546, 562, 569, 578], 'deleted_policy_ids': [412, 476, 546, 562, 569, 578],
'highest_id_currently_used': 741, 'highest_id_currently_used': 742,
'highest_atomic_group_id_currently_used': 38 'highest_atomic_group_id_currently_used': 38
} }
...@@ -21261,6 +21261,7 @@ Called by update_document_policy_enum.py.--> ...@@ -21261,6 +21261,7 @@ Called by update_document_policy_enum.py.-->
<int value="739" label="ShowFullUrlsInAddressBar"/> <int value="739" label="ShowFullUrlsInAddressBar"/>
<int value="740" label="ExtensionInstallBlocklist"/> <int value="740" label="ExtensionInstallBlocklist"/>
<int value="741" label="ReportDeviceSystemInfo"/> <int value="741" label="ReportDeviceSystemInfo"/>
<int value="742" label="AutoplayAllowlist"/>
</enum> </enum>
<enum name="EnterprisePolicyDeviceIdValidity"> <enum name="EnterprisePolicyDeviceIdValidity">
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