| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "config.h" | 5 #include "config.h" |
| 6 #include "core/html/AutoplayExperimentConfig.h" | 6 #include "core/html/AutoplayExperimentConfig.h" |
| 7 | 7 |
| 8 #include "wtf/text/WTFString.h" | 8 #include "wtf/text/WTFString.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| 11 | 11 |
| 12 AutoplayExperimentConfig::Mode AutoplayExperimentConfig::fromString(const String
& mode) | 12 AutoplayExperimentConfig::Mode AutoplayExperimentConfig::fromString(const String
& mode) |
| 13 { | 13 { |
| 14 AutoplayExperimentConfig::Mode value = AutoplayExperimentConfig::Mode::Off; | 14 AutoplayExperimentConfig::Mode value = AutoplayExperimentConfig::Mode::Off; |
| 15 if (mode.contains("-forvideo")) | 15 if (mode.contains("-forvideo")) |
| 16 value |= AutoplayExperimentConfig::Mode::ForVideo; | 16 value |= AutoplayExperimentConfig::Mode::ForVideo; |
| 17 if (mode.contains("-foraudio")) | 17 if (mode.contains("-foraudio")) |
| 18 value |= AutoplayExperimentConfig::Mode::ForAudio; | 18 value |= AutoplayExperimentConfig::Mode::ForAudio; |
| 19 if (mode.contains("-ifpagevisible")) |
| 20 value |= AutoplayExperimentConfig::Mode::IfPageVisible; |
| 21 if (mode.contains("-ifviewport")) |
| 22 value |= AutoplayExperimentConfig::Mode::IfViewport; |
| 19 if (mode.contains("-ifmuted")) | 23 if (mode.contains("-ifmuted")) |
| 20 value |= AutoplayExperimentConfig::Mode::IfMuted; | 24 value |= AutoplayExperimentConfig::Mode::IfMuted; |
| 21 if (mode.contains("-ifmobile")) | 25 if (mode.contains("-ifmobile")) |
| 22 value |= AutoplayExperimentConfig::Mode::IfMobile; | 26 value |= AutoplayExperimentConfig::Mode::IfMobile; |
| 23 if (mode.contains("-playmuted")) | 27 if (mode.contains("-playmuted")) |
| 24 value |= AutoplayExperimentConfig::Mode::PlayMuted; | 28 value |= AutoplayExperimentConfig::Mode::PlayMuted; |
| 25 | 29 |
| 26 return value; | 30 return value; |
| 27 } | 31 } |
| 28 | 32 |
| 29 } // namespace blink | 33 } // namespace blink |
| OLD | NEW |