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

Unified Diff: Source/core/html/AutoplayExperimentConfig.h

Issue 1179223002: Implement autoplay gesture override experiment. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: linker errors on win/mac... Created 5 years, 4 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: Source/core/html/AutoplayExperimentConfig.h
diff --git a/Source/core/html/AutoplayExperimentConfig.h b/Source/core/html/AutoplayExperimentConfig.h
new file mode 100644
index 0000000000000000000000000000000000000000..d49d9a394b023a12d7d194428d89d13c71b66786
--- /dev/null
+++ b/Source/core/html/AutoplayExperimentConfig.h
@@ -0,0 +1,46 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef AutoplayExperimentConfig_h
+#define AutoplayExperimentConfig_h
+
+#include "wtf/text/WTFString.h"
philipj_slow 2015/09/02 09:24:11 Looks like this can be forward declared.
liberato (no reviews please) 2015/09/04 06:49:45 Done.
+
+namespace blink {
+
+// This must be kept in sync with WebSettings::AutoplayExperimentMode.
+// See WebSettings.h for documentation.
+class AutoplayExperimentConfig {
+ public:
+ enum Mode {
+ // Do not enable the autoplay experiment.
+ Off = 0,
+ // Enable gestureless autoplay.
+ Enabled = 1 << 0,
+ // Restrict gestureless autoplay to media that is visible in
+ // the viewport.
+ IfViewport = 1 << 1,
+ // Restrict gestureless autoplay to audio-less or muted media.
+ IfMuted = 1 << 2,
+ // Restrict gestureless autoplay to sites which contain the
+ // viewport tag.
+ IfMobile = 1 << 3,
+ // If gestureless autoplay is allowed, then mute the media before
+ // starting to play.
+ PlayMuted = 1 << 4,
+ };
+
+ static Mode fromString(const String& token);
+};
+
+inline AutoplayExperimentConfig::Mode& operator|=(AutoplayExperimentConfig::Mode& a, const AutoplayExperimentConfig::Mode& b)
+{
+ a = static_cast<AutoplayExperimentConfig::Mode>(
+ static_cast<int>(a) | static_cast<int>(b));
+ return a;
+}
+
+} // namespace blink
+
+#endif // AutoplayExperimentConfig_h

Powered by Google App Engine
This is Rietveld 408576698