diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index 182e8cba..529eee12 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -150,4 +150,5 @@ Remove-weblayer-dependency-on-Play-Services.patch Timezone-customization.patch Move-some-account-settings-back-to-privacy-settings.patch Add-a-flag-to-always-view-desktop-site-for-all-websites.patch +Revert-removal-option-to-block-autoplay.patch Automated-domain-substitution.patch diff --git a/build/patches/Revert-removal-option-to-block-autoplay.patch b/build/patches/Revert-removal-option-to-block-autoplay.patch new file mode 100644 index 00000000..f1b0a374 --- /dev/null +++ b/build/patches/Revert-removal-option-to-block-autoplay.patch @@ -0,0 +1,648 @@ +From: uazo +Date: Sat, 7 Nov 2020 21:59:18 +0000 +Subject: Revert the removal of an option to block autoplay + +--- + .../browser_ui/site_settings/android/BUILD.gn | 10 ++++++++++ + .../res/drawable-hdpi/settings_autoplay.png | Bin 0 -> 456 bytes + .../java/res/drawable-hdpi/settings_media.png | Bin 0 -> 196 bytes + .../res/drawable-mdpi/settings_autoplay.png | Bin 0 -> 296 bytes + .../java/res/drawable-mdpi/settings_media.png | Bin 0 -> 144 bytes + .../res/drawable-xhdpi/settings_autoplay.png | Bin 0 -> 551 bytes + .../res/drawable-xhdpi/settings_media.png | Bin 0 -> 227 bytes + .../res/drawable-xxhdpi/settings_autoplay.png | Bin 0 -> 792 bytes + .../res/drawable-xxhdpi/settings_media.png | Bin 0 -> 297 bytes + .../drawable-xxxhdpi/settings_autoplay.png | Bin 0 -> 1064 bytes + .../res/drawable-xxxhdpi/settings_media.png | Bin 0 -> 383 bytes + .../res/xml/single_website_preferences.xml | 2 ++ + .../res/xml/site_settings_preferences.xml | 11 +++++++++++ + .../ContentSettingsResources.java | 5 +++++ + .../site_settings/SingleCategorySettings.java | 6 ++++++ + .../site_settings/SingleWebsiteSettings.java | 2 ++ + .../site_settings/SiteSettingsCategory.java | 12 +++++++++--- + .../WebsitePermissionsFetcher.java | 5 +++++ + .../WebsitePreferenceBridge.java | 9 +++++++++ + .../android/website_preference_bridge.cc | 18 ++++++++++++++++++ + .../strings/android/site_settings.grdp | 12 ++++++++++++ + .../core/browser/content_settings_utils.cc | 2 ++ + .../core/common/content_settings.cc | 1 + + .../core/common/content_settings.h | 1 + + .../core/common/content_settings.mojom | 1 + + .../common/content_settings_mojom_traits.cc | 1 + + .../common/content_settings_mojom_traits.h | 5 +++++ + .../renderer/content_settings_agent_impl.cc | 11 +++++++++++ + .../renderer/content_settings_agent_impl.h | 1 + + .../android/page_info_controller_android.cc | 1 + + .../platform/web_content_settings_client.h | 3 +++ + .../core/html/media/autoplay_policy.cc | 12 +++++++++++- + .../core/html/media/autoplay_policy.h | 4 ++++ + 33 files changed, 131 insertions(+), 4 deletions(-) + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_autoplay.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_media.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_media.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_media.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_media.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_autoplay.png + create mode 100755 components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_media.png + +diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn +--- a/components/browser_ui/site_settings/android/BUILD.gn ++++ b/components/browser_ui/site_settings/android/BUILD.gn +@@ -189,6 +189,16 @@ android_resources("java_resources") { + "java/res/drawable-xxxhdpi/settings_storage.png", + "java/res/drawable-xxxhdpi/settings_usb.png", + "java/res/drawable-xxxhdpi/web_asset.png", ++ "java/res/drawable-hdpi/settings_autoplay.png", ++ "java/res/drawable-hdpi/settings_media.png", ++ "java/res/drawable-xhdpi/settings_autoplay.png", ++ "java/res/drawable-xhdpi/settings_media.png", ++ "java/res/drawable-xxhdpi/settings_autoplay.png", ++ "java/res/drawable-xxhdpi/settings_media.png", ++ "java/res/drawable-mdpi/settings_autoplay.png", ++ "java/res/drawable-mdpi/settings_media.png", ++ "java/res/drawable-xxxhdpi/settings_autoplay.png", ++ "java/res/drawable-xxxhdpi/settings_media.png", + "java/res/drawable/ic_person_24dp.xml", + "java/res/drawable/settings_bluetooth.xml", + "java/res/layout/add_site_dialog.xml", +diff --git a/components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_autoplay.png +new file mode 100755 +GIT binary patch +literal 456 +zcmV;(0XP1MP) +zv2MaJ5QYmZs7m@68Tt%)0T}7#GcJmh4B69}fh}W`x!sUhd4N1chpY%8u@-es;cQTy +zGbWY1VQ**q%l&uuT^{am%=;qbIaI7>hvTfF;<*Ut{eMAbL!QB&HFUzBXR~2P41Zx8 +z)>!6-O>RP(9xN_j-$FSZiy-wPUj)-Jl(4<5Et;Mc!dwn%v3G5VXX+fR6 +zfpz3x+Y|Y)K6`aNHVw{qdv4}^DAdl0F;gIV|-Tf!x{>CqV{oZM{Igf1s0000m&@A# + +literal 0 +HcmV?d00001 + +diff --git a/components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_media.png b/components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_media.png +new file mode 100755 +GIT binary patch +literal 196 +zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K8x2KC^NX4zU=MHi<81S$L=`<1b9tg-XZ)JnQYL=tvV}~mQQaf~xdSupJvH|JXFV9XkV$dfg>-?u +vn-h2yPqj{9I#J^BGX7y(%C2Q$8%r6}!(y+fKlT0sbQXiBtDnm{r-UW|{=iO$ + +literal 0 +HcmV?d00001 + +diff --git a/components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png +new file mode 100755 +GIT binary patch +literal 296 +zcmV+@0oVSCP)ST5R5=Hk+X;yg9#|y{3AI^L4jN_0yR^lp_9hQ%}W9}t45wTQfw*%xg4TCAk}wycgV>|Ky0000i{Fh)C +zuztl*CdP5d)Wx2maPjwMQ|pA}h1oy29|>(?Ua0s=-o^O}bP0l+XkKX{9bg + +literal 0 +HcmV?d00001 + +diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png +new file mode 100755 +GIT binary patch +literal 551 +zcmV+?0@(eDP)fy;5RRo0wX?Hwh9Zw(#Vgp}9uO@kj!GT?W_XdLp-A4qiidDg@B~=L$xN`2Fo6Ry +zoC`9!!WnNX*>%6WZ+~v@;l6HTnG5Pb03nIUF_Q>F2&iK&{=v0ABR=d&Dwa&+>$CpO +zN8o1rOjQOd%dgDu@oJ0JqvZU3NJ!T~_A+ +zw>7k!d)Tk%U1PSM!@i8g3Qx?K@4o3Chv27xSRb|1lL*LZCn{;7NuQNv676eW3vl6flwYSMx=l(G+1kL4+N%tlEhfAQy}(nDFWr +zbXw{Z4tCiO1OTTBcDW68nyP>kgahDIfn8VxO;uQ6Yd8Q-71auD*mMx(DnrEqaHQ#wV`gM2wnZ5*JY22WGzg(js{SktOi +z^lWxu_H1_Y+jaYe^U~wOk$z>$zx3sgE%FC1e02PlFgl8cUvcTd1Q~vNjPEQT-j%AMEx!+_@2>y=002ovPDHLkV1fY;_gnw~ + +literal 0 +HcmV?d00001 + +diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_media.png b/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_media.png +new file mode 100755 +GIT binary patch +literal 227 +zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}b0DRh}-6Ar*0NFWB-OGT>o-5W`$0 +zVR5|p<$<#jMSNAFZDkA19~}4TP*}X{(9BieH|_QK_h^X`&taMElMEdew%=Xu${%}c +z>hYd@^Bw#2pT>Ooy>u?~gOIrG)xXX5&t`oR6t{SL{^#A14CWa%?Cc%yA267fZ#W#}|If(uDZsAN + +literal 0 +HcmV?d00001 + +diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png +new file mode 100755 +GIT binary patch +literal 792 +zcmV+z1LypSP)VsP6)iEx2tCzs +zN?!=Ys;Vvm+R!dxZSbnPR`u*)=$?G~q+QDONj}}54UDQIpq+dnupUkhrgMXd90~(9 +z>D-*sHYV1z%eSyr=BeO3;m5&Ge2@~l(oA;)6G#{m)`C=tNtmpB)?rp!gtK?*J1gwU@xCMXrLcRedOG_Aoa>~>!hiCJ{ojT&^9q|2A6eswfXXRwNew}jUlw`DpvbTS<8sy~{`pMeAwZ6%yL!Xy$ +zN2*G=JTQ;lS${M|)Hzo?siK0Up2cT1|*=)t}wk-{0CUjdxjX0fI83Mf&Ybo(3S(znzBU#@89zg#sfKk^r7!;A&m>sd-zwDXs+niu)Z|Ao(> +z;TfMn@`obY`5%hfKBYBiHdqh(w`25gSn1i))3E8OQ(Krf&Sz(7oXu%GJESvvoH^$@{kW&2-mUH&Qm5D=;FRVs%X@6U|5n~* +zZ__6k@b-0u=f3z+JJm01l5X&_&5k8A;h@`ejG +zf1G6f$Z`6EO$Y3g91a1QAlwARC8lu|?lvAE{9#EmgOPcI7#kzY1zTeQ2ZoEvAabU< +z19vk6(~0M7OdJaedHHw)1-`Cs*rjn|m#M=wSI4;7ZZcOY);_x0YOr!8_gDM%YZu2o +lsP4ZK`F!gs9iW?Eus#pSh>kCpxdHS$gQu&X%Q~loCIHn%dMvd@I-#RfhTrA +zML#uC<7*jKp)UCfqsuC_%t(wck71K;$=5J$u~{A)viWQYSLEv(xME8~Gk$Frr{wD& +zI9;0^#@?^uf&63!9@uK4#y8Tm7iz{GPOt-V=gT=S+ekOkUbdWb=Rw%P3EhS2?={j1 +znNJh=@$S+WRQC#g>V2o{6{t=Z?|z3LG~wtMZ-y=hF8Pd>n~yV_n@0=J13_GRGrG;6 +z!}Wm096J^ +zi6*pop5R{>=jCZ_r}{L`gMViY9x2#y;<%R48&%;r*r_TXTLH$uVB1MRu#FdSHKn7? +z`-}(CeD>8zNbpUBfCq&DBPizKc3=Bf2#S%UBhDc1I|)nBzrdE{;{7Yp^VBj!$TQBx +zU|S+zz^3T;B^;-eQx(qzY{qtLVzw3S*uwXXPwGdTn6<_H_N*cX4be2o$8UU5g&+nP +ztP-!%(B(t6s4>q!uz#qm24HoQ*AmGxMfcqM;3rOm2koVsD>M`&n>zm4?vwt*x~f|!wop&79@E9>Qn-8+GpV^zc}AJ +zFAqSSO71+T*$FqG_g1BxlLw$qrE-qb>xHV|o^zsEc>wBE^0J)HeYgSrw55wDS3~zX{EoY-``m=49hBUsaw;r=* +z+}2~(e82VBHh+(@{oX!+2n#ThdxByg0maD|^ghF~58(`dil|N~cLlAek3rFLSGLCO +ib6hJ{tXQ#P#rX?0El=KlH_u1_0000#Fp2!%_zV>{F8`{yVlop4Td;!pv81p=lm1V=ce_mIXYwA8l^tNP +z>}`Hf^4$43KP-RW{%L95Cw%(s-_lic-mUv{@z=@4$A8}35?!Uoc4Ym3lkXX~SnD?* +zefE#@LwjLF0lT3>?C;cH6E4_xFqYZ(WxZ2iv*}+v>$?Kmo*N2#nk62rH`92pAiv=s +z-!%3$`g)vR}U*#(MOYGW`!Ze{Jcr@7w)dK;R4SjE>VwZd4b5 +P>}T+F^>bP0l+XkKNl&N6 + +literal 0 +HcmV?d00001 + +diff --git a/components/browser_ui/site_settings/android/java/res/xml/single_website_preferences.xml b/components/browser_ui/site_settings/android/java/res/xml/single_website_preferences.xml +--- a/components/browser_ui/site_settings/android/java/res/xml/single_website_preferences.xml ++++ b/components/browser_ui/site_settings/android/java/res/xml/single_website_preferences.xml +@@ -69,6 +69,8 @@ + android:key="automatic_downloads_permission_list" /> + ++ + + ++ ++ ++ ++ + + JNI_WebsitePreferenceBridge_Ge + GetHostContentSettingsMap(jbrowser_context_handle)->GetTimezoneOverrideValue(timezone); + return ConvertUTF8ToJavaString(env, timezone); + } ++ ++static jboolean JNI_WebsitePreferenceBridge_GetAutoplayEnabled( ++ JNIEnv* env, ++ const JavaParamRef& jbrowser_context_handle) { ++ return GetBooleanForContentSetting(jbrowser_context_handle, ++ ContentSettingsType::AUTOPLAY); ++} ++ ++static void JNI_WebsitePreferenceBridge_SetAutoplayEnabled( ++ JNIEnv* env, ++ const JavaParamRef& jbrowser_context_handle, ++ jboolean allow) { ++ GetHostContentSettingsMap(jbrowser_context_handle) ++ ->SetDefaultContentSetting( ++ ContentSettingsType::AUTOPLAY, ++ allow ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); ++} ++ +diff --git a/components/browser_ui/strings/android/site_settings.grdp b/components/browser_ui/strings/android/site_settings.grdp +--- a/components/browser_ui/strings/android/site_settings.grdp ++++ b/components/browser_ui/strings/android/site_settings.grdp +@@ -12,6 +12,18 @@ + + Ads + ++ ++ Autoplay ++ ++ ++ Media ++ ++ ++ Allow autoplay of muted videos for a specific site. ++ ++ ++ Allow sites to automatically play muted videos (recommended) ++ + + Augmented reality + +diff --git a/components/content_settings/core/browser/content_settings_utils.cc b/components/content_settings/core/browser/content_settings_utils.cc +--- a/components/content_settings/core/browser/content_settings_utils.cc ++++ b/components/content_settings/core/browser/content_settings_utils.cc +@@ -143,6 +143,8 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map, + #endif + map->GetSettingsForOneType(ContentSettingsType::JAVASCRIPT, + ResourceIdentifier(), &(rules->script_rules)); ++ map->GetSettingsForOneType(ContentSettingsType::AUTOPLAY, ++ ResourceIdentifier(), &(rules->autoplay_rules)); + map->GetSettingsForOneType(ContentSettingsType::POPUPS, ResourceIdentifier(), + &(rules->popup_redirect_rules)); + +diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc +--- a/components/content_settings/core/common/content_settings.cc ++++ b/components/content_settings/core/common/content_settings.cc +@@ -177,6 +177,7 @@ bool RendererContentSettingRules::IsRendererContentSetting( + ContentSettingsType content_type) { + return content_type == ContentSettingsType::IMAGES || + content_type == ContentSettingsType::JAVASCRIPT || ++ content_type == ContentSettingsType::AUTOPLAY || + content_type == ContentSettingsType::CLIENT_HINTS || + content_type == ContentSettingsType::POPUPS || + content_type == ContentSettingsType::MIXEDSCRIPT || +diff --git a/components/content_settings/core/common/content_settings.h b/components/content_settings/core/common/content_settings.h +--- a/components/content_settings/core/common/content_settings.h ++++ b/components/content_settings/core/common/content_settings.h +@@ -76,6 +76,7 @@ struct RendererContentSettingRules { + ~RendererContentSettingRules(); + ContentSettingsForOneType image_rules; + ContentSettingsForOneType script_rules; ++ ContentSettingsForOneType autoplay_rules; + ContentSettingsForOneType popup_redirect_rules; + ContentSettingsForOneType mixed_content_rules; + ContentSettingsForOneType timezone_override_rules; +diff --git a/components/content_settings/core/common/content_settings.mojom b/components/content_settings/core/common/content_settings.mojom +--- a/components/content_settings/core/common/content_settings.mojom ++++ b/components/content_settings/core/common/content_settings.mojom +@@ -75,6 +75,7 @@ struct ContentSettingPatternSource { + struct RendererContentSettingRules { + array image_rules; + array script_rules; ++ array autoplay_rules; + array popup_redirect_rules; + array mixed_content_rules; + array timezone_override_rules; +diff --git a/components/content_settings/core/common/content_settings_mojom_traits.cc b/components/content_settings/core/common/content_settings_mojom_traits.cc +--- a/components/content_settings/core/common/content_settings_mojom_traits.cc ++++ b/components/content_settings/core/common/content_settings_mojom_traits.cc +@@ -99,6 +99,7 @@ bool StructTraitsimage_rules) && + data.ReadScriptRules(&out->script_rules) && ++ data.ReadAutoplayRules(&out->autoplay_rules) && + data.ReadPopupRedirectRules(&out->popup_redirect_rules) && + data.ReadMixedContentRules(&out->mixed_content_rules) && + data.ReadTimezoneOverrideRules(&out->timezone_override_rules) && +diff --git a/components/content_settings/core/common/content_settings_mojom_traits.h b/components/content_settings/core/common/content_settings_mojom_traits.h +--- a/components/content_settings/core/common/content_settings_mojom_traits.h ++++ b/components/content_settings/core/common/content_settings_mojom_traits.h +@@ -134,6 +134,11 @@ struct StructTraits< + return r.script_rules; + } + ++ static const std::vector& autoplay_rules( ++ const RendererContentSettingRules& r) { ++ return r.autoplay_rules; ++ } ++ + static const std::vector& popup_redirect_rules( + const RendererContentSettingRules& r) { + return r.popup_redirect_rules; +diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc b/components/content_settings/renderer/content_settings_agent_impl.cc +--- a/components/content_settings/renderer/content_settings_agent_impl.cc ++++ b/components/content_settings/renderer/content_settings_agent_impl.cc +@@ -425,6 +425,17 @@ bool ContentSettingsAgentImpl::AllowRunningInsecureContent( + return allow; + } + ++bool ContentSettingsAgentImpl::AllowAutoplay(bool default_value) { ++ if (!content_setting_rules_) ++ return default_value; ++ ++ blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); ++ return GetContentSettingFromRules( ++ content_setting_rules_->autoplay_rules, frame, ++ url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL()) == ++ CONTENT_SETTING_ALLOW; ++} ++ + bool ContentSettingsAgentImpl::AllowPopupsAndRedirects(bool default_value) { + if (!content_setting_rules_) + return default_value; +diff --git a/components/content_settings/renderer/content_settings_agent_impl.h b/components/content_settings/renderer/content_settings_agent_impl.h +--- a/components/content_settings/renderer/content_settings_agent_impl.h ++++ b/components/content_settings/renderer/content_settings_agent_impl.h +@@ -98,6 +98,7 @@ class ContentSettingsAgentImpl + void DidNotAllowScript() override; + bool AllowRunningInsecureContent(bool allowed_per_settings, + const blink::WebURL& url) override; ++ bool AllowAutoplay(bool default_value) override; + bool AllowPopupsAndRedirects(bool default_value) override; + void PassiveInsecureContentFound(const blink::WebURL& resource_url) override; + bool ShouldAutoupgradeMixedContent() override; +diff --git a/components/page_info/android/page_info_controller_android.cc b/components/page_info/android/page_info_controller_android.cc +--- a/components/page_info/android/page_info_controller_android.cc ++++ b/components/page_info/android/page_info_controller_android.cc +@@ -120,6 +120,7 @@ void PageInfoControllerAndroid::SetPermissionInfo( + permissions_to_display.push_back(ContentSettingsType::ADS); + permissions_to_display.push_back( + ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER); ++ permissions_to_display.push_back(ContentSettingsType::AUTOPLAY); + permissions_to_display.push_back(ContentSettingsType::SOUND); + if (base::FeatureList::IsEnabled(features::kWebNfc)) + permissions_to_display.push_back(ContentSettingsType::NFC); +diff --git a/third_party/blink/public/platform/web_content_settings_client.h b/third_party/blink/public/platform/web_content_settings_client.h +--- a/third_party/blink/public/platform/web_content_settings_client.h ++++ b/third_party/blink/public/platform/web_content_settings_client.h +@@ -92,6 +92,9 @@ class WebContentSettingsClient { + // interface. + virtual bool AllowMutationEvents(bool default_value) { return default_value; } + ++ // Controls whether autoplay is allowed for this frame. ++ virtual bool AllowAutoplay(bool default_value) { return default_value; } ++ + virtual bool AllowPopupsAndRedirects(bool default_value) { + return default_value; + } +diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.cc b/third_party/blink/renderer/core/html/media/autoplay_policy.cc +--- a/third_party/blink/renderer/core/html/media/autoplay_policy.cc ++++ b/third_party/blink/renderer/core/html/media/autoplay_policy.cc +@@ -7,6 +7,7 @@ + #include "build/build_config.h" + #include "third_party/blink/public/mojom/autoplay/autoplay.mojom-blink.h" + #include "third_party/blink/public/mojom/feature_policy/feature_policy.mojom-blink.h" ++#include "third_party/blink/public/platform/web_content_settings_client.h" + #include "third_party/blink/public/platform/web_media_player.h" + #include "third_party/blink/public/web/web_local_frame.h" + #include "third_party/blink/public/web/web_local_frame_client.h" +@@ -311,7 +312,7 @@ bool AutoplayPolicy::IsGestureNeededForPlayback() const { + + // We want to allow muted video to autoplay if the element is allowed to + // autoplay muted. +- return !IsEligibleForAutoplayMuted(); ++ return !(IsEligibleForAutoplayMuted() && IsAutoplayAllowedPerSettings()); + } + + String AutoplayPolicy::GetPlayErrorMessage() const { +@@ -380,6 +381,15 @@ void AutoplayPolicy::MaybeSetAutoplayInitiated() { + } + } + ++bool AutoplayPolicy::IsAutoplayAllowedPerSettings() const { ++ LocalFrame* frame = element_->GetDocument().GetFrame(); ++ if (!frame) ++ return false; ++ if (auto* settings_client = frame->GetContentSettingsClient()) ++ return settings_client->AllowAutoplay(true /* default_value */); ++ return true; ++} ++ + bool AutoplayPolicy::ShouldAutoplay() { + if (!element_->GetExecutionContext() || + element_->GetExecutionContext()->IsSandboxed( +diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.h b/third_party/blink/renderer/core/html/media/autoplay_policy.h +--- a/third_party/blink/renderer/core/html/media/autoplay_policy.h ++++ b/third_party/blink/renderer/core/html/media/autoplay_policy.h +@@ -131,6 +131,10 @@ class CORE_EXPORT AutoplayPolicy final + // should use, if checking to see if an action is allowed. + bool IsLockedPendingUserGesture() const; + ++ // Return true if and only if the settings allow autoplay of media on this ++ // frame. ++ bool IsAutoplayAllowedPerSettings() const; ++ + bool IsAutoplayingMutedInternal(bool muted) const; + bool IsOrWillBeAutoplayingMutedInternal(bool muted) const; +-- +2.17.1 +