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

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

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.cpp
diff --git a/Source/core/html/AutoplayExperimentConfig.cpp b/Source/core/html/AutoplayExperimentConfig.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..e6f8c4eea52b5d94c6ad09700ab1a7f02b0b1bdd
--- /dev/null
+++ b/Source/core/html/AutoplayExperimentConfig.cpp
@@ -0,0 +1,27 @@
+// 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.
+
+#include "config.h"
+#include "core/html/AutoplayExperimentConfig.h"
+
+namespace blink {
+
+AutoplayExperimentConfig::Mode AutoplayExperimentConfig::fromString(const String& mode)
+{
+ AutoplayExperimentConfig::Mode value = AutoplayExperimentConfig::Mode::Off;
+ if (mode.contains("enabled"))
+ value |= AutoplayExperimentConfig::Mode::Enabled;
+ if (mode.contains("-ifviewport"))
+ value |= AutoplayExperimentConfig::Mode::IfViewport;
+ if (mode.contains("-ifmuted"))
+ value |= AutoplayExperimentConfig::Mode::IfMuted;
+ if (mode.contains("-ifmobile"))
+ value |= AutoplayExperimentConfig::Mode::IfMobile;
+ if (mode.contains("-playmuted"))
+ value |= AutoplayExperimentConfig::Mode::PlayMuted;
+
+ return value;
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698