| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef AutoplayExperimentConfig_h | |
| 6 #define AutoplayExperimentConfig_h | |
| 7 | |
| 8 namespace WTF { | |
| 9 class String; | |
| 10 } | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 class AutoplayExperimentConfig { | |
| 15 public: | |
| 16 // Experiment configuration bits. These maybe combined. For example, | |
| 17 // ForVideo|IfMuted will override the user gesture requirement for | |
| 18 // playing video that has no audio or is muted. ForVideo, by itself, | |
| 19 // will entirely override the user gesture requirement for all video | |
| 20 // elements, but not for audio elements. | |
| 21 enum Mode { | |
| 22 // Do not enable the autoplay experiment. | |
| 23 Off = 0, | |
| 24 // Enable gestureless autoplay for video elements. | |
| 25 ForVideo = 1 << 0, | |
| 26 // Enable gestureless autoplay for audio elements. | |
| 27 ForAudio = 1 << 1, | |
| 28 // Restrict gestureless autoplay to audio-less or muted media. | |
| 29 IfMuted = 1 << 2, | |
| 30 // Restrict gestureless autoplay to sites which contain the | |
| 31 // viewport tag. | |
| 32 IfMobile = 1 << 3, | |
| 33 // If gestureless autoplay is allowed, then mute the media before | |
| 34 // starting to play. | |
| 35 PlayMuted = 1 << 4, | |
| 36 }; | |
| 37 | |
| 38 static Mode fromString(const WTF::String& token); | |
| 39 }; | |
| 40 | |
| 41 inline AutoplayExperimentConfig::Mode& operator|=(AutoplayExperimentConfig::Mode
& a, const AutoplayExperimentConfig::Mode& b) | |
| 42 { | |
| 43 a = static_cast<AutoplayExperimentConfig::Mode>( | |
| 44 static_cast<int>(a) | static_cast<int>(b)); | |
| 45 return a; | |
| 46 } | |
| 47 | |
| 48 } // namespace blink | |
| 49 | |
| 50 #endif // AutoplayExperimentConfig_h | |
| OLD | NEW |