Commit 5e84f4a4 authored by Lan Wei's avatar Lan Wei Committed by Commit Bot

Add UseCounter for dynamic delegation of autoplay

We want to put the feature of "dynamic delegation of autoplay" in a
origin trial, and we need to add a UMA metrics to track this feature's
usage. So we add a new feature kAutoplayDynamicDelegation.

Bug: 985914
Change-Id: Icabf1fd996967e36deb6f3c00bee26c4473b7ddf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1717241
Commit-Queue: Lan Wei <lanwei@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#681113}
parent 94fa1f1d
......@@ -2358,6 +2358,7 @@ enum WebFeature {
kDownloadInAdFrame = 2974,
kDownloadInSandbox = 2975,
kDownloadWithoutUserGesture = 2976,
kAutoplayDynamicDelegation = 2977,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -2277,6 +2277,8 @@ void WebLocalFrameImpl::DispatchMessageEventWithOriginCheck(
msg_event->transferUserActivation()) ||
msg_event->allowAutoplay()) {
GetFrame()->TransferUserActivationFrom(source_frame);
if (msg_event->allowAutoplay())
UseCounter::Count(GetDocument(), WebFeature::kAutoplayDynamicDelegation);
}
GetFrame()->DomWindow()->DispatchMessageEventWithOriginCheck(
......
......@@ -24141,6 +24141,7 @@ Called by update_net_error_codes.py.-->
<int value="2974" label="DownloadInAdFrame"/>
<int value="2975" label="DownloadInSandbox"/>
<int value="2976" label="DownloadWithoutUserGesture"/>
<int value="2977" label="AutoplayDynamicDelegation"/>
</enum>
<enum name="FeaturePolicyAllowlistType">
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