Commit fc559c8b authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Use ExperimentalAutoplayDynamicDelegation flag

We are adding a tentative API to experiment with dynamic delegation of
"autoplay" capability, and it will work with run-time flag
--enable-blink-features=ExperimentalAutoplayDynamicDelegation.

We have a test page with this API, which will auto-play the video after
click with the flag.
http://mustaqahmed.github.io/web/autoplay-dynamic-delegation-tester.html

Bug: 985914
Change-Id: I7756032bd8e18f55bc77fdb1929238ee724d8958
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1779012Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarMustaq Ahmed <mustaq@chromium.org>
Reviewed-by: default avatarAlex Moshchuk <alexmos@chromium.org>
Commit-Queue: Lan Wei <lanwei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#692296}
parent f976e036
......@@ -460,12 +460,18 @@ void RenderFrameProxyHost::OnRouteMessageEvent(
// Transfer user activation state in the frame tree in the browser and
// the non-source and non-target renderer processes when
// |transfer_user_activation| is true.
// |transfer_user_activation| is true. We are making an expriment with
// dynamic delegation of "autoplay" capability using this post message
// approach to transfer user activation.
// TODO(lanwei): we should transfer user activation state only when
// |source_rfh| and |target_rfh| are in the same frame tree.
if (base::FeatureList::IsEnabled(
bool should_transfer_user_activation =
base::FeatureList::IsEnabled(
features::kUserActivationPostMessageTransfer) &&
message.transfer_user_activation &&
message.transfer_user_activation;
should_transfer_user_activation =
should_transfer_user_activation || message.allow_autoplay;
if (should_transfer_user_activation &&
source_rfh->frame_tree_node()->HasTransientUserActivation()) {
target_rfh->frame_tree_node()->TransferUserActivationFrom(source_rfh);
}
......
......@@ -493,11 +493,17 @@ void DOMWindow::DoPostMessage(scoped_refptr<SerializedScriptValue> message,
user_activation, options->transferUserActivation(), allow_autoplay);
// Transfer user activation state in the source's renderer when
// |transferUserActivation| is true.
// |transferUserActivation| is true. We are making an expriment with
// dynamic delegation of "autoplay" capability using this post message
// approach to transfer user activation.
// TODO(lanwei): we should execute the below code after the post task fires
// (for both local and remote posting messages).
if (RuntimeEnabledFeatures::UserActivationPostMessageTransferEnabled() &&
options->transferUserActivation() &&
bool should_transfer_user_activation =
RuntimeEnabledFeatures::UserActivationPostMessageTransferEnabled() &&
options->transferUserActivation();
should_transfer_user_activation =
should_transfer_user_activation || allow_autoplay;
if (should_transfer_user_activation &&
LocalFrame::HasTransientUserActivation(source_frame)) {
GetFrame()->TransferUserActivationFrom(source_frame);
......
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