Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(834)

Unified Diff: third_party/WebKit/Source/core/testing/InternalSettings.cpp

Issue 2850553002: Autoplay: use an autoplay policy setting in Blink. (Closed)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/testing/InternalSettings.cpp
diff --git a/third_party/WebKit/Source/core/testing/InternalSettings.cpp b/third_party/WebKit/Source/core/testing/InternalSettings.cpp
index 396815554407a5ead4bdc07a38bffd30e09a3a62..18e7c466f874d790b8e323ec47c9af0b2c864c2d 100644
--- a/third_party/WebKit/Source/core/testing/InternalSettings.cpp
+++ b/third_party/WebKit/Source/core/testing/InternalSettings.cpp
@@ -534,4 +534,23 @@ void InternalSettings::setPresentationReceiver(
GetSettings()->SetPresentationReceiver(enabled);
}
+void InternalSettings::setAutoplayPolicy(const String& policy_str,
+ ExceptionState& exception_state) {
+ InternalSettingsGuardForSettings();
+
+ AutoplayPolicy::Type policy = AutoplayPolicy::Type::kNoUserGestureRequired;
+ if (policy_str == "no-user-gesture-required") {
+ policy = AutoplayPolicy::Type::kNoUserGestureRequired;
+ } else if (policy_str == "user-gesture-required") {
+ policy = AutoplayPolicy::Type::kUserGestureRequired;
+ } else if (policy_str == "user-gesture-required-for-cross-origin") {
+ policy = AutoplayPolicy::Type::kUserGestureRequiredForCrossOrigin;
+ } else {
+ exception_state.ThrowDOMException(
+ kSyntaxError, "The autoplay policy ('" + policy_str + ")' is invalid.");
+ }
+
+ GetSettings()->SetAutoplayPolicy(policy);
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/testing/InternalSettings.h ('k') | third_party/WebKit/Source/core/testing/InternalSettings.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698